diff --git a/changelog.md b/changelog.md index 37da61265a..0e02204f31 100644 --- a/changelog.md +++ b/changelog.md @@ -10,9 +10,10 @@ Tracker: - Remember view options - My issues +- Names of parent issues - Roadmap -- Remember view options - Context menus (Priority/Status/Assignee) +- Chunter: diff --git a/models/server-tracker/src/index.ts b/models/server-tracker/src/index.ts index 13902324e4..8ce21490ee 100644 --- a/models/server-tracker/src/index.ts +++ b/models/server-tracker/src/index.ts @@ -20,6 +20,6 @@ import serverTracker from '@anticrm/server-tracker' export function createModel (builder: Builder): void { builder.createDoc(serverCore.class.Trigger, core.space.Model, { - trigger: serverTracker.trigger.OnIssueProjectUpdate + trigger: serverTracker.trigger.OnIssueUpdate }) } diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 90368b56db..f66f7daef8 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -43,6 +43,7 @@ import task from '@anticrm/task' import { Document, Issue, + IssueParentInfo, IssuePriority, IssueStatus, IssueStatusCategory, @@ -180,6 +181,8 @@ export class TIssue extends TAttachedDoc implements Issue { @Prop(ArrOf(TypeRef(tracker.class.Issue)), tracker.string.RelatedTo) relatedIssue!: Ref[] + parents!: IssueParentInfo[] + @Prop(Collection(chunter.class.Comment), tracker.string.Comments) comments!: number diff --git a/models/tracker/src/migration.ts b/models/tracker/src/migration.ts index 5110c4b383..2e5c384acd 100644 --- a/models/tracker/src/migration.ts +++ b/models/tracker/src/migration.ts @@ -225,6 +225,36 @@ async function migrateParentIssues (client: MigrationClient): Promise { } } +async function updateIssueParentInfo (client: MigrationClient, parentIssue: Issue | null): Promise { + const parents = + parentIssue === null ? [] : [{ parentId: parentIssue._id, parentTitle: parentIssue.title }, ...parentIssue.parents] + const migrationResult = await client.update( + DOMAIN_TRACKER, + { + _class: tracker.class.Issue, + attachedTo: parentIssue?._id ?? tracker.ids.NoParent, + parents: { $exists: false } + }, + { parents } + ) + + if (migrationResult.matched > 0) { + const subIssues = await client.find(DOMAIN_TRACKER, { + _class: tracker.class.Issue, + attachedTo: parentIssue?._id ?? tracker.ids.NoParent, + subIssues: { $gt: 0 } + }) + + for (const issue of subIssues) { + await updateIssueParentInfo(client, issue) + } + } +} + +async function migrateIssueParentInfo (client: MigrationClient): Promise { + await updateIssueParentInfo(client, null) +} + async function migrateIssueProjects (client: MigrationClient): Promise { const issues = await client.find(DOMAIN_TRACKER, { _class: tracker.class.Issue, project: { $exists: false } }) @@ -288,6 +318,7 @@ async function upgradeProjects (tx: TxOperations): Promise { export const trackerOperation: MigrateOperation = { async migrate (client: MigrationClient): Promise { await Promise.all([migrateIssueProjects(client), migrateParentIssues(client)]) + await migrateIssueParentInfo(client) }, async upgrade (client: MigrationUpgradeClient): Promise { const tx = new TxOperations(client, core.account.System) diff --git a/plugins/tracker-resources/src/components/CreateIssue.svelte b/plugins/tracker-resources/src/components/CreateIssue.svelte index d1107be9cf..d35d98dbaf 100644 --- a/plugins/tracker-resources/src/components/CreateIssue.svelte +++ b/plugins/tracker-resources/src/components/CreateIssue.svelte @@ -64,7 +64,8 @@ priority: priority, dueDate: null, comments: 0, - subIssues: 0 + subIssues: 0, + parents: [] } const dispatch = createEventDispatcher() @@ -143,7 +144,10 @@ rank: calcRank(lastOne, undefined), comments: 0, subIssues: 0, - dueDate: object.dueDate + dueDate: object.dueDate, + parents: parentIssue + ? [{ parentId: parentIssue._id, parentTitle: parentIssue.title }, ...parentIssue.parents] + : [] } await client.addCollection( diff --git a/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte b/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte index deb15c4440..e7c6d865a0 100644 --- a/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte +++ b/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte @@ -13,7 +13,7 @@ // limitations under the License. --> = tracker.team.DefaultTeam @@ -172,8 +173,11 @@ showPanel(tracker.component.EditIssue, object._id, object._class, 'content') }} > -
- +
+
+ + +
{object.title} @@ -210,6 +214,10 @@ {/await} diff --git a/plugins/tracker-resources/src/components/issues/TitlePresenter.svelte b/plugins/tracker-resources/src/components/issues/TitlePresenter.svelte index 90ce085e32..a059837b8e 100644 --- a/plugins/tracker-resources/src/components/issues/TitlePresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/TitlePresenter.svelte @@ -14,25 +14,29 @@ --> {#if value} - {value.title} + + {value.title} + + {/if}