From dbca41afee3a6b14f4cd83a24afe06f6f2c51865 Mon Sep 17 00:00:00 2001 From: Alex <41288429+Dvinyanin@users.noreply.github.com> Date: Thu, 23 Jun 2022 18:09:18 +0700 Subject: [PATCH] Add MyIssues (#2128) Signed-off-by: Dvinyanin Alexandr --- changelog.md | 3 +- models/tracker/src/index.ts | 8 +- models/tracker/src/plugin.ts | 5 +- packages/kanban/src/components/Kanban.svelte | 8 +- .../src/components/KanbanView.svelte | 7 +- .../src/components/kanban/KanbanView.svelte | 3 +- plugins/tracker-assets/lang/en.json | 3 + plugins/tracker-assets/lang/ru.json | 3 + .../src/components/ModeSelector.svelte | 53 ++++++++++++ .../src/components/issues/Active.svelte | 4 +- .../src/components/issues/Backlog.svelte | 4 +- .../components/issues/IssuesContent.svelte | 60 +------------ .../src/components/issues/IssuesView.svelte | 85 +++++++++---------- .../src/components/issues/KanbanView.svelte | 10 +-- .../src/components/issues/ListView.svelte | 8 +- .../src/components/myissues/MyIssues.svelte | 64 ++++++++++++++ .../components/projects/EditProject.svelte | 2 +- plugins/tracker-resources/src/index.ts | 3 - plugins/tracker-resources/src/plugin.ts | 10 +-- plugins/tracker/src/index.ts | 3 + tests/sanity/tests/tracker.spec.ts | 24 +++++- 21 files changed, 228 insertions(+), 142 deletions(-) create mode 100644 plugins/tracker-resources/src/components/ModeSelector.svelte diff --git a/changelog.md b/changelog.md index d9d78c0a3a..590b4b68a4 100644 --- a/changelog.md +++ b/changelog.md @@ -5,7 +5,8 @@ Tracker: - Remember view options -- +- My issues + Chunter: - Reactions on messages diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 6150717ea2..b69f269e1e 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -280,8 +280,12 @@ export function createModel (builder: Builder): void { descriptor: tracker.viewlet.List, config: [ { key: '', presenter: tracker.component.PriorityEditor, props: { kind: 'list', size: 'small' } }, - '@currentTeam', - '@statuses', + { key: '', presenter: tracker.component.IssuePresenter }, + { + key: '', + presenter: tracker.component.StatusEditor, + props: { kind: 'list', size: 'small', justify: 'center' } + }, { key: '', presenter: tracker.component.TitlePresenter, props: { shouldUseMargin: true, fixed: 'left' } }, { key: '', presenter: tracker.component.DueDatePresenter, props: { kind: 'list' } }, { diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index 6b9aa2b618..c91fc33763 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -17,7 +17,7 @@ import { Ref } from '@anticrm/core' import { ObjectSearchCategory, ObjectSearchFactory } from '@anticrm/model-presentation' import { IntlString, mergeIds, Resource } from '@anticrm/platform' -import { Team, trackerId } from '@anticrm/tracker' +import { trackerId } from '@anticrm/tracker' import tracker from '@anticrm/tracker-resources/src/plugin' import type { AnyComponent } from '@anticrm/ui' import { ViewletDescriptor } from '@anticrm/view' @@ -35,9 +35,6 @@ export default mergeIds(trackerId, tracker, { GotoTrackerApplication: '' as IntlString, SearchIssue: '' as IntlString }, - team: { - DefaultTeam: '' as Ref - }, component: { // Required to pass build without errorsF Nope: '' as AnyComponent diff --git a/packages/kanban/src/components/Kanban.svelte b/packages/kanban/src/components/Kanban.svelte index 07d6a2955f..9ead4b9c7a 100644 --- a/packages/kanban/src/components/Kanban.svelte +++ b/packages/kanban/src/components/Kanban.svelte @@ -13,7 +13,7 @@ // limitations under the License. --> + +
+
+ {#each config as [_mode, label], i} +
+
+ {/each} +
+
+ + diff --git a/plugins/tracker-resources/src/components/issues/Active.svelte b/plugins/tracker-resources/src/components/issues/Active.svelte index 55a2830fb2..f05fd82967 100644 --- a/plugins/tracker-resources/src/components/issues/Active.svelte +++ b/plugins/tracker-resources/src/components/issues/Active.svelte @@ -27,9 +27,9 @@ tracker.class.IssueStatus, { category: { $in: [tracker.issueStatusCategory.Unstarted, tracker.issueStatusCategory.Started] } }, (result) => { - query = { status: { $in: result.map(({ _id }) => _id) } } + query = { status: { $in: result.map(({ _id }) => _id) }, space: currentSpace } } ) - + diff --git a/plugins/tracker-resources/src/components/issues/Backlog.svelte b/plugins/tracker-resources/src/components/issues/Backlog.svelte index e67f50238a..bf36d4e5b4 100644 --- a/plugins/tracker-resources/src/components/issues/Backlog.svelte +++ b/plugins/tracker-resources/src/components/issues/Backlog.svelte @@ -24,8 +24,8 @@ const statusQuery = createQuery() let query: DocumentQuery = {} $: statusQuery.query(tracker.class.IssueStatus, { category: tracker.issueStatusCategory.Backlog }, (result) => { - query = { status: { $in: result.map(({ _id }) => _id) } } + query = { status: { $in: result.map(({ _id }) => _id) }, space: currentSpace } }) - + diff --git a/plugins/tracker-resources/src/components/issues/IssuesContent.svelte b/plugins/tracker-resources/src/components/issues/IssuesContent.svelte index eb6b8eca44..1e5dfcae8d 100644 --- a/plugins/tracker-resources/src/components/issues/IssuesContent.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuesContent.svelte @@ -1,71 +1,19 @@ {#if viewlet?.$lookup?.descriptor?.component} - import core, { DocumentQuery, Ref, Space, WithLookup } from '@anticrm/core' + import { DocumentQuery, WithLookup } from '@anticrm/core' import { IntlString, translate } from '@anticrm/platform' import { getClient } from '@anticrm/presentation' - import { Issue, Team } from '@anticrm/tracker' + import { Issue } from '@anticrm/tracker' import { Button, IconDetails } from '@anticrm/ui' import view, { Viewlet } from '@anticrm/view' import { FilterBar } from '@anticrm/view-resources' @@ -11,7 +11,6 @@ import IssuesContent from './IssuesContent.svelte' import IssuesHeader from './IssuesHeader.svelte' - export let currentSpace: Ref | undefined export let query: DocumentQuery = {} export let title: IntlString | undefined = undefined export let label: string = '' @@ -32,23 +31,20 @@ let viewlets: WithLookup[] = [] - $: update(currentSpace) + $: update() - async function update (currentSpace?: Ref): Promise { - const space = await client.findOne(core.class.Space, { _id: currentSpace }) - if (space) { - viewlets = await client.findAll( - view.class.Viewlet, - { attachTo: tracker.class.Issue }, - { - lookup: { - descriptor: view.class.ViewletDescriptor - } + async function update (): Promise { + viewlets = await client.findAll( + view.class.Viewlet, + { attachTo: tracker.class.Issue }, + { + lookup: { + descriptor: view.class.ViewletDescriptor } - ) - const _id = getActiveViewletId() - viewlet = viewlets.find((viewlet) => viewlet._id === _id) || viewlets[0] - } + } + ) + const _id = getActiveViewletId() + viewlet = viewlets.find((viewlet) => viewlet._id === _id) || viewlets[0] } $: if (!label && title) { translate(title, {}).then((res) => { @@ -69,31 +65,30 @@ $: if (docWidth > 900 && docSize) docSize = false -{#if currentSpace} - - - {#if asideFloat && $$slots.aside} -