From 546eac5deed78e978c988c46f74006bc3efb2e04 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Fri, 10 Jun 2022 22:48:14 +0700 Subject: [PATCH] Fix TSK-96 (#2052) --- models/task/src/index.ts | 16 +-- models/task/src/plugin.ts | 6 - models/tracker/src/index.ts | 13 ++ models/tracker/src/plugin.ts | 10 +- packages/presentation/src/utils.ts | 6 + .../src/components/MentionList.svelte | 4 +- .../src/components/EditMember.svelte | 4 + .../src/components/ApplicationItem.svelte | 2 +- .../src/components/statuses/Templates.svelte | 2 + .../src/components/CategoryBar.svelte | 2 + plugins/task-assets/lang/en.json | 3 +- plugins/task-assets/lang/ru.json | 1 - .../components/kanban/KanbanDragDone.svelte | 2 + .../components/state/DoneStateEditor.svelte | 2 + plugins/task-resources/src/index.ts | 52 +------- plugins/task/src/index.ts | 1 - plugins/tracker-assets/lang/en.json | 3 +- plugins/tracker-assets/lang/ru.json | 3 +- .../src/components/issues/IssueItem.svelte | 38 ++++++ .../components/issues/IssuePresenter.svelte | 2 + .../issues/edit/SubIssueSelector.svelte | 5 +- .../src/components/projects/Projects.svelte | 8 +- plugins/tracker-resources/src/index.ts | 113 +++++++++++++----- .../src/components/EditDoc.svelte | 6 +- .../src/components/ObjectPresenter.svelte | 1 + .../src/components/ViewletSetting.svelte | 5 +- products/tracker/package.json | 16 +-- 27 files changed, 206 insertions(+), 120 deletions(-) create mode 100644 plugins/tracker-resources/src/components/issues/IssueItem.svelte diff --git a/models/task/src/index.ts b/models/task/src/index.ts index 01b18801b6..6367646903 100644 --- a/models/task/src/index.ts +++ b/models/task/src/index.ts @@ -35,10 +35,9 @@ import { import attachment from '@anticrm/model-attachment' import chunter from '@anticrm/model-chunter' import core, { TAttachedDoc, TClass, TDoc, TSpace } from '@anticrm/model-core' -import presentation from '@anticrm/model-presentation' import view, { actionTemplates as viewTemplates, createAction, template } from '@anticrm/model-view' import { IntlString } from '@anticrm/platform' -import { ViewAction } from '@anticrm/view' +import tags from '@anticrm/tags' import { DOMAIN_STATE, DoneState, @@ -60,7 +59,7 @@ import { WonStateTemplate } from '@anticrm/task' import { AnyComponent } from '@anticrm/ui' -import tags from '@anticrm/tags' +import { ViewAction } from '@anticrm/view' import task from './plugin' export { createKanbanTemplate, createSequence, taskOperation } from './migration' @@ -501,17 +500,6 @@ export function createModel (builder: Builder): void { target: task.class.TodoItem }) - builder.createDoc( - presentation.class.ObjectSearchCategory, - core.space.Model, - { - icon: task.icon.Task, - label: task.string.SearchTask, - query: task.completion.IssueQuery - }, - task.completion.IssueCategory - ) - createAction( builder, { diff --git a/models/task/src/plugin.ts b/models/task/src/plugin.ts index 4348af0b20..4b748f07d5 100644 --- a/models/task/src/plugin.ts +++ b/models/task/src/plugin.ts @@ -15,8 +15,6 @@ // import type { Ref, Space } from '@anticrm/core' -import { ObjectSearchCategory, ObjectSearchFactory } from '@anticrm/model-presentation' -import type { Resource } from '@anticrm/platform' import { mergeIds } from '@anticrm/platform' import { TagCategory } from '@anticrm/tags' import { KanbanTemplate, taskId } from '@anticrm/task' @@ -66,10 +64,6 @@ export default mergeIds(taskId, task, { template: { DefaultProject: '' as Ref }, - completion: { - IssueQuery: '' as Resource, - IssueCategory: '' as Ref - }, viewlet: { TableIssue: '' as Ref } diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index ac0dc121c9..9fd898cba5 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -51,6 +51,8 @@ import { } from '@anticrm/tracker' import tracker from './plugin' +import presentation from '@anticrm/model-presentation' + export { trackerOperation } from './migration' export { default } from './plugin' @@ -568,4 +570,15 @@ export function createModel (builder: Builder): void { builder.mixin(tracker.class.Issue, core.class.Class, view.mixin.ClassFilters, { filters: ['status', 'priority', 'project'] }) + + builder.createDoc( + presentation.class.ObjectSearchCategory, + core.space.Model, + { + icon: tracker.icon.TrackerApplication, + label: tracker.string.SearchIssue, + query: tracker.completion.IssueQuery + }, + tracker.completion.IssueCategory + ) } diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index eb4447a882..f2555df9da 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -15,7 +15,8 @@ // import { Ref } from '@anticrm/core' -import { IntlString, mergeIds } from '@anticrm/platform' +import { ObjectSearchCategory, ObjectSearchFactory } from '@anticrm/model-presentation' +import { IntlString, mergeIds, Resource } from '@anticrm/platform' import { Team, trackerId } from '@anticrm/tracker' import tracker from '@anticrm/tracker-resources/src/plugin' import type { AnyComponent } from '@anticrm/ui' @@ -31,7 +32,8 @@ export default mergeIds(trackerId, tracker, { GotoBacklog: '' as IntlString, GotoBoard: '' as IntlString, GotoProjects: '' as IntlString, - GotoTrackerApplication: '' as IntlString + GotoTrackerApplication: '' as IntlString, + SearchIssue: '' as IntlString }, team: { DefaultTeam: '' as Ref @@ -45,5 +47,9 @@ export default mergeIds(trackerId, tracker, { }, viewlet: { List: '' as Ref + }, + completion: { + IssueQuery: '' as Resource, + IssueCategory: '' as Ref } }) diff --git a/packages/presentation/src/utils.ts b/packages/presentation/src/utils.ts index c8cb667463..e81c5483e2 100644 --- a/packages/presentation/src/utils.ts +++ b/packages/presentation/src/utils.ts @@ -93,7 +93,9 @@ export class LiveQuery { callback: (result: FindResult) => void, options?: FindOptions ): boolean { + console.log(_class, query, callback, options) if (!this.needUpdate(_class, query, callback, options)) { + console.log('matched') return false } this.oldCallback = callback @@ -104,6 +106,10 @@ export class LiveQuery { const unsub = liveQuery.query(_class, query, callback, options) this.unsubscribe = () => { unsub() + this.oldCallback = undefined + this.oldClass = undefined + this.oldOptions = undefined + this.oldQuery = undefined this.unsubscribe = () => {} } return true diff --git a/packages/text-editor/src/components/MentionList.svelte b/packages/text-editor/src/components/MentionList.svelte index 8211eb884f..ef400cade9 100644 --- a/packages/text-editor/src/components/MentionList.svelte +++ b/packages/text-editor/src/components/MentionList.svelte @@ -170,7 +170,9 @@ selected = i }} > - +
+ +
{/each} {#if !items.length} diff --git a/plugins/contact-resources/src/components/EditMember.svelte b/plugins/contact-resources/src/components/EditMember.svelte index acceb607d5..fcd4bbcc90 100644 --- a/plugins/contact-resources/src/components/EditMember.svelte +++ b/plugins/contact-resources/src/components/EditMember.svelte @@ -29,6 +29,8 @@ personQuery.query(contact.class.Contact, { _id: object.contact }, (result) => { refContact = result[0] }) + } else { + personQuery.unsubscribe() } let organization: Organization @@ -37,6 +39,8 @@ orgQuery.query(contact.class.Organization, { _id: object.attachedTo as Ref }, (result) => { organization = result[0] }) + } else { + orgQuery.unsubscribe() } const dispatch = createEventDispatcher() diff --git a/plugins/recruit-resources/src/components/ApplicationItem.svelte b/plugins/recruit-resources/src/components/ApplicationItem.svelte index 5e4b00b778..05859fbeea 100644 --- a/plugins/recruit-resources/src/components/ApplicationItem.svelte +++ b/plugins/recruit-resources/src/components/ApplicationItem.svelte @@ -34,7 +34,7 @@
- +
{#if shortLabel}
diff --git a/plugins/setting-resources/src/components/statuses/Templates.svelte b/plugins/setting-resources/src/components/statuses/Templates.svelte index c542045952..6e4d26d360 100644 --- a/plugins/setting-resources/src/components/statuses/Templates.svelte +++ b/plugins/setting-resources/src/components/statuses/Templates.svelte @@ -31,6 +31,8 @@ templatesQ.query(task.class.KanbanTemplate, { space: folder._id as Ref as Ref }, (result) => { templates = result }) + } else { + templatesQ.unsubscribe() } let selectedId: Ref | undefined diff --git a/plugins/tags-resources/src/components/CategoryBar.svelte b/plugins/tags-resources/src/components/CategoryBar.svelte index ac1e9575b6..f6dfc7bd59 100644 --- a/plugins/tags-resources/src/components/CategoryBar.svelte +++ b/plugins/tags-resources/src/components/CategoryBar.svelte @@ -54,6 +54,8 @@ } } ) + } else { + elementsQuery.unsubscribe() } type TagElementInfo = { count: number; modifiedOn: number } diff --git a/plugins/task-assets/lang/en.json b/plugins/task-assets/lang/en.json index 60aefbea55..b9e41f9bf1 100644 --- a/plugins/task-assets/lang/en.json +++ b/plugins/task-assets/lang/en.json @@ -62,8 +62,7 @@ "DoneStatesLost": "Done status / Lost", "AllStates": "All states", "DoneStates": "Done states", - "States": "States", - "SearchTask": "Search for task...", + "States": "States", "NoDoneState": "Not done", "ManageStatusesWithin": "Manage application statuses within", "ManageProjectStatues": "Manage project statues", diff --git a/plugins/task-assets/lang/ru.json b/plugins/task-assets/lang/ru.json index ee95a21f4c..73c02adf7e 100644 --- a/plugins/task-assets/lang/ru.json +++ b/plugins/task-assets/lang/ru.json @@ -63,7 +63,6 @@ "AllStates": "Все статусы", "DoneStates": "Завершенные статусы", "States": "Статусы", - "SearchTask": "Поиск задачи...", "NoDoneState": "Не завершено", "ManageStatusesWithin": "Управление статусами для", "ManageProjectStatues": "Управление статусами задачи", diff --git a/plugins/task-resources/src/components/kanban/KanbanDragDone.svelte b/plugins/task-resources/src/components/kanban/KanbanDragDone.svelte index 76c9a4145c..af3b09bd59 100644 --- a/plugins/task-resources/src/components/kanban/KanbanDragDone.svelte +++ b/plugins/task-resources/src/components/kanban/KanbanDragDone.svelte @@ -30,6 +30,8 @@ wonStates = result.filter((x) => x._class === task.class.WonState) lostStates = result.filter((x) => x._class === task.class.LostState) }) + } else { + doneStatesQ.unsubscribe() } let hoveredDoneState: Ref | undefined diff --git a/plugins/task-resources/src/components/state/DoneStateEditor.svelte b/plugins/task-resources/src/components/state/DoneStateEditor.svelte index 3ccdf63389..6101372e92 100644 --- a/plugins/task-resources/src/components/state/DoneStateEditor.svelte +++ b/plugins/task-resources/src/components/state/DoneStateEditor.svelte @@ -45,6 +45,8 @@ }, { limit: 1 } ) + } else { + query.unsubscribe() } diff --git a/plugins/task-resources/src/index.ts b/plugins/task-resources/src/index.ts index 5271e71359..21fdd77604 100644 --- a/plugins/task-resources/src/index.ts +++ b/plugins/task-resources/src/index.ts @@ -14,11 +14,10 @@ // limitations under the License. // -import { Class, Client, Ref } from '@anticrm/core' -import { IntlString, Resources, translate } from '@anticrm/platform' -import { ObjectSearchResult } from '@anticrm/presentation' -import { SpaceWithStates, Task } from '@anticrm/task' +import { Resources } from '@anticrm/platform' +import { SpaceWithStates } from '@anticrm/task' import { showPopup } from '@anticrm/ui' +import AssignedTasks from './components/AssignedTasks.svelte' import CreateProject from './components/CreateProject.svelte' import EditIssue from './components/EditIssue.svelte' import KanbanTemplateEditor from './components/kanban/KanbanTemplateEditor.svelte' @@ -32,59 +31,17 @@ import StateEditor from './components/state/StateEditor.svelte' import StatePresenter from './components/state/StatePresenter.svelte' import StatusTableView from './components/StatusTableView.svelte' import TaskHeader from './components/TaskHeader.svelte' -import TaskItem from './components/TaskItem.svelte' import TaskPresenter from './components/TaskPresenter.svelte' import TemplatesIcon from './components/TemplatesIcon.svelte' import TodoItemPresenter from './components/todos/TodoItemPresenter.svelte' import TodoItemsPopup from './components/todos/TodoItemsPopup.svelte' import Todos from './components/todos/Todos.svelte' import TodoStatePresenter from './components/todos/TodoStatePresenter.svelte' -import AssignedTasks from './components/AssignedTasks.svelte' -import task from './plugin' async function editStatuses (object: SpaceWithStates): Promise { showPopup(EditStatuses, { _id: object._id, spaceClass: object._class }, 'float') } -export async function queryTask ( - _class: Ref>, - client: Client, - search: string -): Promise { - const cl = client.getHierarchy().getClass(_class) - const shortLabel = (await translate(cl.shortLabel ?? ('' as IntlString), {})).toUpperCase() - - // Check number pattern - - const sequence = (await client.findOne(task.class.Sequence, { attachedTo: _class }))?.sequence ?? 0 - - const named = new Map( - (await client.findAll(_class, { name: { $like: `%${search}%` } }, { limit: 200 })).map((e) => [e._id, e]) - ) - const nids: number[] = [] - if (sequence > 0) { - for (let n = 0; n < sequence; n++) { - const v = `${n}` - if (v.includes(search)) { - nids.push(n) - } - } - const numbered = await client.findAll(_class, { number: { $in: nids } }, { limit: 200 }) - for (const d of numbered) { - if (!named.has(d._id)) { - named.set(d._id, d) - } - } - } - - return Array.from(named.values()).map((e) => ({ - doc: e, - title: `${shortLabel}-${e.number}`, - icon: task.icon.Task, - component: TaskItem - })) -} - export type StatesBarPosition = 'start' | 'middle' | 'end' | undefined export default async (): Promise => ({ @@ -111,8 +68,5 @@ export default async (): Promise => ({ }, actionImpl: { EditStatuses: editStatuses - }, - completion: { - IssueQuery: async (client: Client, query: string) => await queryTask(task.class.Issue, client, query) } }) diff --git a/plugins/task/src/index.ts b/plugins/task/src/index.ts index 5e79d82f16..6b6e929855 100644 --- a/plugins/task/src/index.ts +++ b/plugins/task/src/index.ts @@ -221,7 +221,6 @@ const task = plugin(taskId, { Kanban: '' as IntlString, ApplicationLabelTask: '' as IntlString, Projects: '' as IntlString, - SearchTask: '' as IntlString, ManageProjectStatues: '' as IntlString, TodoItems: '' as IntlString }, diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json index d0be9b046a..f6f747b7a3 100644 --- a/plugins/tracker-assets/lang/en.json +++ b/plugins/tracker-assets/lang/en.json @@ -139,7 +139,8 @@ "IncludeItemsThatMatch": "Include items that match", "AnyFilter": "any filter", "AllFilters": "all filters", - "NoDescription": "No description" + "NoDescription": "No description", + "SearchIssue": "Search for task..." }, "status": {} } diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index 45788dd7f7..1b86749db8 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -89,7 +89,8 @@ "IncludeItemsThatMatch": "Включить элементы, которые соответствуют", "AnyFilter": "любому фильтру", "AllFilters": "всем фильтрам", - "NoDescription": "Нет описания" + "NoDescription": "Нет описания", + "SearchIssue": "Поиск задачи..." }, "status": {} } diff --git a/plugins/tracker-resources/src/components/issues/IssueItem.svelte b/plugins/tracker-resources/src/components/issues/IssueItem.svelte new file mode 100644 index 0000000000..6f727c48ba --- /dev/null +++ b/plugins/tracker-resources/src/components/issues/IssueItem.svelte @@ -0,0 +1,38 @@ + + + +
+ +
+ {title} - {value.title} +
+
+ + diff --git a/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte b/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte index 2968fed47b..3a8bcaaf2f 100644 --- a/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte @@ -33,6 +33,8 @@ $: if (!currentTeam) { spaceQuery.query(tracker.class.Team, { _id: value.space }, (res) => ([currentTeam] = res)) + } else { + spaceQuery.unsubscribe() } $: issueName = currentTeam && getIssueId(currentTeam, value) diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssueSelector.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssueSelector.svelte index f5e6c41cda..5a8881c923 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssueSelector.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssueSelector.svelte @@ -86,13 +86,16 @@ $: areSubIssuesLoading = !subIssues $: parentIssue = issue.$lookup?.attachedTo ? (issue.$lookup?.attachedTo as Issue) : null - $: parentIssue && + $: if (parentIssue) { subIssuesQeury.query( tracker.class.Issue, { space: issue.space, attachedTo: parentIssue._id }, (res) => (subIssues = res), { sort: { modifiedOn: SortingOrder.Descending } } ) + } else { + subIssuesQeury.unsubscribe() + } {#if parentIssue} diff --git a/plugins/tracker-resources/src/components/projects/Projects.svelte b/plugins/tracker-resources/src/components/projects/Projects.svelte index 5c7e68ec26..b7c9c4363a 100644 --- a/plugins/tracker-resources/src/components/projects/Projects.svelte +++ b/plugins/tracker-resources/src/components/projects/Projects.svelte @@ -37,19 +37,25 @@ closePopup() projectId = loc.path[4] as Ref + console.log('PROJECT SELECTED', projectId) }) ) const projectQuery = createQuery() $: if (projectId !== undefined) { + console.log('call query for', projectId) projectQuery.query(tracker.class.Project, { _id: projectId }, (result) => { - ;[project] = result + project = result.shift() + console.log('recieve result for', projectId, project) }) } else { + projectQuery.unsubscribe() project = undefined } +{projectId} +{JSON.stringify(project)} {#if project} {:else} diff --git a/plugins/tracker-resources/src/index.ts b/plugins/tracker-resources/src/index.ts index 4dbda69a36..22f30dc46a 100644 --- a/plugins/tracker-resources/src/index.ts +++ b/plugins/tracker-resources/src/index.ts @@ -13,47 +13,99 @@ // limitations under the License. // +import { Class, Client, Ref } from '@anticrm/core' import { Resources } from '@anticrm/platform' - -import NopeComponent from './components/NopeComponent.svelte' - +import { ObjectSearchResult } from '@anticrm/presentation' +import { Issue, Team } from '@anticrm/tracker' +import Inbox from './components/inbox/Inbox.svelte' import Active from './components/issues/Active.svelte' +import AssigneePresenter from './components/issues/AssigneePresenter.svelte' import Backlog from './components/issues/Backlog.svelte' import Board from './components/issues/Board.svelte' -import Inbox from './components/inbox/Inbox.svelte' -import Issues from './components/issues/Issues.svelte' -import MyIssues from './components/myissues/MyIssues.svelte' -import Projects from './components/projects/Projects.svelte' -import ProjectPresenter from './components/projects/ProjectPresenter.svelte' -import ProjectTitlePresenter from './components/projects/ProjectTitlePresenter.svelte' -import Views from './components/views/Views.svelte' -import IssuePresenter from './components/issues/IssuePresenter.svelte' -import TitlePresenter from './components/issues/TitlePresenter.svelte' -import PriorityPresenter from './components/issues/PriorityPresenter.svelte' -import PriorityEditor from './components/issues/PriorityEditor.svelte' -import ProjectEditor from './components/projects/ProjectEditor.svelte' -import StatusPresenter from './components/issues/StatusPresenter.svelte' -import StatusEditor from './components/issues/StatusEditor.svelte' -import SetDueDateActionPopup from './components/SetDueDateActionPopup.svelte' -import SetParentIssueActionPopup from './components/SetParentIssueActionPopup.svelte' import DueDatePresenter from './components/issues/DueDatePresenter.svelte' -import AssigneePresenter from './components/issues/AssigneePresenter.svelte' +import EditIssue from './components/issues/edit/EditIssue.svelte' +import IssueItem from './components/issues/IssueItem.svelte' +import IssuePresenter from './components/issues/IssuePresenter.svelte' +import IssuePreview from './components/issues/IssuePreview.svelte' +import Issues from './components/issues/Issues.svelte' +import IssuesView from './components/issues/IssuesView.svelte' +import ListView from './components/issues/ListView.svelte' +import ModificationDatePresenter from './components/issues/ModificationDatePresenter.svelte' +import PriorityEditor from './components/issues/PriorityEditor.svelte' +import PriorityPresenter from './components/issues/PriorityPresenter.svelte' +import StatusEditor from './components/issues/StatusEditor.svelte' +import StatusPresenter from './components/issues/StatusPresenter.svelte' +import TitlePresenter from './components/issues/TitlePresenter.svelte' import ViewOptionsPopup from './components/issues/ViewOptionsPopup.svelte' +import MyIssues from './components/myissues/MyIssues.svelte' +import NewIssueHeader from './components/NewIssueHeader.svelte' +import NopeComponent from './components/NopeComponent.svelte' +import EditProject from './components/projects/EditProject.svelte' import IconPresenter from './components/projects/IconPresenter.svelte' import LeadPresenter from './components/projects/LeadPresenter.svelte' -import TargetDatePresenter from './components/projects/TargetDatePresenter.svelte' +import ProjectEditor from './components/projects/ProjectEditor.svelte' import ProjectMembersPresenter from './components/projects/ProjectMembersPresenter.svelte' -import ProjectStatusPresenter from './components/projects/ProjectStatusPresenter.svelte' -import EditProject from './components/projects/EditProject.svelte' +import ProjectPresenter from './components/projects/ProjectPresenter.svelte' +import Projects from './components/projects/Projects.svelte' import ProjectStatusEditor from './components/projects/ProjectStatusEditor.svelte' +import ProjectStatusPresenter from './components/projects/ProjectStatusPresenter.svelte' +import ProjectTitlePresenter from './components/projects/ProjectTitlePresenter.svelte' +import TargetDatePresenter from './components/projects/TargetDatePresenter.svelte' +import SetDueDateActionPopup from './components/SetDueDateActionPopup.svelte' +import SetParentIssueActionPopup from './components/SetParentIssueActionPopup.svelte' +import Views from './components/views/Views.svelte' +import tracker from './plugin' +import { getIssueId } from './utils' -import ModificationDatePresenter from './components/issues/ModificationDatePresenter.svelte' -import EditIssue from './components/issues/edit/EditIssue.svelte' -import NewIssueHeader from './components/NewIssueHeader.svelte' -import ListView from './components/issues/ListView.svelte' -import IssuesView from './components/issues/IssuesView.svelte' -import IssuePreview from './components/issues/IssuePreview.svelte' +export async function queryIssue ( + _class: Ref>, + client: Client, + search: string +): Promise { + const teams = await client.findAll(tracker.class.Team, {}) + const named = new Map( + ( + await client.findAll( + _class, + { title: { $like: `%${search}%` } }, + { + limit: 200, + lookup: { space: tracker.class.Team } + } + ) + ).map((e) => [e._id, e]) + ) + + for (const currentTeam of teams) { + const nids: number[] = [] + for (let n = 0; n < currentTeam.sequence; n++) { + const v = `${currentTeam.identifier}-${n}` + if (v.includes(search)) { + nids.push(n) + } + } + if (nids.length > 0) { + const numbered = await client.findAll( + _class, + { number: { $in: nids } }, + { limit: 200, lookup: { space: tracker.class.Team } } + ) + for (const d of numbered) { + if (!named.has(d._id)) { + named.set(d._id, d) + } + } + } + } + + return Array.from(named.values()).map((e) => ({ + doc: e, + title: getIssueId(e.$lookup?.space as Team, e), + icon: tracker.icon.TrackerApplication, + component: IssueItem + })) +} export default async (): Promise => ({ component: { NopeComponent, @@ -95,5 +147,8 @@ export default async (): Promise => ({ }, function: { ProjectVisible: () => false + }, + completion: { + IssueQuery: async (client: Client, query: string) => await queryIssue(tracker.class.Issue, client, query) } }) diff --git a/plugins/view-resources/src/components/EditDoc.svelte b/plugins/view-resources/src/components/EditDoc.svelte index 7cf1ad3b31..0034e82684 100644 --- a/plugins/view-resources/src/components/EditDoc.svelte +++ b/plugins/view-resources/src/components/EditDoc.svelte @@ -63,12 +63,14 @@ }) const query = createQuery() - $: _id && - _class && + $: if (_id && _class) { query.query(_class, { _id }, (result) => { object = result[0] realObjectClass = object._class }) + } else { + query.unsubscribe() + } let keys: KeyedAttribute[] = [] let collectionEditors: { key: KeyedAttribute; editor: AnyComponent }[] = [] diff --git a/plugins/view-resources/src/components/ObjectPresenter.svelte b/plugins/view-resources/src/components/ObjectPresenter.svelte index 64fba99377..ea13ed641c 100644 --- a/plugins/view-resources/src/components/ObjectPresenter.svelte +++ b/plugins/view-resources/src/components/ObjectPresenter.svelte @@ -34,6 +34,7 @@ doc = r.shift() }) } else { + docQuery.unsubscribe() doc = value } diff --git a/plugins/view-resources/src/components/ViewletSetting.svelte b/plugins/view-resources/src/components/ViewletSetting.svelte index 79661eada6..e623e3809d 100644 --- a/plugins/view-resources/src/components/ViewletSetting.svelte +++ b/plugins/view-resources/src/components/ViewletSetting.svelte @@ -29,7 +29,7 @@ let preference: ViewletPreference | undefined const preferenceQuery = createQuery() - $: viewlet && + $: if (viewlet) { preferenceQuery.query( view.class.ViewletPreference, { @@ -41,6 +41,9 @@ }, { limit: 1 } ) + } else { + preferenceQuery.unsubscribe() + } const client = getClient() const hierarchy = client.getHierarchy() diff --git a/products/tracker/package.json b/products/tracker/package.json index ac07fe9ba4..b96abb11f5 100644 --- a/products/tracker/package.json +++ b/products/tracker/package.json @@ -3,11 +3,13 @@ "version": "1.0.0", "license": "EPL-2.0", "scripts": { - "build": "rm -rf ./dist && cross-env NODE_ENV=production webpack --stats-error-details && echo 'done'", - "bundle": "cp -r ../../server/front/bundle.js .", - "docker:build": "docker build -t hardcoreeng/tracker-front .", - "docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/tracker-front staging", - "docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/tracker-front", + "build": "echo 'disabled'", + "*build": "rm -rf ./dist && cross-env NODE_ENV=production webpack --stats-error-details && echo 'done'", + "*bundle": "cp -r ../../server/front/bundle.js .", + "bundle": "echo 'disabled'", + "*docker:build": "docker build -t hardcoreeng/tracker-front .", + "*docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/tracker-front staging", + "*docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/tracker-front", "analyze": "cross-env NODE_ENV=production webpack --json > stats.json", "show": "webpack-bundle-analyzer stats.json dist", "dev": "cross-env CLIENT_TYPE=dev webpack serve", @@ -15,8 +17,8 @@ "start": "cross-env NODE_ENV=production webpack serve", "preformat-svelte": "prettier -w src/**/*.svelte", "lint": "", - "lint:fix": "yarn preformat-svelte && eslint --fix src", - "deploy": "cp -p public/* dist && aws s3 sync dist s3://anticrm-platform --delete --acl public-read" + "lint:fix": "", + "*deploy": "cp -p public/* dist && aws s3 sync dist s3://anticrm-platform --delete --acl public-read" }, "devDependencies": { "cross-env": "~7.0.3",