UBER-1006: Support Ref for Vacancies (#4104)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-11-29 21:43:39 +05:00 committed by GitHub
parent d77cb5b807
commit ca8bc92cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 8 deletions

View File

@ -217,6 +217,10 @@ export function createModel (builder: Builder): void {
fields: ['createdBy']
})
builder.mixin(recruit.class.Vacancy, core.class.Class, view.mixin.AttributeEditor, {
inlineEditor: recruit.component.VacancyEditor
})
builder.mixin(recruit.class.Applicant, core.class.Class, notification.mixin.ClassCollaborators, {
fields: ['createdBy']
})

View File

@ -115,7 +115,8 @@ export default mergeIds(recruitId, recruit, {
ApplicationMatchPresenter: '' as AnyComponent,
MatchVacancy: '' as AnyComponent,
NotificationApplicantPresenter: '' as AnyComponent
NotificationApplicantPresenter: '' as AnyComponent,
VacancyEditor: '' as AnyComponent
},
template: {
DefaultVacancy: '' as Ref<ProjectType>

View File

@ -58,6 +58,7 @@
export let componentProps: any | undefined = undefined
export let autoSelect = true
export let readonly = false
export let ignoreFill = false
export let iconWithEmoji: AnySvelteComponent | Asset | ComponentType | undefined = view.ids.IconWithEmoji
export let defaultIcon: AnySvelteComponent | Asset | ComponentType = IconFolder
export let findDefaultSpace: (() => Promise<Space | undefined>) | undefined = undefined
@ -131,12 +132,14 @@
icon={selected?.icon === iconWithEmoji && iconWithEmoji ? IconWithEmoji : selected?.icon ?? defaultIcon}
iconProps={selected?.icon === iconWithEmoji && iconWithEmoji
? { icon: selected?.color }
: {
fill:
selected?.color !== undefined
? getPlatformColorDef(selected?.color, $themeStore.dark).icon
: getPlatformColorForTextDef(selected?.name ?? '', $themeStore.dark).icon
}}
: ignoreFill
? undefined
: {
fill:
selected?.color !== undefined
? getPlatformColorDef(selected?.color, $themeStore.dark).icon
: getPlatformColorForTextDef(selected?.name ?? '', $themeStore.dark).icon
}}
{size}
{kind}
{justify}

View File

@ -0,0 +1,51 @@
<!--
// Copyright © 2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import { Ref, RefTo } from '@hcengineering/core'
import { IntlString } from '@hcengineering/platform'
import { ButtonKind, ButtonSize } from '@hcengineering/ui'
import recruit from '../plugin'
import { Vacancy } from '@hcengineering/recruit'
import { SpaceSelect } from '@hcengineering/presentation'
export let value: Ref<Vacancy> | undefined
export let label: IntlString = recruit.string.Vacancy
export let onChange: (value: any) => void
export let type: RefTo<Vacancy> | undefined
export let kind: ButtonKind = 'no-border'
export let size: ButtonSize = 'small'
export let justify: 'left' | 'center' = 'center'
export let width: string | undefined = undefined
$: _value = value != null ? value : undefined
$: _class = type?.to ?? recruit.class.Vacancy
</script>
<SpaceSelect
{_class}
{label}
bind:value={_value}
{kind}
{size}
{justify}
{width}
allowDeselect
autoSelect={false}
defaultIcon={recruit.icon.Vacancy}
iconWithEmoji={recruit.icon.Vacancy}
ignoreFill
on:change={(e) => {
onChange(e.detail)
}}
/>

View File

@ -55,6 +55,7 @@ import VacancyList from './components/VacancyList.svelte'
import VacancyModifiedPresenter from './components/VacancyModifiedPresenter.svelte'
import VacancyPresenter from './components/VacancyPresenter.svelte'
import VacancyTemplateEditor from './components/VacancyTemplateEditor.svelte'
import VacancyEditor from './components/VacancyEditor.svelte'
import CreateOpinion from './components/review/CreateOpinion.svelte'
import CreateReview from './components/review/CreateReview.svelte'
import EditReview from './components/review/EditReview.svelte'
@ -357,7 +358,8 @@ export default async (): Promise<Resources> => ({
VacancyTemplateEditor,
MatchVacancy,
NotificationApplicantPresenter
NotificationApplicantPresenter,
VacancyEditor
},
completion: {
ApplicationQuery: async (