diff --git a/changelog.md b/changelog.md index 0d834e9eb5..b1d4d99a1d 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,7 @@ Platform: - Allow to define table columns order - Fix skills/labels selection and show real usage counter - Fix skills/labels activity +- Project selector in issue list HR: diff --git a/plugins/tracker-resources/src/components/issues/IssuesFilterMenu.svelte b/plugins/tracker-resources/src/components/issues/IssuesFilterMenu.svelte index 636e11239c..3340137f33 100644 --- a/plugins/tracker-resources/src/components/issues/IssuesFilterMenu.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuesFilterMenu.svelte @@ -18,6 +18,7 @@ import { showPopup } from '@anticrm/ui' import StatusFilterMenuSection from './StatusFilterMenuSection.svelte' import PriorityFilterMenuSection from './PriorityFilterMenuSection.svelte' + import ProjectFilterMenuSection from './ProjectFilterMenuSection.svelte' import FilterMenu from '../FilterMenu.svelte' import { defaultPriorities, @@ -40,6 +41,7 @@ $: defaultStatusIds = defaultStatuses.map((x) => x._id) $: groupedByStatus = getGroupedIssues('status', issues, defaultStatusIds) $: groupedByPriority = getGroupedIssues('priority', issues, defaultPriorities) + $: groupedByProject = getGroupedIssues('project', issues) const handleStatusFilterMenuSectionOpened = (event: MouseEvent | KeyboardEvent) => { const statusGroups: { [key: string]: number } = {} @@ -82,6 +84,25 @@ ) } + const handleProjectFilterMenuSectionOpened = (event: MouseEvent | KeyboardEvent) => { + const projectGroups: { [key: string]: number } = {} + + for (const [project, value] of Object.entries(groupedByProject)) { + projectGroups[project] = value?.length ?? 0 + } + showPopup( + ProjectFilterMenuSection, + { + groups: projectGroups, + selectedElements: currentFilterQuery?.project?.[currentFilterMode] ?? [], + index, + onUpdate, + onBack + }, + targetHtml + ) + } + const actions: FilterAction[] = [ { ...getIssueFilterAssetsByType('status'), @@ -90,6 +111,10 @@ { ...getIssueFilterAssetsByType('priority'), onSelect: handlePriorityFilterMenuSectionOpened + }, + { + ...getIssueFilterAssetsByType('project'), + onSelect: handleProjectFilterMenuSectionOpened } ] diff --git a/plugins/tracker-resources/src/components/issues/ProjectFilterMenuSection.svelte b/plugins/tracker-resources/src/components/issues/ProjectFilterMenuSection.svelte new file mode 100644 index 0000000000..cf1036b639 --- /dev/null +++ b/plugins/tracker-resources/src/components/issues/ProjectFilterMenuSection.svelte @@ -0,0 +1,66 @@ + + + +{#await getFilterElements(groups, selectedElements) then actions} + +{/await} diff --git a/plugins/tracker-resources/src/utils.ts b/plugins/tracker-resources/src/utils.ts index 7869cc6d0e..0e749c6523 100644 --- a/plugins/tracker-resources/src/utils.ts +++ b/plugins/tracker-resources/src/utils.ts @@ -53,6 +53,7 @@ export const issuesGroupByOptions: Record = { [IssuesGrouping.Status]: tracker.string.Status, [IssuesGrouping.Assignee]: tracker.string.Assignee, [IssuesGrouping.Priority]: tracker.string.Priority, + [IssuesGrouping.Project]: tracker.string.Project, [IssuesGrouping.NoGrouping]: tracker.string.NoGrouping } @@ -69,13 +70,14 @@ export const issuesDateModificationPeriodOptions: Record +export type IssuesGroupByKeys = keyof Pick export type IssuesOrderByKeys = keyof Pick export const issuesGroupKeyMap: Record = { [IssuesGrouping.Status]: 'status', [IssuesGrouping.Priority]: 'priority', [IssuesGrouping.Assignee]: 'assignee', + [IssuesGrouping.Project]: 'project', [IssuesGrouping.NoGrouping]: undefined } @@ -93,9 +95,10 @@ export const issuesSortOrderMap: Record = { dueDate: SortingOrder.Descending } -export const issuesGroupEditorMap: Record<'status' | 'priority', AnyComponent | undefined> = { +export const issuesGroupEditorMap: Record<'status' | 'priority' | 'project', AnyComponent | undefined> = { status: tracker.component.StatusEditor, - priority: tracker.component.PriorityEditor + priority: tracker.component.PriorityEditor, + project: tracker.component.ProjectEditor } export const getIssuesModificationDatePeriodTime = (period: IssuesDateModificationPeriod | null): number => { @@ -206,6 +209,12 @@ export const getIssueFilterAssetsByType = (type: string): { icon: Asset, label: label: tracker.string.Priority } } + case 'project': { + return { + icon: tracker.icon.Project, + label: tracker.string.Project + } + } default: { return undefined } diff --git a/plugins/tracker/src/index.ts b/plugins/tracker/src/index.ts index efae016f48..3da950976d 100644 --- a/plugins/tracker/src/index.ts +++ b/plugins/tracker/src/index.ts @@ -71,6 +71,7 @@ export enum IssuesGrouping { Status = 'status', Assignee = 'assignee', Priority = 'priority', + Project = 'project', NoGrouping = 'noGrouping' }