Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBER-1006: Support Ref for Vacancies #4104

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions models/recruit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']
})
Expand Down
3 changes: 2 additions & 1 deletion models/recruit/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
15 changes: 9 additions & 6 deletions packages/presentation/src/components/SpaceSelect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
51 changes: 51 additions & 0 deletions plugins/recruit-resources/src/components/VacancyEditor.svelte
Original file line number Diff line number Diff line change
@@ -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)
}}
/>
4 changes: 3 additions & 1 deletion plugins/recruit-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -357,7 +358,8 @@ export default async (): Promise<Resources> => ({
VacancyTemplateEditor,

MatchVacancy,
NotificationApplicantPresenter
NotificationApplicantPresenter,
VacancyEditor
},
completion: {
ApplicationQuery: async (
Expand Down