diff --git a/plugins/tags-assets/lang/en.json b/plugins/tags-assets/lang/en.json index b714c86b9e..b1a6cc29a7 100644 --- a/plugins/tags-assets/lang/en.json +++ b/plugins/tags-assets/lang/en.json @@ -16,6 +16,7 @@ "TagCreateLabel": "Tag", "CancelLabel": "Cancel", "SearchCreate": "Search/Name ...", + "QuickAddItems": "Quick Add {word} \"{title}\"", "NoItems": "There is no {word} added ...", "TagDescriptionLabel": "Description", "TagDescriptionPlaceholder": "Please type description here", diff --git a/plugins/tags-assets/lang/es.json b/plugins/tags-assets/lang/es.json index d42dee8244..226f30da35 100644 --- a/plugins/tags-assets/lang/es.json +++ b/plugins/tags-assets/lang/es.json @@ -16,6 +16,7 @@ "TagCreateLabel": "Etiqueta", "CancelLabel": "Cancelar", "SearchCreate": "Buscar/Nombre...", + "QuickAddItems": "Agregar {word} rápidamente \"{title}\"", "NoItems": "No hay ninguna {word} añadida...", "TagDescriptionLabel": "Descripción", "TagDescriptionPlaceholder": "Escriba la descripción aquí", diff --git a/plugins/tags-assets/lang/pt.json b/plugins/tags-assets/lang/pt.json index 65b2c42bcc..84cc9d88ae 100644 --- a/plugins/tags-assets/lang/pt.json +++ b/plugins/tags-assets/lang/pt.json @@ -16,6 +16,7 @@ "TagCreateLabel": "Etiqueta", "CancelLabel": "Cancelar", "SearchCreate": "Pesquisar/Nome...", + "QuickAddItems": "{word} de adição rápida \"{title}\"", "NoItems": "Não há nenhuma {word} adicionada...", "TagDescriptionLabel": "Descrição", "TagDescriptionPlaceholder": "Escreva a descrição aqui", diff --git a/plugins/tags-assets/lang/ru.json b/plugins/tags-assets/lang/ru.json index 2d2ccf5f20..feeb98367e 100644 --- a/plugins/tags-assets/lang/ru.json +++ b/plugins/tags-assets/lang/ru.json @@ -16,6 +16,7 @@ "TagCreateLabel": "Тег", "CancelLabel": "Отмена", "SearchCreate": "Название...", + "QuickAddItems": "Быстрое добавление {word} \"{title}\"", "NoItems": "Отсутствует добавленный {word}", "TagDescriptionLabel": "Описание", "TagDescriptionPlaceholder": "Пожалуйста, введите описание", diff --git a/plugins/tags-resources/src/components/CreateTagElement.svelte b/plugins/tags-resources/src/components/CreateTagElement.svelte index ee0223e059..5faa491f65 100644 --- a/plugins/tags-resources/src/components/CreateTagElement.svelte +++ b/plugins/tags-resources/src/components/CreateTagElement.svelte @@ -13,9 +13,9 @@ // limitations under the License. -->
dispatch('changeContent')}> @@ -114,6 +142,7 @@ {placeholder} {placeholderParam} on:change + on:keydown={onSearchKeydown} /> {#if !isSingleCategory}
@@ -190,6 +219,11 @@ {/if} {/each} {#if objects.length === 0} + {#if !hideAdd} + + {/if}
diff --git a/plugins/tags-resources/src/plugin.ts b/plugins/tags-resources/src/plugin.ts index 27e5127958..dbcfccf147 100644 --- a/plugins/tags-resources/src/plugin.ts +++ b/plugins/tags-resources/src/plugin.ts @@ -29,6 +29,7 @@ export default mergeIds(tagsId, tags, { AddNowTooltip: '' as IntlString, CancelLabel: '' as IntlString, SearchCreate: '' as IntlString, + QuickAddItems: '' as IntlString, NoItems: '' as IntlString, TagDescriptionLabel: '' as IntlString, TagDescriptionPlaceholder: '' as IntlString, diff --git a/plugins/tags-resources/src/utils.ts b/plugins/tags-resources/src/utils.ts index 76d8402285..f5bae1e1dc 100644 --- a/plugins/tags-resources/src/utils.ts +++ b/plugins/tags-resources/src/utils.ts @@ -1,13 +1,22 @@ // Copyright © 2022 Hardcore Engineering Inc. -import { type Doc, type DocumentQuery, type FindResult, type Ref } from '@hcengineering/core' +import { + type Class, + type Data, + type Doc, + type DocumentQuery, + type FindResult, + generateId, + type Ref +} from '@hcengineering/core' import { type Asset } from '@hcengineering/platform' -import { type TagElement, type InitialKnowledge, type TagReference } from '@hcengineering/tags' -import { type ColorDefinition } from '@hcengineering/ui' +import { type TagElement, type InitialKnowledge, type TagReference, type TagCategory } from '@hcengineering/tags' +import { type ColorDefinition, getColorNumberByText } from '@hcengineering/ui' import { type Filter } from '@hcengineering/view' import { FilterQuery } from '@hcengineering/view-resources' import tags from './plugin' import { writable } from 'svelte/store' +import { getClient } from '@hcengineering/presentation' export function getTagStyle (color: ColorDefinition, selected = false): string { return ` @@ -60,3 +69,26 @@ export interface TagElementInfo { * @public */ export const selectedTagElements = writable>>([]) + +/** + * @public + */ +export async function createTagElement ( + title: string, + targetClass: Ref>, + category?: Ref | null, + description?: string | null, + color?: number | null +): Promise { + const tagElement: Data = { + title, + description: description ?? '', + targetClass, + color: color ?? getColorNumberByText(title), + category: category ?? tags.category.NoCategory + } + + const client = getClient() + const tagElementId = generateId() + return await client.createDoc(tags.class.TagElement, tags.space.Tags, tagElement, tagElementId) +} diff --git a/tests/sanity/tests/model/recruiting/talent-details-page.ts b/tests/sanity/tests/model/recruiting/talent-details-page.ts index 95e6ead8a3..c814fce541 100644 --- a/tests/sanity/tests/model/recruiting/talent-details-page.ts +++ b/tests/sanity/tests/model/recruiting/talent-details-page.ts @@ -39,7 +39,6 @@ export class TalentDetailsPage extends CommonRecruitingPage { await this.addNewTagPopup(this.page, skillTag, skillDescription) await this.pressShowAllButtonSelectPopup(this.page) - await this.checkFromDropdown(this.page, skillTag) await this.page.keyboard.press('Escape') } diff --git a/tests/sanity/tests/model/tracker/issues-details-page.ts b/tests/sanity/tests/model/tracker/issues-details-page.ts index f0a461fb4e..694a2690cd 100644 --- a/tests/sanity/tests/model/tracker/issues-details-page.ts +++ b/tests/sanity/tests/model/tracker/issues-details-page.ts @@ -72,9 +72,10 @@ export class IssuesDetailsPage extends CommonTrackerPage { await this.buttonAddLabel.click() await this.pressCreateButtonSelectPopup(this.page) await this.addNewTagPopup(this.page, data.labels, 'Tag from editIssue') + } else { + await this.checkFromDropdownWithSearch(this.page, data.labels) } - await this.checkFromDropdownWithSearch(this.page, data.labels) - await this.inputTitle.click({ force: true }) + await this.inputTitle.press('Escape') } if (data.component != null) { await this.buttonComponent.click() diff --git a/tests/sanity/tests/model/tracker/issues-page.ts b/tests/sanity/tests/model/tracker/issues-page.ts index f952eeb628..3b671e12b9 100644 --- a/tests/sanity/tests/model/tracker/issues-page.ts +++ b/tests/sanity/tests/model/tracker/issues-page.ts @@ -110,8 +110,10 @@ export class IssuesPage extends CommonTrackerPage { if (data.createLabel) { await this.pressCreateButtonSelectPopup(this.page) await this.addNewTagPopup(this.page, data.labels, 'Tag from createNewIssue') + } else { + await this.checkFromDropdown(this.page, data.labels) } - await this.checkFromDropdown(this.page, data.labels) + await this.inputPopupCreateNewIssueTitle.press('Escape') await this.inputPopupCreateNewIssueTitle.click({ force: true }) } if (data.component != null) {