From cdbead6584c0ff5e244bce33e2be5fdd9f396ca5 Mon Sep 17 00:00:00 2001 From: Timur Mukhamedishin <84380737+muhtimur@users.noreply.github.com> Date: Wed, 9 Nov 2022 18:24:02 +0700 Subject: [PATCH] Vacancy templates (#2351) Signed-off-by: muhtimur --- models/recruit/src/index.ts | 3 +- models/recruit/src/migration.ts | 2 + models/recruit/src/plugin.ts | 3 +- models/setting/src/index.ts | 8 +- models/task/src/index.ts | 15 ++- models/task/src/migration.ts | 4 + models/task/src/plugin.ts | 1 + models/tracker/src/index.ts | 3 + packages/theme/styles/_layouts.scss | 1 + plugins/recruit-assets/assets/icons.svg | 4 + plugins/recruit-assets/lang/en.json | 2 +- plugins/recruit-assets/lang/ru.json | 2 +- plugins/recruit-assets/src/index.ts | 3 +- .../src/components/CreateVacancy.svelte | 89 +++++++++++++---- .../components/VacancyTemplateEditor.svelte | 95 +++++++++++++++++++ plugins/recruit-resources/src/index.ts | 4 +- plugins/recruit/src/index.ts | 3 +- plugins/setting-assets/lang/en.json | 2 +- plugins/setting-assets/lang/ru.json | 2 +- ...Statuses.svelte => ManageTemplates.svelte} | 10 +- plugins/setting-resources/src/index.ts | 4 +- plugins/setting/src/index.ts | 6 +- plugins/task-assets/assets/icons.svg | 2 +- plugins/task-assets/lang/en.json | 8 +- plugins/task-assets/lang/ru.json | 8 +- plugins/task-assets/src/index.ts | 2 +- .../src/components/CreateFilterPopup.svelte | 2 +- .../src/components/EditIssue.svelte | 2 +- .../components/KanbanTemplatePresenter.svelte | 29 ++++++ .../kanban/KanbanTemplateEditor.svelte | 12 ++- .../kanban/KanbanTemplateSelector.svelte | 2 +- .../src/components/state/EditStatuses.svelte | 2 +- .../src/components/state/StatesEditor.svelte | 10 +- plugins/task-resources/src/index.ts | 2 + plugins/task-resources/src/plugin.ts | 6 +- plugins/task/src/index.ts | 5 +- plugins/templates-assets/lang/en.json | 4 +- plugins/templates-assets/lang/ru.json | 4 +- .../related/RelatedIssueTemplates.svelte | 59 ++++++++++++ .../templates/CreateIssueTemplate.svelte | 9 +- plugins/tracker-resources/src/index.ts | 4 + plugins/tracker/src/index.ts | 6 +- tests/sanity/tests/settings.spec.ts | 6 +- 43 files changed, 378 insertions(+), 72 deletions(-) create mode 100644 plugins/recruit-resources/src/components/VacancyTemplateEditor.svelte rename plugins/setting-resources/src/components/statuses/{ManageStatuses.svelte => ManageTemplates.svelte} (89%) create mode 100644 plugins/task-resources/src/components/KanbanTemplatePresenter.svelte create mode 100644 plugins/tracker-resources/src/components/issues/related/RelatedIssueTemplates.svelte diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 63127090eb..d9e8f1ed85 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -531,7 +531,8 @@ export function createModel (builder: Builder): void { { name: recruit.string.Vacancies, description: recruit.string.ManageVacancyStatuses, - icon: recruit.component.TemplatesIcon + icon: recruit.component.TemplatesIcon, + editor: recruit.component.VacancyTemplateEditor }, recruit.space.VacancyTemplates ) diff --git a/models/recruit/src/migration.ts b/models/recruit/src/migration.ts index 15275e8717..f71f71f191 100644 --- a/models/recruit/src/migration.ts +++ b/models/recruit/src/migration.ts @@ -142,6 +142,8 @@ async function createDefaultKanbanTemplate (tx: TxOperations): Promise as Ref, title: 'Default vacancy', + description: '', + shortDescription: '', states: defaultKanban.states, doneStates: defaultKanban.doneStates }) diff --git a/models/recruit/src/plugin.ts b/models/recruit/src/plugin.ts index f06ed4bc6b..4b8fceba3e 100644 --- a/models/recruit/src/plugin.ts +++ b/models/recruit/src/plugin.ts @@ -87,7 +87,8 @@ export default mergeIds(recruitId, recruit, { OpinionPresenter: '' as AnyComponent, NewCandidateHeader: '' as AnyComponent, ApplicantFilter: '' as AnyComponent, - VacancyList: '' as AnyComponent + VacancyList: '' as AnyComponent, + VacancyTemplateEditor: '' as AnyComponent }, template: { DefaultVacancy: '' as Ref, diff --git a/models/setting/src/index.ts b/models/setting/src/index.ts index 5f46b183ba..c82c26b5b0 100644 --- a/models/setting/src/index.ts +++ b/models/setting/src/index.ts @@ -163,14 +163,14 @@ export function createModel (builder: Builder): void { core.space.Model, { name: 'statuses', - label: setting.string.ManageStatuses, - icon: task.icon.ManageStatuses, - component: setting.component.ManageStatuses, + label: setting.string.ManageTemplates, + icon: task.icon.ManageTemplates, + component: setting.component.ManageTemplates, group: 'settings-editor', secured: false, order: 4000 }, - setting.ids.ManageStatuses + setting.ids.ManageTemplates ) builder.createDoc( setting.class.WorkspaceSettingCategory, diff --git a/models/task/src/index.ts b/models/task/src/index.ts index d9da85f784..e9c51c579e 100644 --- a/models/task/src/index.ts +++ b/models/task/src/index.ts @@ -180,7 +180,7 @@ export class TIssue extends TTask implements Issue { @Index(IndexKind.FullText) name!: string - @Prop(TypeMarkup(), task.string.TaskDescription) + @Prop(TypeMarkup(), task.string.Description) @Index(IndexKind.FullText) description!: string @@ -211,6 +211,7 @@ export class TKanbanTemplateSpace extends TDoc implements KanbanTemplateSpace { name!: IntlString description!: IntlString icon!: AnyComponent + editor!: AnyComponent } @Model(task.class.StateTemplate, core.class.AttachedDoc, DOMAIN_KANBAN, [task.interface.DocWithRank]) @@ -244,6 +245,12 @@ export class TKanbanTemplate extends TDoc implements KanbanTemplate { @Index(IndexKind.FullText) title!: string + @Prop(TypeString(), task.string.Description) + description!: string + + @Prop(TypeString(), task.string.ShortDescription) + shortDescription!: string + @Prop(Collection(task.class.StateTemplate), task.string.States) statesC!: number @@ -347,7 +354,7 @@ export function createModel (builder: Builder): void { core.space.Model, { label: task.string.States, - icon: task.icon.ManageStatuses, + icon: task.icon.ManageTemplates, component: task.component.StatusTableView }, task.viewlet.StatusTable @@ -381,6 +388,10 @@ export function createModel (builder: Builder): void { presenter: task.component.TaskPresenter }) + builder.mixin(task.class.KanbanTemplate, core.class.Class, view.mixin.AttributePresenter, { + presenter: task.component.KanbanTemplatePresenter + }) + builder.mixin(task.class.Issue, core.class.Class, view.mixin.ObjectEditor, { editor: task.component.EditIssue }) diff --git a/models/task/src/migration.ts b/models/task/src/migration.ts index 594220ec61..d458a6ff16 100644 --- a/models/task/src/migration.ts +++ b/models/task/src/migration.ts @@ -28,6 +28,8 @@ export interface KanbanTemplateData { kanbanId: Ref space: Ref title: KanbanTemplate['title'] + description?: string + shortDescription?: string states: Pick[] doneStates: (Pick & { isWon: boolean })[] } @@ -157,6 +159,8 @@ async function createDefaultKanbanTemplate (tx: TxOperations): Promise as Ref, title: 'Default project', + description: '', + shortDescription: '', states: defaultKanban.states, doneStates: defaultKanban.doneStates }) diff --git a/models/task/src/plugin.ts b/models/task/src/plugin.ts index d6466480e4..a2c71d1761 100644 --- a/models/task/src/plugin.ts +++ b/models/task/src/plugin.ts @@ -46,6 +46,7 @@ export default mergeIds(taskId, task, { CreateProject: '' as AnyComponent, EditIssue: '' as AnyComponent, TaskPresenter: '' as AnyComponent, + KanbanTemplatePresenter: '' as AnyComponent, KanbanCard: '' as AnyComponent, TemplatesIcon: '' as AnyComponent, StatePresenter: '' as AnyComponent, diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index e1d25fd126..30863df353 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -302,6 +302,9 @@ export class TIssueTemplate extends TDoc implements IssueTemplate { @Prop(Collection(attachment.class.Attachment), tracker.string.Attachments) attachments!: number + + @Prop(ArrOf(TypeRef(core.class.TypeRelatedDocument)), tracker.string.RelatedTo) + relations!: RelatedDocument[] } /** diff --git a/packages/theme/styles/_layouts.scss b/packages/theme/styles/_layouts.scss index d93e7053e9..ef5b07f057 100644 --- a/packages/theme/styles/_layouts.scss +++ b/packages/theme/styles/_layouts.scss @@ -397,6 +397,7 @@ input.search { .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; } +.mb-9 { margin-bottom: 2.25rem; } .mb-10 { margin-bottom: 2.5rem; } .mx-1 { margin: 0 .25rem; } .mx-2 { margin: 0 .5rem; } diff --git a/plugins/recruit-assets/assets/icons.svg b/plugins/recruit-assets/assets/icons.svg index a1f123b8c3..965e132397 100644 --- a/plugins/recruit-assets/assets/icons.svg +++ b/plugins/recruit-assets/assets/icons.svg @@ -53,4 +53,8 @@ + + + + diff --git a/plugins/recruit-assets/lang/en.json b/plugins/recruit-assets/lang/en.json index b1cfb15ae1..a2d3ec558b 100644 --- a/plugins/recruit-assets/lang/en.json +++ b/plugins/recruit-assets/lang/en.json @@ -54,7 +54,7 @@ "PersonFirstNamePlaceholder": "John", "PersonLastNamePlaceholder": "Appleseed", "PersonLocationPlaceholder": "Location", - "ManageVacancyStatuses": "Manage vacancy statuses", + "ManageVacancyStatuses": "Manage vacancy templates", "EditVacancy": "Edit", "FullDescription": "Full description", "CreateReview": "Schedule an Review", diff --git a/plugins/recruit-assets/lang/ru.json b/plugins/recruit-assets/lang/ru.json index 98a96e7ec2..ec32948c64 100644 --- a/plugins/recruit-assets/lang/ru.json +++ b/plugins/recruit-assets/lang/ru.json @@ -54,7 +54,7 @@ "PersonFirstNamePlaceholder": "John", "PersonLastNamePlaceholder": "Appleseed", "PersonLocationPlaceholder": "Местоположение", - "ManageVacancyStatuses": "Управление статусами вакансии", + "ManageVacancyStatuses": "Управление шаблонами вакансии", "EditVacancy": "Редактировать", "FullDescription": "Детальное описание", diff --git a/plugins/recruit-assets/src/index.ts b/plugins/recruit-assets/src/index.ts index 956941f321..433c0f7047 100644 --- a/plugins/recruit-assets/src/index.ts +++ b/plugins/recruit-assets/src/index.ts @@ -29,7 +29,8 @@ loadMetadata(recruit.icon, { CreateCandidate: `${icons}#new-candidate`, AssignedToMe: `${icons}#assignedToMe`, Reviews: `${icons}#reviews`, - Skills: `${icons}#skills` + Skills: `${icons}#skills`, + Issue: `${icons}#issue` }) addStringsLoader(recruitId, async (lang: string) => await import(`../lang/${lang}.json`)) diff --git a/plugins/recruit-resources/src/components/CreateVacancy.svelte b/plugins/recruit-resources/src/components/CreateVacancy.svelte index 78824e7386..175ee39e68 100644 --- a/plugins/recruit-resources/src/components/CreateVacancy.svelte +++ b/plugins/recruit-resources/src/components/CreateVacancy.svelte @@ -15,10 +15,11 @@ + +
+
+
+ onShortDescriptionChange(template.shortDescription ?? '')} + /> +
+
+
+
+
+ {#key template._id} + onDescriptionChange(evt.detail)} + /> + {/key} +
+
+
+
+
+ +
+ + +
+
+
+
+ +
+
+{#if customKeys && customKeys.length > 0} +
+ +
+{/if} diff --git a/plugins/recruit-resources/src/index.ts b/plugins/recruit-resources/src/index.ts index 1a618fd2c4..6a9a35f5ce 100644 --- a/plugins/recruit-resources/src/index.ts +++ b/plugins/recruit-resources/src/index.ts @@ -52,6 +52,7 @@ import VacancyPresenter from './components/VacancyPresenter.svelte' import recruit from './plugin' import { objectIdProvider, objectLinkProvider, getApplicationTitle } from './utils' import VacancyList from './components/VacancyList.svelte' +import VacancyTemplateEditor from './components/VacancyTemplateEditor.svelte' async function createOpinion (object: Doc): Promise { showPopup(CreateOpinion, { space: object.space, review: object._id }) @@ -289,7 +290,8 @@ export default async (): Promise => ({ ApplicantFilter, - VacancyList + VacancyList, + VacancyTemplateEditor }, completion: { ApplicationQuery: async ( diff --git a/plugins/recruit/src/index.ts b/plugins/recruit/src/index.ts index 9ee0b322de..d83ee3381a 100644 --- a/plugins/recruit/src/index.ts +++ b/plugins/recruit/src/index.ts @@ -131,7 +131,8 @@ const recruit = plugin(recruitId, { CreateCandidate: '' as Asset, AssignedToMe: '' as Asset, Reviews: '' as Asset, - Skills: '' as Asset + Skills: '' as Asset, + Issue: '' as Asset }, space: { VacancyTemplates: '' as Ref, diff --git a/plugins/setting-assets/lang/en.json b/plugins/setting-assets/lang/en.json index 876cc8c8b9..6470cd01a0 100644 --- a/plugins/setting-assets/lang/en.json +++ b/plugins/setting-assets/lang/en.json @@ -1,7 +1,7 @@ { "string": { "Setting": "Setting", - "ManageStatuses": "Manage Statuses", + "ManageTemplates": "Manage Templates", "Integrations": "Integrations", "Support": "Support", "Privacy": "Privacy", diff --git a/plugins/setting-assets/lang/ru.json b/plugins/setting-assets/lang/ru.json index e624ab1514..793325d417 100644 --- a/plugins/setting-assets/lang/ru.json +++ b/plugins/setting-assets/lang/ru.json @@ -1,7 +1,7 @@ { "string": { "Setting": "Настройки", - "ManageStatuses": "Управление статусами", + "ManageTemplates": "Управление шаблонами", "Integrations": "Интеграции", "Support": "Поддержка", "Privacy": "Конфиденциальность", diff --git a/plugins/setting-resources/src/components/statuses/ManageStatuses.svelte b/plugins/setting-resources/src/components/statuses/ManageTemplates.svelte similarity index 89% rename from plugins/setting-resources/src/components/statuses/ManageStatuses.svelte rename to plugins/setting-resources/src/components/statuses/ManageTemplates.svelte index aed0248da4..e3764cc153 100644 --- a/plugins/setting-resources/src/components/statuses/ManageStatuses.svelte +++ b/plugins/setting-resources/src/components/statuses/ManageTemplates.svelte @@ -61,8 +61,8 @@
-
-
+
+
@@ -75,7 +75,11 @@
{#if template !== undefined} - + {/if}
diff --git a/plugins/setting-resources/src/index.ts b/plugins/setting-resources/src/index.ts index 629ef21f85..dca5b79e7a 100644 --- a/plugins/setting-resources/src/index.ts +++ b/plugins/setting-resources/src/index.ts @@ -30,7 +30,7 @@ import Password from './components/Password.svelte' import Privacy from './components/Privacy.svelte' import Profile from './components/Profile.svelte' import Settings from './components/Settings.svelte' -import ManageStatuses from './components/statuses/ManageStatuses.svelte' +import ManageTemplates from './components/statuses/ManageTemplates.svelte' import Support from './components/Support.svelte' import Terms from './components/Terms.svelte' import BooleanTypeEditor from './components/typeEditors/BooleanTypeEditor.svelte' @@ -79,7 +79,7 @@ export default async (): Promise => ({ Support, Privacy, Terms, - ManageStatuses, + ManageTemplates, ClassSetting, StringTypeEditor, HyperlinkTypeEditor, diff --git a/plugins/setting/src/index.ts b/plugins/setting/src/index.ts index 54c12b2c91..d27b349d42 100644 --- a/plugins/setting/src/index.ts +++ b/plugins/setting/src/index.ts @@ -85,7 +85,7 @@ export default plugin(settingId, { Password: '' as Ref, Setting: '' as Ref, Integrations: '' as Ref, - ManageStatuses: '' as Ref, + ManageTemplates: '' as Ref, Support: '' as Ref, Privacy: '' as Ref, Terms: '' as Ref, @@ -108,7 +108,7 @@ export default plugin(settingId, { Password: '' as AnyComponent, WorkspaceSettings: '' as AnyComponent, Integrations: '' as AnyComponent, - ManageStatuses: '' as AnyComponent, + ManageTemplates: '' as AnyComponent, Support: '' as AnyComponent, Privacy: '' as AnyComponent, Terms: '' as AnyComponent, @@ -119,7 +119,7 @@ export default plugin(settingId, { Setting: '' as IntlString, WorkspaceSetting: '' as IntlString, Integrations: '' as IntlString, - ManageStatuses: '' as IntlString, + ManageTemplates: '' as IntlString, Support: '' as IntlString, Privacy: '' as IntlString, Terms: '' as IntlString, diff --git a/plugins/task-assets/assets/icons.svg b/plugins/task-assets/assets/icons.svg index e74d522661..cc94e97b23 100644 --- a/plugins/task-assets/assets/icons.svg +++ b/plugins/task-assets/assets/icons.svg @@ -20,7 +20,7 @@ - + diff --git a/plugins/task-assets/lang/en.json b/plugins/task-assets/lang/en.json index b3a876bd48..adb05ca4e1 100644 --- a/plugins/task-assets/lang/en.json +++ b/plugins/task-assets/lang/en.json @@ -1,5 +1,8 @@ { "string": { + "Description": "Description", + "DescriptionPlaceholder": "Description", + "ShortDescription": "Short description", "StartDate": "Start date", "DueDate": "Due date", "TaskState": "State", @@ -14,7 +17,6 @@ "Task": "Task", "TaskParent": "Parent", "IssueName": "Name", - "TaskDescription": "Description", "TaskComments": "Comments", "TaskLabels": "Labels", "TaskAssignee": "Assignee", @@ -34,7 +36,6 @@ "CreateProject": "New Project", "ProjectNamePlaceholder": "Project name", "TaskNamePlaceholder": "The boring task", - "TaskDescriptionPlaceholder": "Description", "TodoDescriptionPlaceholder": "todo...", "MakePrivate": "Make Private", "MakePrivateDescription": "Only members can see it", @@ -76,6 +77,7 @@ "Assigned": "Assigned to me", "TodoItems": "Todos", "Dashboard": "Dashboard", - "AllTime": "All time" + "AllTime": "All time", + "RelatedIssues": "Related processes" } } \ No newline at end of file diff --git a/plugins/task-assets/lang/ru.json b/plugins/task-assets/lang/ru.json index d207c866a5..c514e56345 100644 --- a/plugins/task-assets/lang/ru.json +++ b/plugins/task-assets/lang/ru.json @@ -1,5 +1,8 @@ { "string": { + "Description": "Описание", + "DescriptionPlaceholder": "Описание", + "ShortDescription": "Короткое описание", "StartDate": "Начало", "DueDate": "Срок", "TaskState": "Статус", @@ -14,7 +17,6 @@ "Task": "Задача", "TaskParent": "Родитель", "IssueName": "Название", - "TaskDescription": "Описание", "TaskComments": "Комментарии", "TaskLabels": "Ярлыки", "TaskAssignee": "Назначен", @@ -34,7 +36,6 @@ "CreateProject": "Новый проект", "ProjectNamePlaceholder": "Название проекта", "TaskNamePlaceholder": "Задача", - "TaskDescriptionPlaceholder": "Описание", "TodoDescriptionPlaceholder": "todo...", "MakePrivate": "Сделать личным", "MakePrivateDescription": "Только пользователи могут видеть это", @@ -76,6 +77,7 @@ "Assigned": "Назначения", "TodoItems": "Todos", "Dashboard": "Дашборд", - "AllTime": "Все время" + "AllTime": "Все время", + "RelatedIssues": "Связанные процессы" } } \ No newline at end of file diff --git a/plugins/task-assets/src/index.ts b/plugins/task-assets/src/index.ts index df7c9f1303..ac2fe54606 100644 --- a/plugins/task-assets/src/index.ts +++ b/plugins/task-assets/src/index.ts @@ -22,7 +22,7 @@ loadMetadata(task.icon, { Kanban: `${icons}#kanban`, TodoCheck: `${icons}#todo-check`, TodoUnCheck: `${icons}#todo-uncheck`, - ManageStatuses: `${icons}#manage-statuses`, + ManageTemplates: `${icons}#manage-templates`, TaskState: `${icons}#task-state`, Dashboard: `${icons}#dashboard` }) diff --git a/plugins/task-resources/src/components/CreateFilterPopup.svelte b/plugins/task-resources/src/components/CreateFilterPopup.svelte index 7a80e4144f..da38899f89 100644 --- a/plugins/task-resources/src/components/CreateFilterPopup.svelte +++ b/plugins/task-resources/src/components/CreateFilterPopup.svelte @@ -53,7 +53,7 @@ >
- {#each values as value, i} + {#each values as value}