From b6c89949992eae415ef6102bc5f6ce2e7466de0e Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Sun, 29 May 2022 11:32:39 +0700 Subject: [PATCH] Fix skills target and application labels (#1896) Signed-off-by: Andrey Sobolev --- models/recruit/src/migration.ts | 14 -------------- models/task/package.json | 3 ++- models/task/src/migration.ts | 17 ++++++++++++++++- models/task/src/plugin.ts | 4 +++- plugins/recruit-resources/src/plugin.ts | 3 +-- .../tags-resources/src/components/Tags.svelte | 8 ++++---- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/models/recruit/src/migration.ts b/models/recruit/src/migration.ts index 22cc82bd09..6c2f663eaf 100644 --- a/models/recruit/src/migration.ts +++ b/models/recruit/src/migration.ts @@ -92,20 +92,6 @@ async function createDefaults (tx: TxOperations): Promise { await createSequence(tx, recruit.class.Opinion) await createSequence(tx, recruit.class.Applicant) await createDefaultKanbanTemplate(tx) - - await createOrUpdate( - tx, - tags.class.TagCategory, - tags.space.Tags, - { - icon: tags.icon.Tags, - label: 'Text Label', - targetClass: recruit.class.Applicant, - tags: [], - default: true - }, - recruit.category.OtherLabel - ) } async function createDefaultKanbanTemplate (tx: TxOperations): Promise> { diff --git a/models/task/package.json b/models/task/package.json index 6ae191dce4..07eafd5238 100644 --- a/models/task/package.json +++ b/models/task/package.json @@ -41,6 +41,7 @@ "@anticrm/workbench": "~0.6.1", "@anticrm/view": "~0.6.0", "@anticrm/model-presentation": "~0.6.0", - "@anticrm/tags": "~0.6.2" + "@anticrm/tags": "~0.6.2", + "@anticrm/model-tags": "~0.6.0" } } diff --git a/models/task/src/migration.ts b/models/task/src/migration.ts index ea8633a5c5..e0c8c07c74 100644 --- a/models/task/src/migration.ts +++ b/models/task/src/migration.ts @@ -14,11 +14,12 @@ // import { Class, Doc, Ref, Space, TxOperations } from '@anticrm/core' -import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@anticrm/model' +import { createOrUpdate, MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@anticrm/model' import core from '@anticrm/model-core' import { KanbanTemplate, StateTemplate, DoneStateTemplate, genRanks, createKanban } from '@anticrm/task' import { DOMAIN_TASK } from '.' import task from './plugin' +import tags from '@anticrm/model-tags' /** * @public @@ -196,5 +197,19 @@ export const taskOperation: MigrateOperation = { async upgrade (client: MigrationUpgradeClient): Promise { const tx = new TxOperations(client, core.account.System) await createDefaults(tx) + + await createOrUpdate( + tx, + tags.class.TagCategory, + tags.space.Tags, + { + icon: tags.icon.Tags, + label: 'Text Label', + targetClass: task.class.Task, + tags: [], + default: true + }, + task.category.TaskTag + ) } } diff --git a/models/task/src/plugin.ts b/models/task/src/plugin.ts index de1284adaa..ef73edb4b4 100644 --- a/models/task/src/plugin.ts +++ b/models/task/src/plugin.ts @@ -18,6 +18,7 @@ import type { Ref, Space } from '@anticrm/core' import { ObjectSearchCategory, ObjectSearchFactory } from '@anticrm/model-presentation' import type { Resource } from '@anticrm/platform' import { mergeIds } from '@anticrm/platform' +import { TagCategory } from '@anticrm/tags' import { KanbanTemplate, taskId } from '@anticrm/task' import task from '@anticrm/task-resources/src/plugin' import type { AnyComponent } from '@anticrm/ui' @@ -39,7 +40,8 @@ export default mergeIds(taskId, task, { UnarchiveSpace: '' as ViewAction }, category: { - Task: '' as Ref + Task: '' as Ref, + TaskTag: '' as Ref }, component: { ProjectView: '' as AnyComponent, diff --git a/plugins/recruit-resources/src/plugin.ts b/plugins/recruit-resources/src/plugin.ts index d4713e5abc..ec130ad3cf 100644 --- a/plugins/recruit-resources/src/plugin.ts +++ b/plugins/recruit-resources/src/plugin.ts @@ -112,8 +112,7 @@ export default mergeIds(recruitId, recruit, { }, category: { Other: '' as Ref, - Category: '' as Ref, - OtherLabel: '' as Ref + Category: '' as Ref }, component: { VacancyItemPresenter: '' as AnyComponent, diff --git a/plugins/tags-resources/src/components/Tags.svelte b/plugins/tags-resources/src/components/Tags.svelte index a5c1539f0e..33d4a05e18 100644 --- a/plugins/tags-resources/src/components/Tags.svelte +++ b/plugins/tags-resources/src/components/Tags.svelte @@ -30,7 +30,7 @@ $: query.query( tags.class.TagReference, - { attachedTo: object._id, attachedToClass: object._class }, + { attachedTo: object._id, attachedToClass: _class }, (result) => { items = result }, @@ -38,7 +38,7 @@ ) async function addRef (tag: TagElement): Promise { - await client.addCollection(tags.class.TagReference, object.space, object._id, object._class, key.key, { + await client.addCollection(tags.class.TagReference, object.space, object._id, _class, key.key, { title: tag.title, tag: tag._id, color: tag.color @@ -46,7 +46,7 @@ } async function removeTag (id: Ref): Promise { - await client.removeCollection(tags.class.TagReference, object.space, id, object._id, object._class, key.key) + await client.removeCollection(tags.class.TagReference, object.space, id, object._id, _class, key.key) } let elements: Map, TagElement> = new Map() @@ -60,7 +60,7 @@ bind:elements {key} bind:items - targetClass={object._class} + targetClass={_class} on:open={(evt) => addRef(evt.detail)} on:delete={(evt) => removeTag(evt.detail)} />