From 1362b556d947d869a59deb3edc640e2e949c152f Mon Sep 17 00:00:00 2001 From: Sergei Ogorelkov Date: Fri, 5 May 2023 15:12:15 +0400 Subject: [PATCH] [TSK-1338] Update issue filters order (#3141) Signed-off-by: Sergei Ogorelkov --- models/contact/src/index.ts | 2 +- models/contact/src/plugin.ts | 2 +- models/core/src/core.ts | 2 +- models/recruit/src/index.ts | 6 +++--- models/tracker/src/index.ts | 19 +++++++++++++++++-- models/tracker/src/plugin.ts | 2 +- models/view/src/index.ts | 2 ++ packages/core/src/component.ts | 1 + packages/core/src/lang/en.json | 1 + packages/core/src/lang/ru.json | 1 + plugins/contact-assets/lang/en.json | 2 +- plugins/contact-assets/lang/ru.json | 2 +- .../src/components/Organizations.svelte | 2 +- .../src/components/Vacancies.svelte | 2 +- plugins/tracker-assets/lang/en.json | 2 +- plugins/tracker-assets/lang/ru.json | 2 +- .../components/filter/FilterTypePopup.svelte | 8 +++++++- plugins/view/src/index.ts | 3 +++ tests/sanity/tests/tracker.spec.ts | 2 +- 19 files changed, 46 insertions(+), 17 deletions(-) diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index b1be3cd44c..f65b0196b0 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -104,7 +104,7 @@ export class TContact extends TDoc implements Contact { @Index(IndexKind.FullText) city!: string - @Prop(TypeTimestamp(), contact.string.CreatedOn) + @Prop(TypeTimestamp(), contact.string.CreatedDate) @ReadOnly() createOn!: Timestamp } diff --git a/models/contact/src/plugin.ts b/models/contact/src/plugin.ts index 9c85c98fd4..e47f666637 100644 --- a/models/contact/src/plugin.ts +++ b/models/contact/src/plugin.ts @@ -77,7 +77,7 @@ export default mergeIds(contactId, contact, { TypeLabel: '' as IntlString, Homepage: '' as IntlString, Birthday: '' as IntlString, - CreatedOn: '' as IntlString, + CreatedDate: '' as IntlString, Whatsapp: '' as IntlString, WhatsappPlaceholder: '' as IntlString, Skype: '' as IntlString, diff --git a/models/core/src/core.ts b/models/core/src/core.ts index b8ddcd5f65..31523ed686 100644 --- a/models/core/src/core.ts +++ b/models/core/src/core.ts @@ -90,7 +90,7 @@ export class TDoc extends TObj implements Doc { @Hidden() space!: Ref - @Prop(TypeTimestamp(), core.string.Modified) + @Prop(TypeTimestamp(), core.string.ModifiedDate) @Index(IndexKind.Indexed) modifiedOn!: Timestamp diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 2afd3710d5..dec45e10a5 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -168,7 +168,7 @@ export class TApplicant extends TTask implements Applicant { @Prop(TypeRef(contact.class.Employee), recruit.string.AssignedRecruiter) declare assignee: Ref | null - @Prop(TypeTimestamp(), contact.string.CreatedOn) + @Prop(TypeTimestamp(), contact.string.CreatedDate) @ReadOnly() createOn!: Timestamp } @@ -454,7 +454,7 @@ export function createModel (builder: Builder): void { 'description', { key: '@applications.modifiedOn', - label: core.string.Modified + label: core.string.ModifiedDate } ], hiddenKeys: ['name', 'space', 'modifiedOn'] @@ -484,7 +484,7 @@ export function createModel (builder: Builder): void { '$lookup.channels', { key: '@applications.modifiedOn', - label: core.string.Modified + label: core.string.ModifiedDate } ], hiddenKeys: ['name', 'space', 'modifiedOn'] diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index f4acfc3b18..b56e59998d 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -256,7 +256,7 @@ export class TIssue extends TAttachedDoc implements Issue { @Prop(Collection(tracker.class.TimeSpendReport), tracker.string.TimeSpendReports) reports!: number - @Prop(TypeTimestamp(), tracker.string.CreatedOn) + @Prop(TypeTimestamp(), tracker.string.CreatedDate) @ReadOnly() createOn!: Timestamp @@ -1352,7 +1352,22 @@ export function createModel (builder: Builder): void { }) builder.mixin(tracker.class.Issue, core.class.Class, view.mixin.ClassFilters, { - filters: ['space'] + filters: [ + 'status', + 'assignee', + 'createdBy', + 'priority', + 'labels', + 'title', + 'sprint', + 'component', + 'dueDate', + 'createOn', + 'modifiedOn', + 'modifiedBy', + 'space' + ], + ignoreKeys: ['number', 'estimation', 'attachedTo'] }) builder.mixin(tracker.class.IssueTemplate, core.class.Class, view.mixin.ClassFilters, { diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index c26c9a5b0f..e99a8c5713 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -38,7 +38,7 @@ export default mergeIds(trackerId, tracker, { GotoMyIssues: '' as IntlString, SearchIssue: '' as IntlString, Parent: '' as IntlString, - CreatedOn: '' as IntlString, + CreatedDate: '' as IntlString, ChangeStatus: '' as IntlString, ConfigLabel: '' as IntlString, ConfigDescription: '' as IntlString diff --git a/models/view/src/index.ts b/models/view/src/index.ts index a1d8f8dd73..f2beedf910 100644 --- a/models/view/src/index.ts +++ b/models/view/src/index.ts @@ -127,6 +127,8 @@ export class TFilterMode extends TDoc implements FilterMode { @Mixin(view.mixin.ClassFilters, core.class.Class) export class TClassFilters extends TClass implements ClassFilters { filters!: (string | KeyFilter)[] + ignoreKeys?: string[] | undefined + strict?: boolean | undefined } @Mixin(view.mixin.AttributeFilter, core.class.Class) diff --git a/packages/core/src/component.ts b/packages/core/src/component.ts index 9f70fc5474..d12cb22065 100644 --- a/packages/core/src/component.ts +++ b/packages/core/src/component.ts @@ -148,6 +148,7 @@ export default plugin(coreId, { Id: '' as IntlString, Space: '' as IntlString, Modified: '' as IntlString, + ModifiedDate: '' as IntlString, ModifiedBy: '' as IntlString, Class: '' as IntlString, AttachedTo: '' as IntlString, diff --git a/packages/core/src/lang/en.json b/packages/core/src/lang/en.json index 411fed29cb..01d590eab7 100644 --- a/packages/core/src/lang/en.json +++ b/packages/core/src/lang/en.json @@ -3,6 +3,7 @@ "Id": "Id", "Space": "Space", "Modified": "Modified", + "ModifiedDate": "Modified date", "ModifiedBy": "Modified by", "Class": "Class", "AttachedTo": "Attached to", diff --git a/packages/core/src/lang/ru.json b/packages/core/src/lang/ru.json index a38035b565..20e4025de2 100644 --- a/packages/core/src/lang/ru.json +++ b/packages/core/src/lang/ru.json @@ -3,6 +3,7 @@ "Id": "Id", "Space": "Пространство", "Modified": "Изменено", + "ModifiedDate": "Дата изменения", "ModifiedBy": "Изменен", "Class": "Класс", "AttachedTo": "Прикреплен к", diff --git a/plugins/contact-assets/lang/en.json b/plugins/contact-assets/lang/en.json index b47f2cd5b3..a28247f040 100644 --- a/plugins/contact-assets/lang/en.json +++ b/plugins/contact-assets/lang/en.json @@ -71,7 +71,7 @@ "UseGravatar": "Gravatar", "UseColor": "Color", "NotSpecified": "Not specified", - "CreatedOn": "Created", + "CreatedDate": "Created date", "Whatsapp": "Whatsapp", "WhatsappPlaceholder": "Whatsapp", "Skype": "Skype", diff --git a/plugins/contact-assets/lang/ru.json b/plugins/contact-assets/lang/ru.json index b708002f5c..f9426b9809 100644 --- a/plugins/contact-assets/lang/ru.json +++ b/plugins/contact-assets/lang/ru.json @@ -72,7 +72,7 @@ "UseColor": "Цвет", "AvatarProvider": "Тип аватара", "NotSpecified": "Не указан", - "CreatedOn": "Создан", + "CreatedDate": "Дата создания", "Whatsapp": "Whatsapp", "WhatsappPlaceholder": "Whatsapp", "Skype": "Skype", diff --git a/plugins/recruit-resources/src/components/Organizations.svelte b/plugins/recruit-resources/src/components/Organizations.svelte index b9eb9f24dd..5cbfc638c6 100644 --- a/plugins/recruit-resources/src/components/Organizations.svelte +++ b/plugins/recruit-resources/src/components/Organizations.svelte @@ -169,7 +169,7 @@ { key: '', presenter: recruit.component.VacancyModifiedPresenter, - label: core.string.Modified, + label: core.string.ModifiedDate, props: { applications }, sortingKey: 'modifiedOn', sortingFunction: modifiedSorting diff --git a/plugins/recruit-resources/src/components/Vacancies.svelte b/plugins/recruit-resources/src/components/Vacancies.svelte index 7102c7c66d..dc08f83f9d 100644 --- a/plugins/recruit-resources/src/components/Vacancies.svelte +++ b/plugins/recruit-resources/src/components/Vacancies.svelte @@ -91,7 +91,7 @@ { key: '', presenter: recruit.component.VacancyModifiedPresenter, - label: core.string.Modified, + label: core.string.ModifiedDate, props: { applications }, sortingKey: 'modifiedOn', sortingFunction: modifiedSorting diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json index 57072756b3..49b5e359bc 100644 --- a/plugins/tracker-assets/lang/en.json +++ b/plugins/tracker-assets/lang/en.json @@ -284,7 +284,7 @@ "SevenHoursLength": "Seven Hours", "EightHoursLength": "Eight Hours", - "CreatedOn": "Created on", + "CreatedDate": "Created date", "HourLabel": "h", "Saved": "Saved...", "CreatedIssue": "Created issue", diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index bcaf281261..3679a3e5c0 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -284,7 +284,7 @@ "SevenHoursLength": "Семь Часов", "EightHoursLength": "Восемь Часов", - "CreatedOn": "Создана", + "CreatedDate": "Дата создания", "HourLabel": "ч", "Saved": "Сохранено...", "CreatedIssue": "Создал(а) задачу", diff --git a/plugins/view-resources/src/components/filter/FilterTypePopup.svelte b/plugins/view-resources/src/components/filter/FilterTypePopup.svelte index c4436abfa2..245a5f9b11 100644 --- a/plugins/view-resources/src/components/filter/FilterTypePopup.svelte +++ b/plugins/view-resources/src/components/filter/FilterTypePopup.svelte @@ -69,7 +69,7 @@ return } const value = getValue(attribute.name, attribute.type) - if (result.findIndex((p) => p.key === value) !== -1) { + if (result.findIndex((p) => p.attribute.name === value) !== -1) { return } const filter = buildFilterKey(hierarchy, _class, value, attribute) @@ -97,6 +97,12 @@ const clazz = hierarchy.getClass(_class) const mixin = hierarchy.as(clazz, view.mixin.ClassFilters) const result = getFilters(_class, mixin) + + if (mixin.strict) { + // Attributes not specified in "mixing.filters" are ignored + return result + } + const allAttributes = hierarchy.getAllAttributes(_class) buildFilterFor(_class, allAttributes, result, mixin) diff --git a/plugins/view/src/index.ts b/plugins/view/src/index.ts index ff1b71cb4f..5a4d7f5bab 100644 --- a/plugins/view/src/index.ts +++ b/plugins/view/src/index.ts @@ -104,6 +104,9 @@ export interface FilteredView extends Preference { export interface ClassFilters extends Class { filters: (KeyFilter | string)[] ignoreKeys?: string[] + + // Ignore attributes not specified in the "filters" array + strict?: boolean } /** diff --git a/tests/sanity/tests/tracker.spec.ts b/tests/sanity/tests/tracker.spec.ts index 50f4ce6444..12b796181a 100644 --- a/tests/sanity/tests/tracker.spec.ts +++ b/tests/sanity/tests/tracker.spec.ts @@ -154,7 +154,7 @@ test('report-time-from-main-view', async ({ page }) => { await page.click('text="Issues"') await page.click('button:has-text("View")') await page.click('.ordering >> nth=0') - await page.click('text="Modified"') + await page.click('text="Modified date"') await page.keyboard.press('Escape') const values = [0.25, 0.5, 0.75, 1]