From c6ff5f19ec877f46e72e2364159422bf6a58f61b Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Wed, 1 Jun 2022 09:25:13 +0600 Subject: [PATCH] Vacancy configure (#1962) Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> --- changelog.md | 4 + models/contact/src/index.ts | 2 +- models/recruit/src/index.ts | 24 ++- .../src/components/Contacts.svelte | 18 +-- .../src/components/Products.svelte | 27 +--- .../src/components/Customers.svelte | 16 +- .../src/components/ApplicationsView.svelte | 18 +-- .../src/components/Candidates.svelte | 18 +-- .../src/components/Vacancies.svelte | 138 ++++++++++++------ .../src/components/VacancyPresenter.svelte | 49 +++++-- .../src/components/Table.svelte | 2 +- .../src/components/ViewletSetting.svelte | 35 +++-- .../components/ViewletSettingButton.svelte | 34 +++++ plugins/view-resources/src/index.ts | 43 +++--- plugins/view-resources/src/utils.ts | 41 ++++-- plugins/view/src/index.ts | 1 - .../src/components/SpaceHeader.svelte | 18 +-- 17 files changed, 282 insertions(+), 206 deletions(-) create mode 100644 plugins/view-resources/src/components/ViewletSettingButton.svelte diff --git a/changelog.md b/changelog.md index 93b9cb4516..06b84ffc39 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,10 @@ Platform: - Fix skills/labels selection and show real usage counter - Fix skills/labels activity +HR: + +- Allow to configure vacancy table + ## 0.6.22 Platform: diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 9f6e4fd9bd..d787a45bcb 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -201,7 +201,7 @@ export function createModel (builder: Builder): void { editor: contact.component.PersonEditor }) - builder.mixin(contact.class.Channel, core.class.Class, view.mixin.AttributePresenter, { + builder.mixin(contact.class.Channel, core.class.Class, view.mixin.CollectionPresenter, { presenter: contact.component.ChannelsPresenter }) diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 36b6bec3d5..1147546a5f 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -134,10 +134,6 @@ export function createModel (builder: Builder): void { } }) - builder.mixin(core.class.Space, core.class.Class, view.mixin.AttributePresenter, { - presenter: recruit.component.VacancyItemPresenter - }) - builder.mixin(recruit.class.Applicant, core.class.Class, view.mixin.CollectionEditor, { editor: recruit.component.Applications }) @@ -269,6 +265,26 @@ export function createModel (builder: Builder): void { hiddenKeys: ['name'] }) + builder.createDoc(view.class.Viewlet, core.space.Model, { + attachTo: recruit.class.Vacancy, + descriptor: view.viewlet.Table, + config: [ + '', + { + key: '@applications', + label: recruit.string.Applications + }, + '$lookup.company', + 'location', + 'description', + { + key: '@applications.modifiedOn', + label: core.string.Modified + } + ], + hiddenKeys: ['name', 'space', 'modifiedOn'] + }) + builder.createDoc(view.class.Viewlet, core.space.Model, { attachTo: recruit.class.Applicant, descriptor: task.viewlet.StatusTable, diff --git a/plugins/contact-resources/src/components/Contacts.svelte b/plugins/contact-resources/src/components/Contacts.svelte index a46467ea3a..5dcefcb13b 100644 --- a/plugins/contact-resources/src/components/Contacts.svelte +++ b/plugins/contact-resources/src/components/Contacts.svelte @@ -16,10 +16,10 @@
+
- +{#if descr} + {#if loading} + + {:else} + + {/if} +{/if} diff --git a/plugins/recruit-resources/src/components/VacancyPresenter.svelte b/plugins/recruit-resources/src/components/VacancyPresenter.svelte index 5a93298b8b..0e94f709af 100644 --- a/plugins/recruit-resources/src/components/VacancyPresenter.svelte +++ b/plugins/recruit-resources/src/components/VacancyPresenter.svelte @@ -15,23 +15,54 @@ --> {#if value} - + {/if} diff --git a/plugins/view-resources/src/components/Table.svelte b/plugins/view-resources/src/components/Table.svelte index 04915c80d7..94afe292c0 100644 --- a/plugins/view-resources/src/components/Table.svelte +++ b/plugins/view-resources/src/components/Table.svelte @@ -43,7 +43,7 @@ const client = getClient() const hierarchy = client.getHierarchy() - $: lookup = buildConfigLookup(hierarchy, _class, config) + $: lookup = options?.lookup ?? buildConfigLookup(hierarchy, _class, config) let sortKey = 'modifiedOn' let sortOrder = SortingOrder.Descending diff --git a/plugins/view-resources/src/components/ViewletSetting.svelte b/plugins/view-resources/src/components/ViewletSetting.svelte index bec223ac82..1754460e1c 100644 --- a/plugins/view-resources/src/components/ViewletSetting.svelte +++ b/plugins/view-resources/src/components/ViewletSetting.svelte @@ -102,27 +102,26 @@ const allAttributes = hierarchy.getAllAttributes(viewlet.attachTo) for (const [, attribute] of allAttributes) { + if (attribute.hidden === true || attribute.label === undefined) continue + if (viewlet.hiddenKeys?.includes(attribute.name)) continue + if (hierarchy.isDerived(attribute.type._class, core.class.Collection)) continue const value = getValue(attribute.name, attribute.type) if (result.findIndex((p) => p.value === value) !== -1) continue - if (hierarchy.isDerived(attribute.type._class, core.class.Collection)) continue - if (viewlet.hiddenKeys?.includes(value)) continue - if (attribute.hidden !== true && attribute.label !== undefined) { - const typeClassId = getAttributePresenterClass(attribute) - const typeClass = hierarchy.getClass(typeClassId) - let presenter = hierarchy.as(typeClass, view.mixin.AttributePresenter).presenter - let parent = typeClass.extends - while (presenter === undefined && parent !== undefined) { - const pclazz = hierarchy.getClass(parent) - presenter = hierarchy.as(pclazz, view.mixin.AttributePresenter).presenter - parent = pclazz.extends - } - if (presenter === undefined) continue - result.push({ - value, - label: attribute.label, - enabled: false - }) + const typeClassId = getAttributePresenterClass(attribute) + const typeClass = hierarchy.getClass(typeClassId) + let presenter = hierarchy.as(typeClass, view.mixin.AttributePresenter).presenter + let parent = typeClass.extends + while (presenter === undefined && parent !== undefined) { + const pclazz = hierarchy.getClass(parent) + presenter = hierarchy.as(pclazz, view.mixin.AttributePresenter).presenter + parent = pclazz.extends } + if (presenter === undefined) continue + result.push({ + value, + label: attribute.label, + enabled: false + }) } return preference === undefined ? result : setStatus(result, preference) diff --git a/plugins/view-resources/src/components/ViewletSettingButton.svelte b/plugins/view-resources/src/components/ViewletSettingButton.svelte new file mode 100644 index 0000000000..43b13139f9 --- /dev/null +++ b/plugins/view-resources/src/components/ViewletSettingButton.svelte @@ -0,0 +1,34 @@ + + + +{#if viewlet} + +