diff --git a/dev/generator/package.json b/dev/generator/package.json index fffab34b73..932cccfa3c 100644 --- a/dev/generator/package.json +++ b/dev/generator/package.json @@ -38,6 +38,7 @@ "@hcengineering/account": "^0.6.0", "@hcengineering/core": "^0.6.21", "@hcengineering/contact": "^0.6.11", + "@hcengineering/tracker": "^0.6.2", "@hcengineering/model-all": "^0.6.0", "@hcengineering/model-telegram": "^0.6.0", "@hcengineering/telegram": "^0.6.2", diff --git a/dev/generator/src/issues.ts b/dev/generator/src/issues.ts index 8bd619702a..8b32211e42 100644 --- a/dev/generator/src/issues.ts +++ b/dev/generator/src/issues.ts @@ -11,18 +11,18 @@ import core, { TxOperations, WorkspaceId } from '@hcengineering/core' -import tracker, { calcRank, Issue, IssuePriority, IssueStatus } from '../../../plugins/tracker/lib' +import tracker, { calcRank, Issue, IssuePriority, IssueStatus } from '@hcengineering/tracker' import { connect } from './connect' let objectId: Ref = generateId() -const space = tracker.team.DefaultTeam +const space = tracker.project.DefaultProject const object: AttachedData = { title: '', description: '', assignee: null, - project: null, + component: null, sprint: null, number: 0, rank: '', @@ -67,7 +67,7 @@ export async function generateIssues ( async function genIssue (client: TxOperations): Promise { const lastOne = await client.findOne(tracker.class.Issue, {}, { sort: { rank: SortingOrder.Descending } }) const incResult = await client.updateDoc( - tracker.class.Team, + tracker.class.Project, core.space.Space, space, { @@ -79,7 +79,7 @@ async function genIssue (client: TxOperations): Promise { title: faker.name.title(), description: faker.lorem.paragraphs(), assignee: object.assignee, - project: object.project, + component: object.component, sprint: object.sprint, number: (incResult as any).object.sequence, status: object.status, diff --git a/models/server-tracker/src/index.ts b/models/server-tracker/src/index.ts index 9d66a9357e..dba4f2ac14 100644 --- a/models/server-tracker/src/index.ts +++ b/models/server-tracker/src/index.ts @@ -34,10 +34,10 @@ export function createModel (builder: Builder): void { }) builder.createDoc(serverCore.class.Trigger, core.space.Model, { - trigger: serverTracker.trigger.OnProjectRemove + trigger: serverTracker.trigger.OnComponentRemove }) builder.createDoc(serverCore.class.Trigger, core.space.Model, { - trigger: serverTracker.trigger.OnTeamDelete + trigger: serverTracker.trigger.OnProjectDelete }) } diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index d0bb4e6d1a..05a37c8e42 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -64,13 +64,13 @@ import { IssueStatusCategory, IssueTemplate, IssueTemplateChild, - Project, - ProjectStatus, + Component, + ComponentStatus, Scrum, ScrumRecord, Sprint, SprintStatus, - Team, + Project, TimeReportDayType, TimeSpendReport, trackerId, @@ -132,8 +132,8 @@ export class TTypeIssuePriority extends TType {} /** * @public */ -export function TypeProjectStatus (): Type { - return { _class: tracker.class.TypeProjectStatus, label: 'TypeProjectStatus' as IntlString } +export function TypeComponentStatus (): Type { + return { _class: tracker.class.TypeComponentStatus, label: 'TypeComponentStatus' as IntlString } } /** @@ -146,8 +146,8 @@ export function TypeSprintStatus (): Type { /** * @public */ -@Model(tracker.class.TypeProjectStatus, core.class.Type, DOMAIN_MODEL) -export class TTypeProjectStatus extends TType {} +@Model(tracker.class.TypeComponentStatus, core.class.Type, DOMAIN_MODEL) +export class TTypeComponentStatus extends TType {} /** * @public @@ -158,9 +158,9 @@ export class TTypeSprintStatus extends TType {} /** * @public */ -@Model(tracker.class.Team, core.class.Space, DOMAIN_SPACE) -@UX(tracker.string.Team, tracker.icon.Team, 'TEAM') -export class TTeam extends TSpace implements Team { +@Model(tracker.class.Project, core.class.Space, DOMAIN_SPACE) +@UX(tracker.string.Project, tracker.icon.Project, 'Project') +export class TProject extends TSpace implements Project { @Prop(TypeString(), tracker.string.Title) @Index(IndexKind.FullText) reamLogo!: IntlString @@ -226,9 +226,9 @@ export class TIssue extends TAttachedDoc implements Issue { @Index(IndexKind.Indexed) assignee!: Ref | null - @Prop(TypeRef(tracker.class.Project), tracker.string.Project) + @Prop(TypeRef(tracker.class.Component), tracker.string.Component) @Index(IndexKind.Indexed) - project!: Ref | null + component!: Ref | null @Prop(Collection(tracker.class.Issue), tracker.string.SubIssues) subIssues!: number @@ -250,7 +250,7 @@ export class TIssue extends TAttachedDoc implements Issue { @Prop(Collection(tags.class.TagReference), tracker.string.Labels) labels?: number - declare space: Ref + declare space: Ref @Prop(TypeDate(DateRangeMode.DATETIME), tracker.string.DueDate) dueDate!: Timestamp | null @@ -296,13 +296,13 @@ export class TIssueTemplate extends TDoc implements IssueTemplate { @Prop(TypeRef(contact.class.Employee), tracker.string.Assignee) assignee!: Ref | null - @Prop(TypeRef(tracker.class.Project), tracker.string.Project) - project!: Ref | null + @Prop(TypeRef(tracker.class.Component), tracker.string.Component) + component!: Ref | null @Prop(ArrOf(TypeRef(tags.class.TagElement)), tracker.string.Labels) labels?: Ref[] - declare space: Ref + declare space: Ref @Prop(TypeDate(DateRangeMode.DATETIME), tracker.string.DueDate) dueDate!: Timestamp | null @@ -351,9 +351,9 @@ export class TTimeSpendReport extends TAttachedDoc implements TimeSpendReport { /** * @public */ -@Model(tracker.class.Project, core.class.Doc, DOMAIN_TRACKER) -@UX(tracker.string.Project, tracker.icon.Project, 'PROJECT') -export class TProject extends TDoc implements Project { +@Model(tracker.class.Component, core.class.Doc, DOMAIN_TRACKER) +@UX(tracker.string.Component, tracker.icon.Component, 'COMPONENT') +export class TComponent extends TDoc implements Component { @Prop(TypeString(), tracker.string.Title) // @Index(IndexKind.FullText) label!: string @@ -364,10 +364,10 @@ export class TProject extends TDoc implements Project { @Prop(TypeString(), tracker.string.AssetLabel) icon!: Asset - @Prop(TypeProjectStatus(), tracker.string.Status) - status!: ProjectStatus + @Prop(TypeComponentStatus(), tracker.string.Status) + status!: ComponentStatus - @Prop(TypeRef(contact.class.Employee), tracker.string.ProjectLead) + @Prop(TypeRef(contact.class.Employee), tracker.string.ComponentLead) lead!: Ref | null @Prop(ArrOf(TypeRef(contact.class.Employee)), tracker.string.Members) @@ -385,7 +385,7 @@ export class TProject extends TDoc implements Project { @Prop(TypeDate(DateRangeMode.DATETIME), tracker.string.TargetDate) targetDate!: Timestamp | null - declare space: Ref + declare space: Ref } /** @@ -405,7 +405,7 @@ export class TSprint extends TDoc implements Sprint { @Index(IndexKind.Indexed) status!: SprintStatus - @Prop(TypeRef(contact.class.Employee), tracker.string.ProjectLead) + @Prop(TypeRef(contact.class.Employee), tracker.string.ComponentLead) lead!: Ref | null @Prop(ArrOf(TypeRef(contact.class.Employee)), tracker.string.Members) @@ -423,14 +423,14 @@ export class TSprint extends TDoc implements Sprint { @Prop(TypeDate(), tracker.string.TargetDate) targetDate!: Timestamp - declare space: Ref + declare space: Ref @Prop(TypeNumber(), tracker.string.Capacity) capacity!: number - @Prop(TypeRef(tracker.class.Project), tracker.string.Project) + @Prop(TypeRef(tracker.class.Component), tracker.string.Component) @Index(IndexKind.Indexed) - project!: Ref + component!: Ref } /** @@ -460,7 +460,7 @@ export class TScrum extends TDoc implements Scrum { @Prop(TypeDate(DateRangeMode.TIME), tracker.string.ScrumEndTime) endTime!: Timestamp - declare space: Ref + declare space: Ref } /** @@ -485,7 +485,7 @@ export class TScrumRecord extends TAttachedDoc implements ScrumRecord { attachments!: number declare attachedTo: Ref - declare space: Ref + declare space: Ref declare scrumRecorder: Ref } @@ -495,14 +495,14 @@ export class TTypeReportedTime extends TType {} export function createModel (builder: Builder): void { builder.createModel( - TTeam, TProject, + TComponent, TIssue, TIssueTemplate, TIssueStatus, TIssueStatusCategory, TTypeIssuePriority, - TTypeProjectStatus, + TTypeComponentStatus, TSprint, TScrum, TScrumRecord, @@ -512,7 +512,7 @@ export function createModel (builder: Builder): void { ) const issuesOptions: ViewOptionsModel = { - groupBy: ['status', 'assignee', 'priority', 'project', 'sprint'], + groupBy: ['status', 'assignee', 'priority', 'component', 'sprint'], orderBy: [ ['status', SortingOrder.Ascending], ['priority', SortingOrder.Ascending], @@ -574,14 +574,14 @@ export function createModel (builder: Builder): void { { key: '', presenter: tracker.component.DueDatePresenter, props: { kind: 'list' } }, { key: '', - presenter: tracker.component.ProjectEditor, + presenter: tracker.component.ComponentEditor, props: { kind: 'list', size: 'small', shape: 'round', shouldShowPlaceholder: false, listProps: { - excludeByKey: 'project', + excludeByKey: 'component', optional: true } } @@ -702,7 +702,7 @@ export function createModel (builder: Builder): void { attachTo: tracker.class.IssueTemplate, descriptor: view.viewlet.List, viewOptions: { - groupBy: ['assignee', 'priority', 'project', 'sprint'], + groupBy: ['assignee', 'priority', 'component', 'sprint'], orderBy: [ ['priority', SortingOrder.Ascending], ['modifiedOn', SortingOrder.Descending], @@ -722,7 +722,7 @@ export function createModel (builder: Builder): void { // { key: '', presenter: tracker.component.DueDatePresenter, props: { kind: 'list' } }, { key: '', - presenter: tracker.component.ProjectEditor, + presenter: tracker.component.ComponentEditor, props: { kind: 'list', size: 'small', shape: 'round', shouldShowPlaceholder: false } }, { @@ -841,7 +841,7 @@ export function createModel (builder: Builder): void { const activeId = 'active' const backlogId = 'backlog' const boardId = 'board' - const projectsId = 'projects' + const componentsId = 'components' const sprintsId = 'sprints' const templatesId = 'templates' // const scrumsId = 'scrums' @@ -902,18 +902,23 @@ export function createModel (builder: Builder): void { presenter: tracker.component.PriorityRefPresenter }) + builder.mixin(tracker.class.Component, core.class.Class, view.mixin.ObjectPresenter, { + presenter: tracker.component.ComponentPresenter + }) + builder.mixin(tracker.class.Project, core.class.Class, view.mixin.ObjectPresenter, { presenter: tracker.component.ProjectPresenter }) - builder.mixin(tracker.class.Team, core.class.Class, view.mixin.ObjectPresenter, { - presenter: tracker.component.TeamPresenter - }) + classPresenter( + builder, + tracker.class.Component, + tracker.component.ComponentSelector, + tracker.component.ComponentSelector + ) - classPresenter(builder, tracker.class.Project, tracker.component.ProjectSelector, tracker.component.ProjectSelector) - - builder.mixin(tracker.class.Project, core.class.Class, view.mixin.AttributeEditor, { - inlineEditor: tracker.component.ProjectSelector + builder.mixin(tracker.class.Component, core.class.Class, view.mixin.AttributeEditor, { + inlineEditor: tracker.component.ComponentSelector }) builder.mixin(tracker.class.Sprint, core.class.Class, view.mixin.ObjectPresenter, { @@ -928,8 +933,8 @@ export function createModel (builder: Builder): void { value: true }) - builder.mixin(tracker.class.TypeProjectStatus, core.class.Class, view.mixin.AttributeEditor, { - inlineEditor: tracker.component.ProjectStatusEditor + builder.mixin(tracker.class.TypeComponentStatus, core.class.Class, view.mixin.AttributeEditor, { + inlineEditor: tracker.component.ComponentStatusEditor }) builder.mixin(tracker.class.Issue, core.class.Class, notification.mixin.LastViewAttached, {}) @@ -945,8 +950,8 @@ export function createModel (builder: Builder): void { func: tracker.function.GetAllPriority }) - builder.mixin(tracker.class.Project, core.class.Class, view.mixin.AllValuesFunc, { - func: tracker.function.GetAllProjects + builder.mixin(tracker.class.Component, core.class.Class, view.mixin.AllValuesFunc, { + func: tracker.function.GetAllComponents }) builder.mixin(tracker.class.Sprint, core.class.Class, view.mixin.AllValuesFunc, { @@ -1001,16 +1006,16 @@ export function createModel (builder: Builder): void { id: 'roadmap', position: 'top', label: tracker.string.Roadmap, - icon: tracker.icon.Projects, + icon: tracker.icon.Components, component: tracker.component.Roadmap } ], spaces: [ { - label: tracker.string.Teams, - spaceClass: tracker.class.Team, - addSpaceLabel: tracker.string.CreateTeam, - createComponent: tracker.component.CreateTeam, + label: tracker.string.Projects, + spaceClass: tracker.class.Project, + addSpaceLabel: tracker.string.CreateProject, + createComponent: tracker.component.CreateProject, icon: tracker.icon.Home, specials: [ { @@ -1032,10 +1037,10 @@ export function createModel (builder: Builder): void { component: tracker.component.Backlog }, { - id: projectsId, - label: tracker.string.Projects, - icon: tracker.icon.Projects, - component: tracker.component.TeamProjects + id: componentsId, + label: tracker.string.Components, + icon: tracker.icon.Components, + component: tracker.component.ProjectComponents }, { id: sprintsId, @@ -1069,7 +1074,7 @@ export function createModel (builder: Builder): void { application: trackerId, mode: 'space', spaceSpecial: id, - spaceClass: tracker.class.Team + spaceClass: tracker.class.Project }) } @@ -1077,7 +1082,7 @@ export function createModel (builder: Builder): void { createGotoSpecialAction(builder, activeId, 'g->a', tracker.string.GotoActive) createGotoSpecialAction(builder, backlogId, 'g->b', tracker.string.GotoBacklog) createGotoSpecialAction(builder, boardId, 'g->d', tracker.string.GotoBoard) - createGotoSpecialAction(builder, projectsId, 'g->p', tracker.string.GotoProjects) + createGotoSpecialAction(builder, componentsId, 'g->c', tracker.string.GotoComponents) createAction(builder, { action: workbench.actionImpl.Navigate, @@ -1103,7 +1108,7 @@ export function createModel (builder: Builder): void { icon: view.icon.Statuses, input: 'focus', category: tracker.category.Tracker, - target: tracker.class.Team, + target: tracker.class.Project, query: { archived: false }, @@ -1118,12 +1123,12 @@ export function createModel (builder: Builder): void { createAction( builder, { - action: tracker.actionImpl.EditTeam, - label: tracker.string.EditTeam, + action: tracker.actionImpl.EditProject, + label: tracker.string.EditProject, icon: contact.icon.Edit, input: 'focus', category: tracker.category.Tracker, - target: tracker.class.Team, + target: tracker.class.Project, query: { archived: false }, @@ -1132,18 +1137,18 @@ export function createModel (builder: Builder): void { group: 'edit' } }, - tracker.action.EditTeam + tracker.action.EditProject ) createAction( builder, { - action: tracker.actionImpl.DeleteTeam, - label: tracker.string.DeleteTeam, + action: tracker.actionImpl.DeleteProject, + label: tracker.string.DeleteProject, icon: view.icon.Delete, input: 'focus', category: tracker.category.Tracker, - target: tracker.class.Team, + target: tracker.class.Project, query: { archived: false }, @@ -1152,7 +1157,7 @@ export function createModel (builder: Builder): void { group: 'edit' } }, - tracker.action.DeleteTeam + tracker.action.DeleteProject ) builder.createDoc( @@ -1449,15 +1454,15 @@ export function createModel (builder: Builder): void { action: view.actionImpl.ValueSelector, actionPopup: view.component.ValueSelector, actionProps: { - attribute: 'project', - _class: tracker.class.Project, + attribute: 'component', + _class: tracker.class.Component, query: {}, searchField: 'label', - placeholder: tracker.string.Project + placeholder: tracker.string.Component }, - label: tracker.string.Project, - icon: tracker.icon.Project, - keyBinding: ['keyP->keyP'], + label: tracker.string.Component, + icon: tracker.icon.Component, + keyBinding: ['keyC'], input: 'any', category: tracker.category.Tracker, target: tracker.class.Issue, @@ -1467,7 +1472,7 @@ export function createModel (builder: Builder): void { group: 'edit' } }, - tracker.action.SetProject + tracker.action.SetComponent ) createAction( @@ -1596,7 +1601,7 @@ export function createModel (builder: Builder): void { builder, { action: view.actionImpl.Move, - label: tracker.string.MoveToTeam, + label: tracker.string.MoveToProject, icon: view.icon.Move, keyBinding: [], input: 'any', @@ -1608,7 +1613,7 @@ export function createModel (builder: Builder): void { group: 'associate' } }, - tracker.action.MoveToTeam + tracker.action.MoveToProject ) // TODO: fix icon createAction( @@ -1687,7 +1692,7 @@ export function createModel (builder: Builder): void { ) const sprintOptions: ViewOptionsModel = { - groupBy: ['project', 'lead'], + groupBy: ['component', 'lead'], orderBy: [ ['startDate', SortingOrder.Descending], ['modifiedOn', SortingOrder.Descending], @@ -1712,7 +1717,7 @@ export function createModel (builder: Builder): void { }, { key: '', presenter: tracker.component.SprintPresenter, props: { shouldUseMargin: true } }, { key: '', presenter: view.component.GrowPresenter, props: { type: 'grow' } }, - { key: '', presenter: tracker.component.SprintProjectEditor, props: { kind: 'list' } }, + { key: '', presenter: tracker.component.SprintComponentEditor, props: { kind: 'list' } }, { key: '', presenter: contact.component.MembersPresenter, diff --git a/models/tracker/src/migration.ts b/models/tracker/src/migration.ts index d7561f295e..1673d6ffe5 100644 --- a/models/tracker/src/migration.ts +++ b/models/tracker/src/migration.ts @@ -14,16 +14,20 @@ // import core, { + Class, Doc, DocumentUpdate, DOMAIN_TX, generateId, Ref, SortingOrder, + TxCreateDoc, TxOperations, - TxResult + TxResult, + TxUpdateDoc } from '@hcengineering/core' import { createOrUpdate, MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model' +import { DOMAIN_SPACE } from '@hcengineering/model-core' import tags from '@hcengineering/tags' import { calcRank, @@ -31,7 +35,9 @@ import { Issue, IssueStatus, IssueStatusCategory, - Team, + IssueTemplate, + IssueTemplateChild, + Project, TimeReportDayType, WorkDayLength } from '@hcengineering/tracker' @@ -46,9 +52,9 @@ enum DeprecatedIssueStatus { Canceled } -interface CreateTeamIssueStatusesArgs { +interface CreateProjectIssueStatusesArgs { tx: TxOperations - teamId: Ref + projectId: Ref categories: IssueStatusCategory[] defaultStatusId?: Ref defaultCategoryId?: Ref @@ -62,13 +68,13 @@ const categoryByDeprecatedIssueStatus = { [DeprecatedIssueStatus.Canceled]: tracker.issueStatusCategory.Canceled } as const -async function createTeamIssueStatuses ({ +async function createProjectIssueStatuses ({ tx, - teamId: attachedTo, + projectId: attachedTo, categories, defaultStatusId, defaultCategoryId = tracker.issueStatusCategory.Backlog -}: CreateTeamIssueStatusesArgs): Promise { +}: CreateProjectIssueStatusesArgs): Promise { const issueStatusRanks = [...genRanks(categories.length)] for (const [i, statusCategory] of categories.entries()) { @@ -79,7 +85,7 @@ async function createTeamIssueStatuses ({ tracker.class.IssueStatus, attachedTo, attachedTo, - tracker.class.Team, + tracker.class.Project, 'issueStatuses', { name: defaultStatusName, category, rank }, category === defaultCategoryId ? defaultStatusId : undefined @@ -87,13 +93,13 @@ async function createTeamIssueStatuses ({ } } -async function createDefaultTeam (tx: TxOperations): Promise { - const current = await tx.findOne(tracker.class.Team, { - _id: tracker.team.DefaultTeam +async function createDefaultProject (tx: TxOperations): Promise { + const current = await tx.findOne(tracker.class.Project, { + _id: tracker.project.DefaultProject }) const currentDeleted = await tx.findOne(core.class.TxRemoveDoc, { - objectId: tracker.team.DefaultTeam + objectId: tracker.project.DefaultProject }) // Create new if not deleted by customers. @@ -105,12 +111,12 @@ async function createDefaultTeam (tx: TxOperations): Promise { { sort: { order: SortingOrder.Ascending } } ) - await tx.createDoc( - tracker.class.Team, + await tx.createDoc( + tracker.class.Project, core.space.Space, { name: 'Default', - description: 'Default team', + description: 'Default project', private: false, members: [], archived: false, @@ -122,16 +128,16 @@ async function createDefaultTeam (tx: TxOperations): Promise { defaultAssignee: undefined, workDayLength: WorkDayLength.EIGHT_HOURS }, - tracker.team.DefaultTeam + tracker.project.DefaultProject ) - await createTeamIssueStatuses({ tx, teamId: tracker.team.DefaultTeam, categories, defaultStatusId }) + await createProjectIssueStatuses({ tx, projectId: tracker.project.DefaultProject, categories, defaultStatusId }) } } -async function fixTeamIssueStatusesOrder (tx: TxOperations, team: Team): Promise { +async function fixProjectIssueStatusesOrder (tx: TxOperations, project: Project): Promise { const statuses = await tx.findAll( tracker.class.IssueStatus, - { attachedTo: team._id }, + { attachedTo: project._id }, { lookup: { category: tracker.class.IssueStatusCategory } } ) statuses.sort((a, b) => (a.$lookup?.category?.order ?? 0) - (b.$lookup?.category?.order ?? 0)) @@ -143,19 +149,19 @@ async function fixTeamIssueStatusesOrder (tx: TxOperations, team: Team): Promise }) } -async function fixTeamsIssueStatusesOrder (tx: TxOperations): Promise { - const teams = await tx.findAll(tracker.class.Team, {}) - await Promise.all(teams.map((team) => fixTeamIssueStatusesOrder(tx, team))) +async function fixProjectsIssueStatusesOrder (tx: TxOperations): Promise { + const projects = await tx.findAll(tracker.class.Project, {}) + await Promise.all(projects.map((project) => fixProjectIssueStatusesOrder(tx, project))) } -async function upgradeTeamSettings (tx: TxOperations): Promise { - const teams = await tx.findAll(tracker.class.Team, { +async function upgradeProjectSettings (tx: TxOperations): Promise { + const projects = await tx.findAll(tracker.class.Project, { defaultTimeReportDay: { $exists: false }, workDayLength: { $exists: false } }) await Promise.all( - teams.map((team) => - tx.update(team, { + projects.map((project) => + tx.update(project, { defaultTimeReportDay: TimeReportDayType.PreviousWorkDay, workDayLength: WorkDayLength.EIGHT_HOURS }) @@ -163,21 +169,21 @@ async function upgradeTeamSettings (tx: TxOperations): Promise { ) } -async function upgradeTeamIssueStatuses (tx: TxOperations): Promise { - const teams = await tx.findAll(tracker.class.Team, { issueStatuses: undefined }) +async function upgradeProjectIssueStatuses (tx: TxOperations): Promise { + const projects = await tx.findAll(tracker.class.Project, { issueStatuses: undefined }) - if (teams.length > 0) { + if (projects.length > 0) { const categories = await tx.findAll( tracker.class.IssueStatusCategory, {}, { sort: { order: SortingOrder.Ascending } } ) - for (const team of teams) { + for (const project of projects) { const defaultStatusId: Ref = generateId() - await tx.update(team, { issueStatuses: 0, defaultIssueStatus: defaultStatusId }) - await createTeamIssueStatuses({ tx, teamId: team._id, categories, defaultStatusId }) + await tx.update(project, { issueStatuses: 0, defaultIssueStatus: defaultStatusId }) + await createProjectIssueStatuses({ tx, projectId: project._id, categories, defaultStatusId }) } } } @@ -291,38 +297,38 @@ 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 } }) +async function migrateIssueComponents (client: MigrationClient): Promise { + const issues = await client.find(DOMAIN_TRACKER, { _class: tracker.class.Issue, component: { $exists: false } }) if (issues.length === 0) { return } for (const issue of issues) { - await client.update(DOMAIN_TRACKER, { _id: issue._id }, { project: null }) + await client.update(DOMAIN_TRACKER, { _id: issue._id }, { component: null }) } } -async function upgradeProjectIcons (tx: TxOperations): Promise { - const projects = await tx.findAll(tracker.class.Project, {}) +async function upgradeComponentIcons (tx: TxOperations): Promise { + const components = await tx.findAll(tracker.class.Component, {}) - if (projects.length === 0) { + if (components.length === 0) { return } - for (const project of projects) { - const icon = project.icon as unknown + for (const component of components) { + const icon = component.icon as unknown if (icon !== undefined) { continue } - await tx.update(project, { icon: tracker.icon.Projects }) + await tx.update(component, { icon: tracker.icon.Components }) } } async function createDefaults (tx: TxOperations): Promise { - await createDefaultTeam(tx) + await createDefaultProject(tx) await createOrUpdate( tx, tags.class.TagCategory, @@ -377,10 +383,10 @@ async function fillRank (client: MigrationClient): Promise { } } -async function upgradeTeams (tx: TxOperations): Promise { - await upgradeTeamIssueStatuses(tx) - await fixTeamsIssueStatusesOrder(tx) - await upgradeTeamSettings(tx) +async function upgradeProjects (tx: TxOperations): Promise { + await upgradeProjectIssueStatuses(tx) + await fixProjectsIssueStatusesOrder(tx) + await upgradeProjectSettings(tx) } async function upgradeIssues (tx: TxOperations): Promise { @@ -408,8 +414,277 @@ async function upgradeIssues (tx: TxOperations): Promise { } } -async function upgradeProjects (tx: TxOperations): Promise { - await upgradeProjectIcons(tx) +async function upgradeComponents (tx: TxOperations): Promise { + await upgradeComponentIcons(tx) +} + +async function renameProject (client: MigrationClient): Promise { + await client.update( + DOMAIN_TRACKER, + { + _class: { $in: [tracker.class.Issue, tracker.class.Sprint] }, + project: { $exists: true } + }, + { + $rename: { project: 'component' } + } + ) + await client.update( + DOMAIN_TX, + { + _class: core.class.TxCollectionCUD, + 'tx._class': core.class.TxCreateDoc, + 'tx.objectClass': tracker.class.Issue, + 'tx.attributes.project': { $exists: true } + }, + { + $rename: { 'tx.attributes.project': 'tx.attributes.component' } + } + ) + await client.update( + DOMAIN_TX, + { + _class: core.class.TxCollectionCUD, + 'tx._class': core.class.TxUpdateDoc, + 'tx.objectClass': tracker.class.Issue, + 'tx.operations.project': { $exists: true } + }, + { + $rename: { 'tx.operations.project': 'tx.operations.component' } + } + ) + await client.update( + DOMAIN_TX, + { + objectClass: tracker.class.Sprint, + _class: core.class.TxCreateDoc, + 'attributes.project': { $exists: true } + }, + { + $rename: { 'attributes.project': 'attributes.component' } + } + ) + await client.update( + DOMAIN_TX, + { + objectClass: { $in: [tracker.class.Issue, tracker.class.Sprint] }, + _class: core.class.TxUpdateDoc, + 'operations.project': { $exists: true } + }, + { + $rename: { 'operations.project': 'operations.component' } + } + ) + + const templates = await client.find(DOMAIN_TRACKER, { + _class: tracker.class.IssueTemplate, + project: { $exists: true } + }) + for (const template of templates) { + const children: IssueTemplateChild[] = template.children.map((p) => { + const res = { + ...p, + component: p.component + } + delete (res as any).project + return res + }) + await client.update( + DOMAIN_TRACKER, + { + _id: template._id + }, + { + children + } + ) + await client.update( + DOMAIN_TRACKER, + { + _id: template._id + }, + { + $rename: { project: 'component' } + } + ) + const createTxes = await client.find>(DOMAIN_TX, { + objectId: template._id, + _class: core.class.TxCreateDoc + }) + for (const createTx of createTxes) { + const children: IssueTemplateChild[] = createTx.attributes.children.map((p) => { + const res = { + ...p, + component: p.component + } + delete (res as any).project + return res + }) + await client.update>( + DOMAIN_TX, + { + _id: createTx._id + }, + { + children + } + ) + await client.update( + DOMAIN_TX, + { + _id: createTx._id + }, + { + $rename: { 'attributes.project': 'attributes.component' } + } + ) + } + const updateTxes = await client.find>(DOMAIN_TX, { + objectId: template._id, + _class: core.class.TxUpdateDoc + }) + for (const updateTx of updateTxes) { + if ((updateTx.operations as any).project !== undefined) { + await client.update( + DOMAIN_TX, + { + _id: updateTx._id + }, + { + $rename: { 'operations.project': 'operations.component' } + } + ) + } + if (updateTx.operations.children !== undefined) { + const children: IssueTemplateChild[] = updateTx.operations.children.map((p) => { + const res = { + ...p, + component: p.component + } + delete (res as any).project + return res + }) + await client.update( + DOMAIN_TX, + { + _id: updateTx._id + }, + { + children + } + ) + } + } + } + + const defaultSpace = ( + await client.find(DOMAIN_SPACE, { + _id: 'tracker:team:DefaultTeam' as Ref + }) + )[0] + if (defaultSpace !== undefined) { + await client.delete(DOMAIN_SPACE, tracker.project.DefaultProject) + await client.create(DOMAIN_SPACE, { + ...defaultSpace, + _id: tracker.project.DefaultProject, + _class: tracker.class.Project, + description: defaultSpace.description === 'Default team' ? 'Default project' : defaultSpace.description + }) + await client.delete(DOMAIN_SPACE, defaultSpace._id) + } + + await client.update( + DOMAIN_SPACE, + { + _id: 'tracker:team:DefaultTeam' as Ref, + _class: 'tracker:class:Team' as Ref> + }, + { + _id: tracker.project.DefaultProject, + _class: tracker.class.Project, + description: 'Default project' + } + ) + + await client.update( + DOMAIN_TRACKER, + { + attachedTo: 'tracker:team:DefaultTeam' as Ref + }, + { + attachedTo: tracker.project.DefaultProject + } + ) + + await client.update( + DOMAIN_TRACKER, + { + space: 'tracker:team:DefaultTeam' as Ref + }, + { + space: tracker.project.DefaultProject + } + ) + + await client.update( + DOMAIN_TRACKER, + { + attachedToClass: 'tracker:class:Team' as Ref> + }, + { + attachedToClass: tracker.class.Project + } + ) + + await client.update( + DOMAIN_TX, + { + objectId: 'tracker:team:DefaultTeam' as Ref + }, + { + objectId: tracker.project.DefaultProject + } + ) + + await client.update( + DOMAIN_TX, + { + objectClass: 'tracker:class:Team' as Ref> + }, + { + objectClass: tracker.class.Project + } + ) + + await client.update( + DOMAIN_TX, + { + 'tx.objectClass': 'tracker:class:Team' as Ref> + }, + { + 'tx.objectClass': tracker.class.Project + } + ) + + await client.update( + DOMAIN_TX, + { + objectSpace: 'tracker:team:DefaultTeam' as Ref + }, + { + objectSpace: tracker.project.DefaultProject + } + ) + + await client.update( + DOMAIN_TX, + { + 'tx.objectSpace': 'tracker:team:DefaultTeam' as Ref + }, + { + 'tx.objectSpace': tracker.project.DefaultProject + } + ) } export const trackerOperation: MigrateOperation = { @@ -423,15 +698,16 @@ export const trackerOperation: MigrateOperation = { reportedTime: 0 } ) - await Promise.all([migrateIssueProjects(client), migrateParentIssues(client)]) + await Promise.all([migrateIssueComponents(client), migrateParentIssues(client)]) await migrateIssueParentInfo(client) await fillRank(client) + await renameProject(client) }, async upgrade (client: MigrationUpgradeClient): Promise { const tx = new TxOperations(client, core.account.System) await createDefaults(tx) - await upgradeTeams(tx) - await upgradeIssues(tx) await upgradeProjects(tx) + await upgradeIssues(tx) + await upgradeComponents(tx) } } diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index 36f2fbc95f..7a4f3024c5 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -26,12 +26,12 @@ import { Application } from '@hcengineering/workbench' export default mergeIds(trackerId, tracker, { string: { TrackerApplication: '' as IntlString, - Teams: '' as IntlString, + Projects: '' as IntlString, GotoIssues: '' as IntlString, GotoActive: '' as IntlString, GotoBacklog: '' as IntlString, GotoBoard: '' as IntlString, - GotoProjects: '' as IntlString, + GotoComponents: '' as IntlString, GotoTrackerApplication: '' as IntlString, SearchIssue: '' as IntlString, Parent: '' as IntlString @@ -61,14 +61,14 @@ export default mergeIds(trackerId, tracker, { actionImpl: { CopyToClipboard: '' as ViewAction, EditWorkflowStatuses: '' as ViewAction, - EditTeam: '' as ViewAction, - DeleteTeam: '' as ViewAction, + EditProject: '' as ViewAction, + DeleteProject: '' as ViewAction, DeleteSprint: '' as ViewAction }, action: { NewRelatedIssue: '' as Ref>>, DeleteSprint: '' as Ref>>, - DeleteTeam: '' as Ref>>, + DeleteProject: '' as Ref>>, SetSprintLead: '' as Ref>> } }) diff --git a/packages/ui/src/components/Timeline.svelte b/packages/ui/src/components/Timeline.svelte index 544449dee0..02c49d2f21 100644 --- a/packages/ui/src/components/Timeline.svelte +++ b/packages/ui/src/components/Timeline.svelte @@ -362,13 +362,13 @@ {#if item.startDate} {@const target = item.targetDate ?? item.startDate + NOT_ENDED}
-
+
{#if item.icon} diff --git a/plugins/recruit-resources/src/components/CreateVacancy.svelte b/plugins/recruit-resources/src/components/CreateVacancy.svelte index 60e1b537a7..4024f29e3d 100644 --- a/plugins/recruit-resources/src/components/CreateVacancy.svelte +++ b/plugins/recruit-resources/src/components/CreateVacancy.svelte @@ -20,7 +20,14 @@ import { Vacancy as VacancyClass } from '@hcengineering/recruit' import tags from '@hcengineering/tags' import task, { createKanban, KanbanTemplate } from '@hcengineering/task' - import tracker, { calcRank, Issue, IssueStatus, IssueTemplate, IssueTemplateData, Team } from '@hcengineering/tracker' + import tracker, { + calcRank, + Issue, + IssueStatus, + IssueTemplate, + IssueTemplateData, + Project + } from '@hcengineering/tracker' import { Button, Component, createFocusManager, EditBox, FocusHandler, IconAttachment } from '@hcengineering/ui' import { createEventDispatcher } from 'svelte' import recruit from '../plugin' @@ -63,7 +70,7 @@ async function saveIssue ( id: Ref, - space: Ref, + space: Ref, template: IssueTemplateData, parent: Ref = tracker.ids.NoParent ): Promise> { @@ -73,7 +80,7 @@ { sort: { rank: SortingOrder.Descending } } ) const incResult = await client.updateDoc( - tracker.class.Team, + tracker.class.Project, core.space.Space, space, { @@ -81,16 +88,16 @@ }, true ) - const team = await client.findOne(tracker.class.Team, { _id: space }) + const project = await client.findOne(tracker.class.Project, { _id: space }) const rank = calcRank(lastOne, undefined) const resId = await client.addCollection(tracker.class.Issue, space, parent, tracker.class.Issue, 'subIssues', { title: template.title + ` (${name})`, description: template.description, assignee: template.assignee, - project: template.project, + component: template.component, sprint: template.sprint, number: (incResult as any).object.sequence, - status: team?.defaultIssueStatus as Ref, + status: project?.defaultIssueStatus as Ref, priority: template.priority, rank, comments: 0, diff --git a/plugins/tracker-assets/assets/icons.svg b/plugins/tracker-assets/assets/icons.svg index fb80e0ca9f..5c30604ca2 100644 --- a/plugins/tracker-assets/assets/icons.svg +++ b/plugins/tracker-assets/assets/icons.svg @@ -22,7 +22,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -125,12 +125,12 @@ - + - + @@ -144,23 +144,23 @@ - + - + - + - + - + diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json index 962da786a2..812234e9a2 100644 --- a/plugins/tracker-assets/lang/en.json +++ b/plugins/tracker-assets/lang/en.json @@ -1,7 +1,7 @@ { "string": { "TrackerApplication": "Tracker", - "Teams": "Your teams", + "Projects": "Your projects", "More": "More", "Default": "Default", "MakeDefault": "Make default", @@ -20,18 +20,18 @@ "BacklogIssues": "Backlog", "Backlog": "Backlog", "Board": "Board", - "Projects": "Projects", - "AllProjects": "All", - "BacklogProjects": "Backlog", - "ActiveProjects": "Active", - "ClosedProjects": "Closed", - "NewProject": "New project", - "CreateProject": "Create project", - "ProjectNamePlaceholder": "Project name", - "ProjectDescriptionPlaceholder": "Description (optional)", - "ProjectStatusPlaceholder": "Change project status...", - "ProjectLead": "Lead", - "ProjectMembers": "Members", + "Components": "Components", + "AllComponents": "All", + "BacklogComponents": "Backlog", + "ActiveComponents": "Active", + "ClosedComponents": "Closed", + "NewComponent": "New component", + "CreateComponent": "Create component", + "ComponentNamePlaceholder": "Component name", + "ComponentDescriptionPlaceholder": "Description (optional)", + "ComponentStatusPlaceholder": "Change component status...", + "ComponentLead": "Lead", + "ComponentMembers": "Members", "StartDate": "Start date", "TargetDate": "Target date", "Planned": "Planned", @@ -39,10 +39,10 @@ "Paused": "Paused", "Completed": "Completed", "Canceled": "Canceled", - "CreateTeam": "Create team", - "NewTeam": "New team", - "TeamTitlePlaceholder": "Team title", - "TeamIdentifierPlaceholder": "Team ID", + "CreateProject": "Create project", + "NewProject": "New project", + "ProjectTitlePlaceholder": "Project title", + "ProjectIdentifierPlaceholder": "Project ID", "ChooseIcon": "Choose icon", "AddIssue": "Add Issue", "NewIssue": "New issue", @@ -90,12 +90,12 @@ "Comments": "Comments", "Attachments": "Attachments", "Labels": "Labels", - "Project": "Project", + "Component": "Component", "Space": "", "SetDueDate": "Set due date\u2026", "ChangeDueDate": "Change due date\u2026", "ModificationDate": "Updated {value}", - "Team": "Team", + "Project": "Project", "Issue": "Issue", "Document": "", "DocumentIcon": "", @@ -108,8 +108,8 @@ "AddIssueTooltip": "Add issue...", "NewIssueDialogClose": "Do you want to close this dialog?", "NewIssueDialogCloseNote": "All changes will be lost", - "RemoveProjectDialogClose": "Delete the project?", - "RemoveProjectDialogCloseNote": "Are you sure you want to delete this project? This operation cannot be undone", + "RemoveComponentDialogClose": "Delete the component?", + "RemoveComponentDialogCloseNote": "Are you sure you want to delete this component? This operation cannot be undone", "DueDatePopupTitle": "Due on {value}", "DueDatePopupOverdueTitle": "Was due on {value}", "DueDatePopupDescription": "{value, plural, =0 {Today} =1 {Tomorrow} other {# days remaining}}", @@ -130,22 +130,22 @@ "CopyIssueBranch": "Copy Git branch name to clipboard", "CopyIssueTitle": "Copy Issue title to clipboard", "AssetLabel": "Asset", - "AddToProject": "Add to project\u2026", - "MoveToProject": "Move to project\u2026", - "NoProject": "No project", - "ProjectLeadTitle": "Project lead", - "ProjectMembersTitle": "Project members", - "ProjectLeadSearchPlaceholder": "Set project lead\u2026", - "ProjectMembersSearchPlaceholder": "Change project members\u2026", + "AddToComponent": "Add to component\u2026", + "MoveToComponent": "Move to component\u2026", + "NoComponent": "No component", + "ComponentLeadTitle": "Component lead", + "ComponentMembersTitle": "Component members", + "ComponentLeadSearchPlaceholder": "Set component lead\u2026", + "ComponentMembersSearchPlaceholder": "Change component members\u2026", "Roadmap": "Roadmap", - "MoveToTeam": "Move to team", + "MoveToProject": "Move to project", "Duplicate": "Duplicate", "GotoIssues": "Go to issues", "GotoActive": "Go to active issues", "GotoBacklog": "Go to backlog", "GotoBoard": "Go to issue board", - "GotoProjects": "Go to projects", + "GotoComponents": "Go to components", "GotoTrackerApplication": "Switch to Tracker Application", "Filter": "Filter", @@ -174,11 +174,11 @@ "EditIssue": "Edit {title}", "EditWorkflowStatuses": "Edit issue statuses", - "EditTeam": "Edit team", - "DeleteTeam": "Delete team", - "DeleteTeamName": "Delete team {name}?", - "TeamHasIssues": "There are existing issues in this team, are you sure that you want to delete? Both the team and the issues will be deleted.", - "ManageWorkflowStatuses": "Manage issue statuses within team", + "EditProject": "Edit project", + "DeleteProject": "Delete project", + "DeleteProjectName": "Delete project {name}?", + "ProjectHasIssues": "There are existing issues in this project, are you sure that you want to delete? Both the project and the issues will be deleted.", + "ManageWorkflowStatuses": "Manage issue statuses within project", "AddWorkflowStatus": "Add issue status", "EditWorkflowStatus": "Edit issue status", "DeleteWorkflowStatus": "Delete issue status", diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index 5b11c56cf6..0c4e903ef8 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -1,7 +1,7 @@ { "string": { "TrackerApplication": "Трекер", - "Teams": "Команды", + "Projects": "Проекты", "More": "Больше", "Default": "По умолчанию", "MakeDefault": "Установить по умолчанию", @@ -20,18 +20,18 @@ "BacklogIssues": "Пул задач", "Backlog": "Пул задач", "Board": "Канбан", - "Projects": "Проекты", - "AllProjects": "Все", - "BacklogProjects": "Пул задач", - "ActiveProjects": "Активные", - "ClosedProjects": "Закрытые", - "NewProject": "Новый проект", - "CreateProject": "Создать проект", - "ProjectNamePlaceholder": "Название проекта", - "ProjectDescriptionPlaceholder": "Описание (необязательно)", - "ProjectStatusPlaceholder": "Сменить статус проекта...", - "ProjectLead": "Руководитель", - "ProjectMembers": "Участники", + "Components": "Компоненты", + "AllComponents": "Все", + "BacklogComponents": "Пул задач", + "ActiveComponents": "Активные", + "ClosedComponents": "Закрытые", + "NewComponent": "Новый компонент", + "CreateComponent": "Создать компонент", + "ComponentNamePlaceholder": "Название компонента", + "ComponentDescriptionPlaceholder": "Описание (необязательно)", + "ComponentStatusPlaceholder": "Сменить статус компонента...", + "ComponentLead": "Руководитель", + "ComponentMembers": "Участники", "StartDate": "Дата начала", "TargetDate": "Дата завершения", "Planned": "Запланирован", @@ -39,10 +39,10 @@ "Paused": "Приостановлен", "Completed": "Завершен", "Canceled": "Отменено", - "CreateTeam": "Создать команду", - "NewTeam": "Новая команда", - "TeamTitlePlaceholder": "Название команды", - "TeamIdentifierPlaceholder": "Идентификатор Команды", + "CreateProject": "Создать проект", + "NewProject": "Новый проект", + "ProjectTitlePlaceholder": "Название проекта", + "ProjectIdentifierPlaceholder": "Идентификатор проекта", "ChooseIcon": "Выбрать иконку", "AddIssue": "Добавить задачу", "NewIssue": "Новая задача", @@ -90,12 +90,12 @@ "Comments": "Комментарии", "Attachments": "Вложения", "Labels": "Метки", - "Project": "Проект", + "Component": "компонент", "Space": "", "SetDueDate": "Указать срок выполнения\u2026", "ChangeDueDate": "Изменить срок выполнения\u2026", "ModificationDate": "Изменено {value}", - "Team": "", + "Project": "Проект", "Issue": "Задача", "Document": "", "DocumentIcon": "", @@ -108,8 +108,8 @@ "AddIssueTooltip": "Добавить задачу\u2026", "NewIssueDialogClose": "Вы действительно хотите закрыть окно?", "NewIssueDialogCloseNote": "Все внесенные изменения будут потеряны", - "RemoveProjectDialogClose": "Удалить проект?", - "RemoveProjectDialogCloseNote": "Уверены, что хотите удалить этот проект? Эта операция не может быть отменена", + "RemoveComponentDialogClose": "Удалить компонент?", + "RemoveComponentDialogCloseNote": "Уверены, что хотите удалить этот компонент? Эта операция не может быть отменена", "DueDatePopupTitle": "Срок {value}", "DueDatePopupOverdueTitle": "Должна была завершится {value}", "DueDatePopupDescription": "{value, plural, =0 {Сегодня} =1 {Завтра} other {# дней осталось}}", @@ -130,22 +130,22 @@ "CopyIssueBranch": "Копировать имя ветки Git в буфер обмена", "CopyIssueTitle": "Копировать имя задачи в буфер обмена", "AssetLabel": "Asset", - "AddToProject": "Добавить в проект\u2026", - "MoveToProject": "Переместить в проект\u2026", - "NoProject": "Без проекта", - "ProjectLeadTitle": "Руководитель проекта", - "ProjectMembersTitle": "Участники проекта", - "ProjectLeadSearchPlaceholder": "Назначьте руководителя проекта\u2026", - "ProjectMembersSearchPlaceholder": "Измененить участников проекта\u2026", + "AddToComponent": "Добавить в компонент\u2026", + "MoveToComponent": "Переместить в компонент\u2026", + "NoComponent": "Без компонента", + "ComponentLeadTitle": "Руководитель компонента", + "ComponentMembersTitle": "Участники компонента", + "ComponentLeadSearchPlaceholder": "Назначьте руководителя компонента\u2026", + "ComponentMembersSearchPlaceholder": "Измененить участников компонента\u2026", "Roadmap": "Планирование", - "MoveToTeam": "Изменить команду", + "MoveToProject": "Изменить проект", "Duplicate": "Дублировать", "GotoIssues": "Перейти к задачам", "GotoActive": "Перейти к активным задачам", "GotoBacklog": "Перейти к пулу задач", "GotoBoard": "Перейти к канбану", - "GotoProjects": "Перейти к проекту", + "GotoComponents": "Перейти к компоненту", "GotoTrackerApplication": "Перейти к приложению Трекер", "Filter": "Фильтр", @@ -174,10 +174,10 @@ "EditIssue": "Редактирование {title}", "EditWorkflowStatuses": "Редактировать статусы задач", - "EditTeam": "Редактировать команду", - "DeleteTeam": "Удалить команду", - "DeleteTeamName": "Удалить команду {name}?", - "TeamHasIssues": "Для данной команды существуют задачи, уверены, что хотите удалить? Задачи и команда будут удалены.", + "EditProject": "Редактировать проект", + "DeleteProject": "Удалить проект", + "DeleteProjectName": "Удалить проект {name}?", + "ProjectHasIssues": "Для данного проекта существуют задачи, уверены, что хотите удалить? Задачи и проект будут удалены.", "ManageWorkflowStatuses": "Управлять статусами задач для команды", "AddWorkflowStatus": "Добавить статус задачи", "EditWorkflowStatus": "Редактировать статус задачи", diff --git a/plugins/tracker-assets/src/index.ts b/plugins/tracker-assets/src/index.ts index 04f477271a..6f504063e5 100644 --- a/plugins/tracker-assets/src/index.ts +++ b/plugins/tracker-assets/src/index.ts @@ -19,15 +19,15 @@ import tracker, { trackerId } from '@hcengineering/tracker' const icons = require('../assets/icons.svg') as string // eslint-disable-line loadMetadata(tracker.icon, { TrackerApplication: `${icons}#tracker`, - Project: `${icons}#project`, + Component: `${icons}#component`, Issue: `${icons}#issue`, - Team: `${icons}#team`, + Project: `${icons}#project`, Document: `${icons}#document`, Inbox: `${icons}#inbox`, MyIssues: `${icons}#myissues`, Views: `${icons}#views`, Issues: `${icons}#myissues`, - Projects: `${icons}#projects`, + Components: `${icons}#components`, NewIssue: `${icons}#newissue`, Magnifier: `${icons}#magnifier`, Home: `${icons}#home`, @@ -51,22 +51,22 @@ loadMetadata(tracker.icon, { PriorityMedium: `${icons}#priority-medium`, PriorityLow: `${icons}#priority-low`, - ProjectsList: `${icons}#list`, - ProjectsTimeline: `${icons}#timeline`, - ProjectMembers: `${icons}#projectMembers`, + ComponentsList: `${icons}#list`, + ComponentsTimeline: `${icons}#timeline`, + ComponentMembers: `${icons}#componentMembers`, - ProjectStatusBacklog: `${icons}#project-status-backlog`, - ProjectStatusPlanned: `${icons}#project-status-planned`, - ProjectStatusInProgress: `${icons}#project-status-in-progress`, - ProjectStatusPaused: `${icons}#project-status-paused`, - ProjectStatusCompleted: `${icons}#project-status-completed`, - ProjectStatusCanceled: `${icons}#project-status-canceled`, + ComponentStatusBacklog: `${icons}#component-status-backlog`, + ComponentStatusPlanned: `${icons}#component-status-planned`, + ComponentStatusInProgress: `${icons}#component-status-in-progress`, + ComponentStatusPaused: `${icons}#component-status-paused`, + ComponentStatusCompleted: `${icons}#component-status-completed`, + ComponentStatusCanceled: `${icons}#component-status-canceled`, - SprintStatusPlanned: `${icons}#project-status-planned`, - SprintStatusInProgress: `${icons}#project-status-in-progress`, - SprintStatusPaused: `${icons}#project-status-paused`, - SprintStatusCompleted: `${icons}#project-status-completed`, - SprintStatusCanceled: `${icons}#project-status-canceled`, + SprintStatusPlanned: `${icons}#component-status-planned`, + SprintStatusInProgress: `${icons}#component-status-in-progress`, + SprintStatusPaused: `${icons}#component-status-paused`, + SprintStatusCompleted: `${icons}#component-status-completed`, + SprintStatusCanceled: `${icons}#component-status-canceled`, CopyID: `${icons}#copyID`, CopyURL: `${icons}#copyURL`, diff --git a/plugins/tracker-resources/src/components/ProjectSelector.svelte b/plugins/tracker-resources/src/components/ComponentSelector.svelte similarity index 59% rename from plugins/tracker-resources/src/components/ProjectSelector.svelte rename to plugins/tracker-resources/src/components/ComponentSelector.svelte index f8d5b539f1..c831b584aa 100644 --- a/plugins/tracker-resources/src/components/ProjectSelector.svelte +++ b/plugins/tracker-resources/src/components/ComponentSelector.svelte @@ -16,16 +16,16 @@ import { Ref, SortingOrder } from '@hcengineering/core' import { getEmbeddedLabel, IntlString, translate } from '@hcengineering/platform' import { createQuery } from '@hcengineering/presentation' - import { Project } from '@hcengineering/tracker' + import { Component } from '@hcengineering/tracker' import type { ButtonKind, ButtonSize } from '@hcengineering/ui' import { Button, ButtonShape, eventToHTMLElement, SelectPopup, showPopup, Label } from '@hcengineering/ui' import tracker from '../plugin' - export let value: Ref | null | undefined + export let value: Ref | null | undefined export let shouldShowLabel: boolean = true export let isEditable: boolean = true - export let onChange: ((newProjectId: Ref | undefined) => void) | undefined = undefined - export let popupPlaceholder: IntlString = tracker.string.AddToProject + export let onChange: ((newComponentId: Ref | undefined) => void) | undefined = undefined + export let popupPlaceholder: IntlString = tracker.string.AddToComponent export let kind: ButtonKind = 'no-border' export let size: ButtonSize = 'small' export let shape: ButtonShape = undefined @@ -34,17 +34,17 @@ export let onlyIcon: boolean = false export let enlargedText = false - let selectedProject: Project | undefined - let defaultProjectLabel = '' + let selectedComponent: Component | undefined + let defaultComponentLabel = '' const query = createQuery() - let rawProjects: Project[] = [] + let rawComponents: Component[] = [] let loading = true query.query( - tracker.class.Project, + tracker.class.Component, {}, (res) => { - rawProjects = res + rawComponents = res loading = false }, { @@ -52,58 +52,61 @@ } ) - $: handleSelectedProjectIdUpdated(value, rawProjects) + $: handleSelectedComponentIdUpdated(value, rawComponents) - $: translate(tracker.string.Project, {}).then((result) => (defaultProjectLabel = result)) - $: projectIcon = selectedProject?.icon ?? tracker.icon.Projects - $: projectText = shouldShowLabel ? selectedProject?.label ?? defaultProjectLabel : undefined + $: translate(tracker.string.Component, {}).then((result) => (defaultComponentLabel = result)) + $: componentIcon = selectedComponent?.icon ?? tracker.icon.Components + $: componentText = shouldShowLabel ? selectedComponent?.label ?? defaultComponentLabel : undefined - const handleSelectedProjectIdUpdated = async (newProjectId: Ref | null | undefined, projects: Project[]) => { - if (newProjectId === null || newProjectId === undefined) { - selectedProject = undefined + const handleSelectedComponentIdUpdated = async ( + newComponentId: Ref | null | undefined, + components: Component[] + ) => { + if (newComponentId === null || newComponentId === undefined) { + selectedComponent = undefined return } - selectedProject = projects.find((it) => it._id === newProjectId) + selectedComponent = components.find((it) => it._id === newComponentId) } - const handleProjectEditorOpened = async (event: MouseEvent): Promise => { + const handleComponentEditorOpened = async (event: MouseEvent): Promise => { event.stopPropagation() if (!isEditable) { return } - const projectsInfo = [ - { id: null, icon: tracker.icon.Projects, label: tracker.string.NoProject, isSelected: !selectedProject }, - ...rawProjects.map((p) => ({ + const componentsInfo = [ + { id: null, icon: tracker.icon.Components, label: tracker.string.NoComponent, isSelected: !selectedComponent }, + ...rawComponents.map((p) => ({ id: p._id, icon: p.icon, text: p.label, - isSelected: selectedProject ? p._id === selectedProject._id : false + isSelected: selectedComponent ? p._id === selectedComponent._id : false })) ] showPopup( SelectPopup, - { value: projectsInfo, placeholder: popupPlaceholder, searchable: true }, + { value: componentsInfo, placeholder: popupPlaceholder, searchable: true }, eventToHTMLElement(event), onChange ) } -{#if onlyIcon || projectText === undefined} +{#if onlyIcon || componentText === undefined} diff --git a/plugins/tracker-resources/src/components/CreateIssue.svelte b/plugins/tracker-resources/src/components/CreateIssue.svelte index b097fc50cf..a4058b8a60 100644 --- a/plugins/tracker-resources/src/components/CreateIssue.svelte +++ b/plugins/tracker-resources/src/components/CreateIssue.svelte @@ -46,9 +46,9 @@ IssuePriority, IssueStatus, IssueTemplate, - Project, + Component as ComponentType, Sprint, - Team + Project } from '@hcengineering/tracker' import { ActionIcon, @@ -68,7 +68,7 @@ import { ObjectBox } from '@hcengineering/view-resources' import { deepEqual } from 'fast-equals' import { createEventDispatcher } from 'svelte' - import { activeProject, activeSprint, generateIssueShortLink, getIssueId, updateIssueRelation } from '../issues' + import { activeComponent, activeSprint, generateIssueShortLink, getIssueId, updateIssueRelation } from '../issues' import tracker from '../plugin' import AssigneeEditor from './issues/AssigneeEditor.svelte' import IssueNotification from './issues/IssueNotification.svelte' @@ -76,17 +76,17 @@ import PriorityEditor from './issues/PriorityEditor.svelte' import StatusEditor from './issues/StatusEditor.svelte' import EstimationEditor from './issues/timereport/EstimationEditor.svelte' - import ProjectSelector from './ProjectSelector.svelte' + import ComponentSelector from './ComponentSelector.svelte' import SetDueDateActionPopup from './SetDueDateActionPopup.svelte' import SetParentIssueActionPopup from './SetParentIssueActionPopup.svelte' import SprintSelector from './sprints/SprintSelector.svelte' import SubIssues from './SubIssues.svelte' - export let space: Ref + export let space: Ref export let status: Ref | undefined = undefined export let priority: IssuePriority = IssuePriority.NoPriority export let assignee: Ref | null = null - export let project: Ref | null = $activeProject ?? null + export let component: Ref | null = $activeComponent ?? null export let sprint: Ref | null = $activeSprint ?? null export let relatedTo: Doc | undefined export let shouldSaveDraft: boolean = false @@ -102,7 +102,7 @@ let labels: TagReference[] = draft?.labels || [] let objectId: Ref = draft?.issueId || generateId() let saveTimer: number | undefined - let currentTeam: Team | undefined + let currentProject: Project | undefined function toIssue (initials: AttachedData, draft: IssueDraft | undefined): AttachedData { if (draft === undefined) { @@ -116,7 +116,7 @@ title: '', description: '', assignee: '' as Ref, - project, + component, sprint, number: 0, rank: '', @@ -152,8 +152,8 @@ subIssues = [] labels = [] if (!originalIssue && !draft) { - updateIssueStatusId(currentTeam, status) - updateAssigneeId(currentTeam) + updateIssueStatusId(currentProject, status) + updateAssigneeId(currentProject) } } @@ -197,7 +197,7 @@ const { _class, _id, space, children, comments, attachments, labels: labels_, ...templBase } = template subIssues = template.children.map((p) => { - return { ...p, status: currentTeam?.defaultIssueStatus ?? ('' as Ref) } + return { ...p, status: currentProject?.defaultIssueStatus ?? ('' as Ref) } }) object = { @@ -231,9 +231,9 @@ attr: client.getHierarchy().getAttribute(tracker.class.Issue, 'labels') } - $: _space = draft?.team || space - $: !originalIssue && !draft && updateIssueStatusId(currentTeam, status) - $: !originalIssue && !draft && updateAssigneeId(currentTeam) + $: _space = draft?.project || space + $: !originalIssue && !draft && updateIssueStatusId(currentProject, status) + $: !originalIssue && !draft && updateAssigneeId(currentProject) $: canSave = getTitle(object.title ?? '').length > 0 $: statusesQuery.query( @@ -247,8 +247,8 @@ sort: { rank: SortingOrder.Ascending } } ) - $: spaceQuery.query(tracker.class.Team, { _id: _space }, (res) => { - currentTeam = res.shift() + $: spaceQuery.query(tracker.class.Project, { _id: _space }, (res) => { + currentProject = res.shift() }) async function setPropsFromOriginalIssue () { @@ -307,20 +307,20 @@ } } - async function updateIssueStatusId (currentTeam: Team | undefined, issueStatusId?: Ref) { + async function updateIssueStatusId (currentProject: Project | undefined, issueStatusId?: Ref) { if (issueStatusId !== undefined) { object.status = issueStatusId return } - if (currentTeam?.defaultIssueStatus) { - object.status = currentTeam.defaultIssueStatus + if (currentProject?.defaultIssueStatus) { + object.status = currentProject.defaultIssueStatus } } - function updateAssigneeId (currentTeam: Team | undefined) { - if (currentTeam?.defaultAssignee !== undefined) { - object.assignee = currentTeam.defaultAssignee + function updateAssigneeId (currentProject: Project | undefined) { + if (currentProject?.defaultAssignee !== undefined) { + object.assignee = currentProject.defaultAssignee } else { object.assignee = null } @@ -357,7 +357,7 @@ return false } - if (draft.project && draft.project !== defaultIssue.project) { + if (draft.component && draft.component !== defaultIssue.component) { return false } @@ -369,16 +369,16 @@ return true } - if (currentTeam?.defaultIssueStatus) { - return draft.status === currentTeam.defaultIssueStatus + if (currentProject?.defaultIssueStatus) { + return draft.status === currentProject.defaultIssueStatus } if (draft.assignee === null) { return true } - if (currentTeam?.defaultAssignee) { - return draft.assignee === currentTeam.defaultAssignee + if (currentProject?.defaultAssignee) { + return draft.assignee === currentProject.defaultAssignee } return false @@ -394,7 +394,7 @@ title: getTitle(object.title), description: (object.description as string).replaceAll('

', ''), assignee: object.assignee, - project: object.project, + component: object.component, sprint: object.sprint, status: object.status, priority: object.priority, @@ -404,7 +404,7 @@ attachments: object.attachments, labels, parentIssue: parentIssue?._id, - team: _space, + project: _space, subIssues } @@ -426,7 +426,7 @@ const lastOne = await client.findOne(tracker.class.Issue, {}, { sort: { rank: SortingOrder.Descending } }) const incResult = await client.updateDoc( - tracker.class.Team, + tracker.class.Project, core.space.Space, _space, { @@ -439,7 +439,7 @@ title: getTitle(object.title), description: object.description, assignee: object.assignee, - project: object.project, + component: object.component, sprint: object.sprint, number: (incResult as any).object.sequence, status: object.status, @@ -498,7 +498,7 @@ addNotification(await translate(tracker.string.IssueCreated, {}), getTitle(object.title), IssueNotification, { issueId: objectId, subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase(), - issueUrl: currentTeam && generateIssueShortLink(getIssueId(currentTeam, value as Issue)) + issueUrl: currentProject && generateIssueShortLink(getIssueId(currentProject, value as Issue)) }) objectId = generateId() @@ -550,25 +550,25 @@ ) } - const handleProjectIdChanged = (projectId: Ref | null | undefined) => { - if (projectId === undefined) { + const handleComponentIdChanged = (componentId: Ref | null | undefined) => { + if (componentId === undefined) { return } - object = { ...object, project: projectId } + object = { ...object, component: componentId } } const handleSprintIdChanged = async (sprintId: Ref | null | undefined) => { if (sprintId === undefined) { return } - let projectSprintId: Ref | null + let componentSprintId: Ref | null if (sprintId != null) { const sprint = await client.findOne(tracker.class.Sprint, { _id: sprintId }) - projectSprintId = sprint && sprint.project ? sprint.project : null - } else projectSprintId = null + componentSprintId = sprint && sprint.component ? sprint.component : null + } else componentSprintId = null - object = { ...object, sprint: sprintId, project: projectSprintId } + object = { ...object, sprint: sprintId, component: componentSprintId } } function addTagRef (tag: TagElement): void { @@ -640,7 +640,7 @@ >
- +
{/if} @@ -752,12 +752,12 @@ labels = labels.filter((it) => it._id !== evt.detail) }} /> - - + + {#if object.dueDate !== null} diff --git a/plugins/tracker-resources/src/components/NewIssueHeader.svelte b/plugins/tracker-resources/src/components/NewIssueHeader.svelte index bf482fe6ce..f825f9fbcf 100644 --- a/plugins/tracker-resources/src/components/NewIssueHeader.svelte +++ b/plugins/tracker-resources/src/components/NewIssueHeader.svelte @@ -38,14 +38,14 @@ return } - const team = await client.findOne(tracker.class.Team, {}) - space = team?._id + const project = await client.findOne(tracker.class.Project, {}) + space = project?._id } async function newIssue (): Promise { if (!space) { - const team = await client.findOne(tracker.class.Team, {}) - space = team?._id + const project = await client.findOne(tracker.class.Project, {}) + space = project?._id } showPopup(CreateIssue, { space, shouldSaveDraft: true, onDraftChanged: handleDraftChanged }, 'top') diff --git a/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte b/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte index d0ab4b5af4..63d910e79b 100644 --- a/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte +++ b/plugins/tracker-resources/src/components/SetParentIssueActionPopup.svelte @@ -28,7 +28,7 @@ const dispatch = createEventDispatcher() const options: FindOptions = { lookup: { - space: tracker.class.Team, + space: tracker.class.Project, status: [tracker.class.IssueStatus, { category: tracker.class.IssueStatusCategory }] }, sort: { modifiedOn: SortingOrder.Descending } diff --git a/plugins/tracker-resources/src/components/SubIssues.svelte b/plugins/tracker-resources/src/components/SubIssues.svelte index a7d25e75b9..e8bf21a1c1 100644 --- a/plugins/tracker-resources/src/components/SubIssues.svelte +++ b/plugins/tracker-resources/src/components/SubIssues.svelte @@ -24,9 +24,9 @@ Issue, IssueParentInfo, IssueStatus, - Project, + Component, Sprint, - Team + Project } from '@hcengineering/tracker' import { Button, closeTooltip, ExpandCollapse, IconAdd, Scroller } from '@hcengineering/ui' import { onDestroy } from 'svelte' @@ -37,10 +37,10 @@ import DraftIssueChildList from './templates/DraftIssueChildList.svelte' export let parent: Ref - export let teamId: Ref - export let team: Team | undefined + export let projectId: Ref + export let project: Project | undefined export let sprint: Ref | null = null - export let project: Ref | null = null + export let component: Ref | null = null export let subIssues: DraftIssueChild[] = [] export let statuses: WithLookup[] @@ -60,15 +60,15 @@ const client = getClient() export async function save (parents: IssueParentInfo[]) { - if (team === undefined) return + if (project === undefined) return saved = true for (const subIssue of subIssues) { const lastOne = await client.findOne(tracker.class.Issue, {}, { sort: { rank: SortingOrder.Descending } }) const incResult = await client.updateDoc( - tracker.class.Team, + tracker.class.Project, core.space.Space, - team._id, + project._id, { $inc: { sequence: 1 } }, @@ -79,7 +79,7 @@ title: subIssue.title.trim(), description: subIssue.description, assignee: subIssue.assignee, - project: subIssue.project, + component: subIssue.component, sprint: subIssue.sprint, number: (incResult as any).object.sequence, status: subIssue.status, @@ -98,7 +98,7 @@ await client.addCollection( tracker.class.Issue, - team._id, + project._id, parent, tracker.class.Issue, 'subIssues', @@ -109,7 +109,7 @@ if ((subIssue.labels?.length ?? 0) > 0) { const tagElements = await client.findAll(tags.class.TagElement, { _id: { $in: subIssue.labels } }) for (const label of tagElements) { - await client.addCollection(tags.class.TagReference, team._id, childId, tracker.class.Issue, 'labels', { + await client.addCollection(tags.class.TagReference, project._id, childId, tracker.class.Issue, 'labels', { title: label.title, color: label.color, tag: label._id @@ -133,7 +133,7 @@ async function saveAttachment (doc: Attachment, issue: Ref): Promise { await client.addCollection( attachment.class.Attachment, - teamId, + projectId, issue, tracker.class.Issue, 'attachments', @@ -208,10 +208,10 @@ @@ -219,12 +219,12 @@
{/if} -{#if isCreating && team} +{#if isCreating && project} { isCreating = false diff --git a/plugins/tracker-resources/src/components/projects/ProjectBrowser.svelte b/plugins/tracker-resources/src/components/components/ComponentBrowser.svelte similarity index 62% rename from plugins/tracker-resources/src/components/projects/ProjectBrowser.svelte rename to plugins/tracker-resources/src/components/components/ComponentBrowser.svelte index b2e46613d2..a82cb361db 100644 --- a/plugins/tracker-resources/src/components/projects/ProjectBrowser.svelte +++ b/plugins/tracker-resources/src/components/components/ComponentBrowser.svelte @@ -17,58 +17,58 @@ import { DocumentQuery, FindOptions, SortingOrder } from '@hcengineering/core' import { IntlString } from '@hcengineering/platform' import { createQuery } from '@hcengineering/presentation' - import { Project } from '@hcengineering/tracker' + import { Component } from '@hcengineering/tracker' import { Button, IconAdd, Label, showPopup, TabList } from '@hcengineering/ui' import type { TabItem } from '@hcengineering/ui' import tracker from '../../plugin' import view from '@hcengineering/view' - import { getIncludedProjectStatuses, projectsTitleMap, ProjectsViewMode } from '../../utils' - import NewProject from './NewProject.svelte' - import ProjectsListBrowser from './ProjectsListBrowser.svelte' + import { getIncludedComponentStatuses, componentsTitleMap, ComponentsViewMode } from '../../utils' + import NewComponent from './NewComponent.svelte' + import ComponentsListBrowser from './ComponentsListBrowser.svelte' export let label: IntlString - export let query: DocumentQuery = {} + export let query: DocumentQuery = {} export let search: string = '' - export let mode: ProjectsViewMode = 'all' + export let mode: ComponentsViewMode = 'all' export let viewMode: 'list' | 'timeline' = 'list' const ENTRIES_LIMIT = 200 - const resultProjectsQuery = createQuery() + const resultComponentsQuery = createQuery() - const projectOptions: FindOptions = { + const componentOptions: FindOptions = { sort: { modifiedOn: SortingOrder.Descending }, limit: ENTRIES_LIMIT, lookup: { lead: contact.class.Employee, members: contact.class.Employee } } - let resultProjects: Project[] = [] + let resultComponents: Component[] = [] - $: includedProjectStatuses = getIncludedProjectStatuses(mode) - $: title = projectsTitleMap[mode] - $: includedProjectsQuery = { status: { $in: includedProjectStatuses } } + $: includedComponentStatuses = getIncludedComponentStatuses(mode) + $: title = componentsTitleMap[mode] + $: includedComponentsQuery = { status: { $in: includedComponentStatuses } } $: baseQuery = { - ...includedProjectsQuery, + ...includedComponentsQuery, ...query } $: resultQuery = search === '' ? baseQuery : { $search: search, ...baseQuery } - $: resultProjectsQuery.query( - tracker.class.Project, + $: resultComponentsQuery.query( + tracker.class.Component, { ...resultQuery }, (result) => { - resultProjects = result + resultComponents = result }, - projectOptions + componentOptions ) - const space = typeof query.space === 'string' ? query.space : tracker.team.DefaultTeam + const space = typeof query.space === 'string' ? query.space : tracker.project.DefaultProject const showCreateDialog = async () => { - showPopup(NewProject, { space, targetElement: null }, 'top') + showPopup(NewComponent, { space, targetElement: null }, 'top') } - const handleViewModeChanged = (newMode: ProjectsViewMode) => { + const handleViewModeChanged = (newMode: ComponentsViewMode) => { if (newMode === undefined || newMode === mode) { return } @@ -77,27 +77,27 @@ } const modeList: TabItem[] = [ - { id: 'all', labelIntl: tracker.string.AllProjects, action: () => handleViewModeChanged('all') }, - { id: 'backlog', labelIntl: tracker.string.BacklogProjects, action: () => handleViewModeChanged('backlog') }, - { id: 'active', labelIntl: tracker.string.ActiveProjects, action: () => handleViewModeChanged('active') }, - { id: 'closed', labelIntl: tracker.string.ClosedProjects, action: () => handleViewModeChanged('closed') } + { id: 'all', labelIntl: tracker.string.AllComponents, action: () => handleViewModeChanged('all') }, + { id: 'backlog', labelIntl: tracker.string.BacklogComponents, action: () => handleViewModeChanged('backlog') }, + { id: 'active', labelIntl: tracker.string.ActiveComponents, action: () => handleViewModeChanged('active') }, + { id: 'closed', labelIntl: tracker.string.ClosedComponents, action: () => handleViewModeChanged('closed') } ] const viewList: TabItem[] = [ { id: 'list', icon: view.icon.List, tooltip: view.string.List }, { id: 'timeline', icon: view.icon.Timeline, tooltip: view.string.Timeline } ] - const retrieveMembers = (p: Project) => p.members + const retrieveMembers = (p: Component) => p.members
@@ -110,8 +110,7 @@ }} /> -{#if (value.project && value.project !== $activeProject && groupBy !== 'project') || shouldShowPlaceholder} +{#if (value.component && value.component !== $activeComponent && groupBy !== 'component') || shouldShowPlaceholder}
-
{/if} diff --git a/plugins/tracker-resources/src/components/projects/ProjectPopup.svelte b/plugins/tracker-resources/src/components/components/ComponentPopup.svelte similarity index 77% rename from plugins/tracker-resources/src/components/projects/ProjectPopup.svelte rename to plugins/tracker-resources/src/components/components/ComponentPopup.svelte index 3025256156..c2866a072a 100644 --- a/plugins/tracker-resources/src/components/projects/ProjectPopup.svelte +++ b/plugins/tracker-resources/src/components/components/ComponentPopup.svelte @@ -15,12 +15,12 @@ @@ -46,6 +46,6 @@ on:close > - + diff --git a/plugins/tracker-resources/src/components/components/ComponentPresenter.svelte b/plugins/tracker-resources/src/components/components/ComponentPresenter.svelte new file mode 100644 index 0000000000..727ac19fff --- /dev/null +++ b/plugins/tracker-resources/src/components/components/ComponentPresenter.svelte @@ -0,0 +1,55 @@ + + + +{#if value} + +
+ {#if withIcon} +
+ +
+ {/if} + + {value.label} + +
+{/if} diff --git a/plugins/tracker-resources/src/components/components/ComponentStatusEditor.svelte b/plugins/tracker-resources/src/components/components/ComponentStatusEditor.svelte new file mode 100644 index 0000000000..634b0f7c84 --- /dev/null +++ b/plugins/tracker-resources/src/components/components/ComponentStatusEditor.svelte @@ -0,0 +1,8 @@ + + + diff --git a/plugins/tracker-resources/src/components/projects/ProjectStatusPresenter.svelte b/plugins/tracker-resources/src/components/components/ComponentStatusPresenter.svelte similarity index 78% rename from plugins/tracker-resources/src/components/projects/ProjectStatusPresenter.svelte rename to plugins/tracker-resources/src/components/components/ComponentStatusPresenter.svelte index 87b4f6c55d..e21310e676 100644 --- a/plugins/tracker-resources/src/components/projects/ProjectStatusPresenter.svelte +++ b/plugins/tracker-resources/src/components/components/ComponentStatusPresenter.svelte @@ -13,14 +13,14 @@ // limitations under the License. --> {#if value} - {/if} diff --git a/plugins/tracker-resources/src/components/projects/ProjectStatusSelector.svelte b/plugins/tracker-resources/src/components/components/ComponentStatusSelector.svelte similarity index 66% rename from plugins/tracker-resources/src/components/projects/ProjectStatusSelector.svelte rename to plugins/tracker-resources/src/components/components/ComponentStatusSelector.svelte index 836f8d4120..bad7240481 100644 --- a/plugins/tracker-resources/src/components/projects/ProjectStatusSelector.svelte +++ b/plugins/tracker-resources/src/components/components/ComponentStatusSelector.svelte @@ -13,15 +13,16 @@ // limitations under the License. --> @@ -64,5 +65,5 @@ icon={selectedStatusIcon} label={selectedStatusLabel} {showTooltip} - on:click={handleProjectStatusEditorOpened} + on:click={handleComponentStatusEditorOpened} /> diff --git a/plugins/tracker-resources/src/components/projects/ProjectsTimeline.svelte b/plugins/tracker-resources/src/components/components/ComponentTimeline.svelte similarity index 89% rename from plugins/tracker-resources/src/components/projects/ProjectsTimeline.svelte rename to plugins/tracker-resources/src/components/components/ComponentTimeline.svelte index aa01c9f855..928f13ebb8 100644 --- a/plugins/tracker-resources/src/components/projects/ProjectsTimeline.svelte +++ b/plugins/tracker-resources/src/components/components/ComponentTimeline.svelte @@ -16,19 +16,19 @@ import contact from '@hcengineering/contact' import { Class, Doc, FindOptions, getObjectValue, Ref, Timestamp } from '@hcengineering/core' import { getClient } from '@hcengineering/presentation' - import { Issue, Project } from '@hcengineering/tracker' + import { Issue, Component } from '@hcengineering/tracker' import { CheckBox, Spinner, Timeline, TimelineRow } from '@hcengineering/ui' import { AttributeModel, BuildModelKey } from '@hcengineering/view' import { buildModel, LoadingProps } from '@hcengineering/view-resources' import { createEventDispatcher } from 'svelte' import tracker from '../../plugin' - import ProjectPresenter from './ProjectPresenter.svelte' + import ComponentPresenter from './ComponentPresenter.svelte' export let _class: Ref> export let itemsConfig: (BuildModelKey | string)[] export let selectedObjectIds: Doc[] = [] export let selectedRowIndex: number | undefined = undefined - export let projects: Project[] | undefined = undefined + export let components: Component[] | undefined = undefined export let loadingProps: LoadingProps | undefined = undefined const dispatch = createEventDispatcher() @@ -42,13 +42,13 @@ } } - $: options = { ...baseOptions } as FindOptions + $: options = { ...baseOptions } as FindOptions $: selectedObjectIdsSet = new Set>(selectedObjectIds.map((it) => it._id)) let selectedRows: number[] = [] - $: if (selectedObjectIdsSet.size > 0 && projects !== undefined) { + $: if (selectedObjectIdsSet.size > 0 && components !== undefined) { const tRows: number[] = [] selectedObjectIdsSet.forEach((it) => { - const index = projects?.findIndex((f) => f._id === it) + const index = components?.findIndex((f) => f._id === it) if (index !== undefined) tRows.push(index) }) selectedRows = tRows @@ -63,16 +63,16 @@ } export const onElementSelected = (offset: 1 | -1 | 0, docObject?: Doc) => { - if (!projects) return + if (!components) return let position = - (docObject !== undefined ? projects?.findIndex((x) => x._id === docObject?._id) : selectedRowIndex) ?? -1 + (docObject !== undefined ? components?.findIndex((x) => x._id === docObject?._id) : selectedRowIndex) ?? -1 position += offset if (position < 0) position = 0 - if (position >= projects.length) position = projects.length - 1 + if (position >= components.length) position = components.length - 1 selectedRowIndex = position - handleRowFocused(projects[position]) + handleRowFocused(components[position]) // if (objectRef) { // objectRef.scrollIntoView({ behavior: 'auto', block: 'nearest' }) @@ -91,12 +91,12 @@ $: buildModel({ client, _class, keys: itemsConfig, lookup: options.lookup }).then((res) => (itemModels = res)) let lines: TimelineRow[] | undefined - $: lines = projects?.map((proj) => { + $: lines = components?.map((proj) => { const tR: TimelineRow = { items: [] } tR.items = [ { icon: proj.icon, - presenter: ProjectPresenter, + presenter: ComponentPresenter, props: { value: proj }, startDate: proj.startDate as Timestamp, targetDate: proj.targetDate as Timestamp @@ -106,16 +106,18 @@ }) -{#if projects && itemModels && lines} +{#if components && itemModels && lines} { - if (ev.detail !== undefined && projects !== undefined) handleRowFocused(projects[ev.detail]) + if (ev.detail !== undefined && components !== undefined) handleRowFocused(components[ev.detail]) }} on:check={(ev) => { - if (ev.detail !== undefined && projects !== undefined) onObjectChecked([projects[ev.detail.row]], ev.detail.value) + if (ev.detail !== undefined && components !== undefined) { + onObjectChecked([components[ev.detail.row]], ev.detail.value) + } }} > @@ -125,16 +127,16 @@
{:else if attributeModelIndex === 1} -
+
@@ -143,8 +145,8 @@
@@ -500,7 +502,7 @@ margin-left: 0; } } - .projectPresenter { + .componentPresenter { display: flex; align-items: center; flex-shrink: 0; diff --git a/plugins/tracker-resources/src/components/projects/ProjectTitlePresenter.svelte b/plugins/tracker-resources/src/components/components/ComponentTitlePresenter.svelte similarity index 83% rename from plugins/tracker-resources/src/components/projects/ProjectTitlePresenter.svelte rename to plugins/tracker-resources/src/components/components/ComponentTitlePresenter.svelte index 6de9eb4756..c18f60be32 100644 --- a/plugins/tracker-resources/src/components/projects/ProjectTitlePresenter.svelte +++ b/plugins/tracker-resources/src/components/components/ComponentTitlePresenter.svelte @@ -13,16 +13,16 @@ // limitations under the License. --> {#if value} - +
{value.label}
= {} + export let label: IntlString = tracker.string.Components + export let query: DocumentQuery = {} export let search: string = '' - export let mode: ProjectsViewMode = 'all' + export let mode: ComponentsViewMode = 'all' - let projectId: Ref | undefined - let project: Project | undefined + let componentId: Ref | undefined + let component: Component | undefined onDestroy( location.subscribe(async (loc) => { closeTooltip() closePopup() - projectId = loc.path[5] as Ref + componentId = loc.path[5] as Ref }) ) - const projectQuery = createQuery() - $: if (projectId !== undefined) { - projectQuery.query(tracker.class.Project, { _id: projectId }, (result) => { - project = result.shift() + const componentQuery = createQuery() + $: if (componentId !== undefined) { + componentQuery.query(tracker.class.Component, { _id: componentId }, (result) => { + component = result.shift() }) } else { - projectQuery.unsubscribe() - project = undefined + componentQuery.unsubscribe() + component = undefined } -{#if project} - { +{#if component} + { const loc = getCurrentLocation() loc.path[5] = evt.detail navigate(loc) }} /> {:else} - + {/if} diff --git a/plugins/tracker-resources/src/components/projects/ProjectsList.svelte b/plugins/tracker-resources/src/components/components/ComponentsList.svelte similarity index 87% rename from plugins/tracker-resources/src/components/projects/ProjectsList.svelte rename to plugins/tracker-resources/src/components/components/ComponentsList.svelte index bfb0b673e1..cfb2f49731 100644 --- a/plugins/tracker-resources/src/components/projects/ProjectsList.svelte +++ b/plugins/tracker-resources/src/components/components/ComponentsList.svelte @@ -16,7 +16,7 @@ import contact from '@hcengineering/contact' import { Class, Doc, FindOptions, getObjectValue, Ref } from '@hcengineering/core' import { getClient } from '@hcengineering/presentation' - import { Issue, Project } from '@hcengineering/tracker' + import { Issue, Component } from '@hcengineering/tracker' import { CheckBox, Spinner, tooltip } from '@hcengineering/ui' import { BuildModelKey } from '@hcengineering/view' import { buildModel, LoadingProps } from '@hcengineering/view-resources' @@ -27,7 +27,7 @@ export let itemsConfig: (BuildModelKey | string)[] export let selectedObjectIds: Doc[] = [] export let selectedRowIndex: number | undefined = undefined - export let projects: Project[] | undefined = undefined + export let components: Component[] | undefined = undefined export let loadingProps: LoadingProps | undefined = undefined const dispatch = createEventDispatcher() @@ -42,9 +42,9 @@ } } - $: options = { ...baseOptions } as FindOptions + $: options = { ...baseOptions } as FindOptions $: selectedObjectIdsSet = new Set>(selectedObjectIds.map((it) => it._id)) - $: objectRefs.length = projects?.length ?? 0 + $: objectRefs.length = components?.length ?? 0 export const onObjectChecked = (docs: Doc[], value: boolean) => { dispatch('check', { docs, value }) @@ -55,12 +55,12 @@ } export const onElementSelected = (offset: 1 | -1 | 0, docObject?: Doc) => { - if (!projects) { + if (!components) { return } let position = - (docObject !== undefined ? projects?.findIndex((x) => x._id === docObject?._id) : selectedRowIndex) ?? -1 + (docObject !== undefined ? components?.findIndex((x) => x._id === docObject?._id) : selectedRowIndex) ?? -1 position += offset @@ -68,15 +68,15 @@ position = 0 } - if (position >= projects.length) { - position = projects.length - 1 + if (position >= components.length) { + position = components.length - 1 } const objectRef = objectRefs[position] selectedRowIndex = position - handleRowFocused(projects[position]) + handleRowFocused(components[position]) if (objectRef) { objectRef.scrollIntoView({ behavior: 'auto', block: 'nearest' }) @@ -94,14 +94,14 @@ {#await buildModel({ client, _class, keys: itemsConfig, lookup: options.lookup }) then itemModels}
- {#if projects} - {#each projects as docObject (docObject._id)} + {#if components} + {#each components as docObject (docObject._id)}
x === docObject)]} + bind:this={objectRefs[components.findIndex((x) => x === docObject)]} class="listGrid" class:mListGridChecked={selectedObjectIdsSet.has(docObject._id)} - class:mListGridFixed={selectedRowIndex === projects.findIndex((x) => x === docObject)} - class:mListGridSelected={selectedRowIndex === projects.findIndex((x) => x === docObject)} + class:mListGridFixed={selectedRowIndex === components.findIndex((x) => x === docObject)} + class:mListGridSelected={selectedRowIndex === components.findIndex((x) => x === docObject)} on:focus={() => {}} on:mouseover={() => handleRowFocused(docObject)} > @@ -129,7 +129,7 @@
{:else if attributeModelIndex === 1} -
+
> export let itemsConfig: (BuildModelKey | string)[] export let loadingProps: LoadingProps | undefined = undefined - export let projects: Project[] = [] + export let components: Component[] = [] export let viewMode: 'list' | 'timeline' = 'list' const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => { if (dir === 'vertical') { - if (viewMode === 'list') projectsList.onElementSelected(offset, of) - else projectsTimeline.onElementSelected(offset, of) + if (viewMode === 'list') componentsList.onElementSelected(offset, of) + else componentTimeline.onElementSelected(offset, of) } }) - let projectsList: ProjectsList - let projectsTimeline: ProjectsTimeline + let componentsList: ComponentsList + let componentTimeline: ComponentTimeline - $: if (projectsList !== undefined) { - listProvider.update(projects) + $: if (componentsList !== undefined) { + listProvider.update(components) } onMount(() => { @@ -60,12 +60,12 @@ /> {#if viewMode === 'list'} - { @@ -76,12 +76,12 @@ }} /> {:else} - { diff --git a/plugins/tracker-resources/src/components/projects/DeleteProjectPresenter.svelte b/plugins/tracker-resources/src/components/components/DeleteComponentPresenter.svelte similarity index 82% rename from plugins/tracker-resources/src/components/projects/DeleteProjectPresenter.svelte rename to plugins/tracker-resources/src/components/components/DeleteComponentPresenter.svelte index 55142a1ae0..812cc9148b 100644 --- a/plugins/tracker-resources/src/components/projects/DeleteProjectPresenter.svelte +++ b/plugins/tracker-resources/src/components/components/DeleteComponentPresenter.svelte @@ -16,17 +16,18 @@ import view from '@hcengineering/view' import { Button, ButtonSize, LabelAndProps, showPopup } from '@hcengineering/ui' import { getClient, MessageBox } from '@hcengineering/presentation' - import type { Project } from '@hcengineering/tracker' + import type { Component } from '@hcengineering/tracker' import tracker from '../../plugin' import { Ref, Space } from '@hcengineering/core' import { createEventDispatcher } from 'svelte' export let space: Ref - export let value: Project + export let value: Component export let size: ButtonSize = 'medium' export let justify: 'left' | 'center' = 'center' export let width: string | undefined = 'min-content' export let showTooltip: LabelAndProps | undefined = undefined + const client = getClient() const dispatch = createEventDispatcher() @@ -34,21 +35,21 @@ showPopup( MessageBox, { - label: tracker.string.RemoveProjectDialogClose, - message: tracker.string.RemoveProjectDialogCloseNote + label: tracker.string.RemoveComponentDialogClose, + message: tracker.string.RemoveComponentDialogCloseNote }, 'top', (result?: boolean) => { if (result === true) { dispatch('close') - removeProject() + removeComponent() } } ) } - async function removeProject () { - await client.removeDoc(tracker.class.Project, space, value._id) + async function removeComponent () { + await client.removeDoc(tracker.class.Component, space, value._id) } diff --git a/plugins/tracker-resources/src/components/projects/EditProject.svelte b/plugins/tracker-resources/src/components/components/EditComponent.svelte similarity index 55% rename from plugins/tracker-resources/src/components/projects/EditProject.svelte rename to plugins/tracker-resources/src/components/components/EditComponent.svelte index e75ab432aa..6e431a2fa2 100644 --- a/plugins/tracker-resources/src/components/projects/EditProject.svelte +++ b/plugins/tracker-resources/src/components/components/EditComponent.svelte @@ -1,63 +1,67 @@ - + -
- change('label', project.label)} /> + change('label', component.label)} />
change('description', evt.detail)} />
- +
diff --git a/plugins/tracker-resources/src/components/projects/IconPresenter.svelte b/plugins/tracker-resources/src/components/components/IconComponent.svelte similarity index 89% rename from plugins/tracker-resources/src/components/projects/IconPresenter.svelte rename to plugins/tracker-resources/src/components/components/IconComponent.svelte index fbe9621d3f..8c73e1d553 100644 --- a/plugins/tracker-resources/src/components/projects/IconPresenter.svelte +++ b/plugins/tracker-resources/src/components/components/IconComponent.svelte @@ -14,10 +14,10 @@ -->
-
{lead.name} diff --git a/plugins/tracker-resources/src/components/projects/LeadPresenter.svelte b/plugins/tracker-resources/src/components/components/LeadPresenter.svelte similarity index 94% rename from plugins/tracker-resources/src/components/projects/LeadPresenter.svelte rename to plugins/tracker-resources/src/components/components/LeadPresenter.svelte index 7dc4b509fb..ed6e8d708b 100644 --- a/plugins/tracker-resources/src/components/projects/LeadPresenter.svelte +++ b/plugins/tracker-resources/src/components/components/LeadPresenter.svelte @@ -15,7 +15,7 @@ dispatch('close')} > - + - + - + - + diff --git a/plugins/tracker-resources/src/components/projects/TeamProjects.svelte b/plugins/tracker-resources/src/components/components/ProjectComponents.svelte similarity index 78% rename from plugins/tracker-resources/src/components/projects/TeamProjects.svelte rename to plugins/tracker-resources/src/components/components/ProjectComponents.svelte index 5a87c66d31..c869262183 100644 --- a/plugins/tracker-resources/src/components/projects/TeamProjects.svelte +++ b/plugins/tracker-resources/src/components/components/ProjectComponents.svelte @@ -14,10 +14,10 @@ --> - + diff --git a/plugins/tracker-resources/src/components/projects/Roadmap.svelte b/plugins/tracker-resources/src/components/components/Roadmap.svelte similarity index 87% rename from plugins/tracker-resources/src/components/projects/Roadmap.svelte rename to plugins/tracker-resources/src/components/components/Roadmap.svelte index 8ed29c3771..a127ab7b51 100644 --- a/plugins/tracker-resources/src/components/projects/Roadmap.svelte +++ b/plugins/tracker-resources/src/components/components/Roadmap.svelte @@ -13,8 +13,8 @@ // limitations under the License. --> - + diff --git a/plugins/tracker-resources/src/components/projects/TargetDatePresenter.svelte b/plugins/tracker-resources/src/components/components/TargetDatePresenter.svelte similarity index 92% rename from plugins/tracker-resources/src/components/projects/TargetDatePresenter.svelte rename to plugins/tracker-resources/src/components/components/TargetDatePresenter.svelte index c880de4b49..aea60ac320 100644 --- a/plugins/tracker-resources/src/components/projects/TargetDatePresenter.svelte +++ b/plugins/tracker-resources/src/components/components/TargetDatePresenter.svelte @@ -13,11 +13,11 @@ // limitations under the License. -->
diff --git a/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte b/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte index dca7ffbf00..5f1d6ff92e 100644 --- a/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuePresenter.svelte @@ -15,7 +15,7 @@ {#if value} diff --git a/plugins/tracker-resources/src/components/issues/IssuePreview.svelte b/plugins/tracker-resources/src/components/issues/IssuePreview.svelte index 8aeb7062a5..cdeb76aea1 100644 --- a/plugins/tracker-resources/src/components/issues/IssuePreview.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuePreview.svelte @@ -19,7 +19,7 @@ import { CommentPopup } from '@hcengineering/chunter-resources' import { Ref, SortingOrder } from '@hcengineering/core' import { createQuery, getClient, MessageViewer } from '@hcengineering/presentation' - import { Issue, IssueStatus, Team } from '@hcengineering/tracker' + import { Issue, IssueStatus, Project } from '@hcengineering/tracker' import { Label, resizeObserver, Scroller } from '@hcengineering/ui' import tracker from '../../plugin' import AssigneeEditor from './AssigneeEditor.svelte' @@ -57,10 +57,10 @@ sort: { rank: SortingOrder.Ascending } } ) - let currentTeam: Team | undefined + let currentProject: Project | undefined - $: spaceQuery.query(tracker.class.Team, { _id: space }, (res) => ([currentTeam] = res)) - $: issueName = currentTeam && issue && `${currentTeam.identifier}-${issue.number}` + $: spaceQuery.query(tracker.class.Project, { _id: space }, (res) => ([currentProject] = res)) + $: issueName = currentProject && issue && `${currentProject.identifier}-${issue.number}` const limit: number = 350 diff --git a/plugins/tracker-resources/src/components/issues/Issues.svelte b/plugins/tracker-resources/src/components/issues/Issues.svelte index e3cf25c876..4e9a71d738 100644 --- a/plugins/tracker-resources/src/components/issues/Issues.svelte +++ b/plugins/tracker-resources/src/components/issues/Issues.svelte @@ -14,11 +14,11 @@ --> diff --git a/plugins/tracker-resources/src/components/issues/IssuesFilterMenu.svelte b/plugins/tracker-resources/src/components/issues/IssuesFilterMenu.svelte index 51c24783f0..762718b398 100644 --- a/plugins/tracker-resources/src/components/issues/IssuesFilterMenu.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuesFilterMenu.svelte @@ -25,7 +25,7 @@ } from '../../utils' import FilterMenu from '../FilterMenu.svelte' import PriorityFilterMenuSection from './PriorityFilterMenuSection.svelte' - import ProjectFilterMenuSection from './ProjectFilterMenuSection.svelte' + import ComponentFilterMenuSection from './ComponentFilterMenuSection.svelte' import SprintFilterMenuSection from './SprintFilterMenuSection.svelte' import StatusFilterMenuSection from './StatusFilterMenuSection.svelte' @@ -42,7 +42,7 @@ $: defaultStatusIds = defaultStatuses.map((x) => x._id) $: groupedByStatus = getGroupedIssues('status', issues, defaultStatusIds) $: groupedByPriority = getGroupedIssues('priority', issues, defaultPriorities) - $: groupedByProject = getGroupedIssues('project', issues) + $: groupedByComponent = getGroupedIssues('component', issues) $: groupedBySprint = getGroupedIssues('sprint', issues) const handleStatusFilterMenuSectionOpened = () => { @@ -86,17 +86,17 @@ ) } - const handleProjectFilterMenuSectionOpened = () => { - const projectGroups: { [key: string]: number } = {} + const handleComponentFilterMenuSectionOpened = () => { + const componentGroups: { [key: string]: number } = {} - for (const [project, value] of Object.entries(groupedByProject)) { - projectGroups[project] = value?.length ?? 0 + for (const [component, value] of Object.entries(groupedByComponent)) { + componentGroups[component] = value?.length ?? 0 } showPopup( - ProjectFilterMenuSection, + ComponentFilterMenuSection, { - groups: projectGroups, - selectedElements: currentFilterQuery?.project?.[currentFilterMode] ?? [], + groups: componentGroups, + selectedElements: currentFilterQuery?.component?.[currentFilterMode] ?? [], index, onUpdate, onBack @@ -108,8 +108,8 @@ const handleSprintFilterMenuSectionOpened = () => { const sprintGroups: { [key: string]: number } = {} - for (const [project, value] of Object.entries(groupedBySprint)) { - sprintGroups[project] = value?.length ?? 0 + for (const [sprint, value] of Object.entries(groupedBySprint)) { + sprintGroups[sprint] = value?.length ?? 0 } showPopup( SprintFilterMenuSection, @@ -134,8 +134,8 @@ onSelect: handlePriorityFilterMenuSectionOpened }, { - ...getIssueFilterAssetsByType('project'), - onSelect: handleProjectFilterMenuSectionOpened + ...getIssueFilterAssetsByType('component'), + onSelect: handleComponentFilterMenuSectionOpened }, { ...getIssueFilterAssetsByType('sprint'), diff --git a/plugins/tracker-resources/src/components/issues/KanbanView.svelte b/plugins/tracker-resources/src/components/issues/KanbanView.svelte index 573637cb2f..ce79b59a57 100644 --- a/plugins/tracker-resources/src/components/issues/KanbanView.svelte +++ b/plugins/tracker-resources/src/components/issues/KanbanView.svelte @@ -20,7 +20,15 @@ import { getResource } from '@hcengineering/platform' import { createQuery, getClient } from '@hcengineering/presentation' import tags from '@hcengineering/tags' - import { Issue, IssuesGrouping, IssuesOrdering, IssueStatus, Project, Sprint, Team } from '@hcengineering/tracker' + import { + Issue, + IssuesGrouping, + IssuesOrdering, + IssueStatus, + Component as ComponentType, + Sprint, + Project + } from '@hcengineering/tracker' import { Button, Component, @@ -47,7 +55,7 @@ import tracker from '../../plugin' import { issuesGroupBySorting, mapKanbanCategories } from '../../utils' import CreateIssue from '../CreateIssue.svelte' - import ProjectEditor from '../projects/ProjectEditor.svelte' + import ComponentEditor from '../components/ComponentEditor.svelte' import AssigneePresenter from './AssigneePresenter.svelte' import SubIssuesSelector from './edit/SubIssuesSelector.svelte' import IssuePresenter from './IssuePresenter.svelte' @@ -57,13 +65,13 @@ import StatusEditor from './StatusEditor.svelte' import EstimationEditor from './timereport/EstimationEditor.svelte' - export let space: Ref | undefined = undefined + export let space: Ref | undefined = undefined export let baseMenuClass: Ref> | undefined = undefined export let query: DocumentQuery = {} export let viewOptionsConfig: ViewOptionModel[] | undefined export let viewOptions: ViewOptions - $: currentSpace = space || tracker.team.DefaultTeam + $: currentSpace = space || tracker.project.DefaultProject $: groupBy = (viewOptions.groupBy[0] ?? noCategory) as IssuesGrouping $: orderBy = viewOptions.orderBy $: sort = { [orderBy[0]]: orderBy[1] } @@ -71,9 +79,9 @@ const spaceQuery = createQuery() - let currentTeam: Team | undefined - $: spaceQuery.query(tracker.class.Team, { _id: currentSpace }, (res) => { - currentTeam = res.shift() + let currentProject: Project | undefined + $: spaceQuery.query(tracker.class.Project, { _id: currentSpace }, (res) => { + currentProject = res.shift() }) let resultQuery: DocumentQuery = query @@ -104,7 +112,7 @@ const lookup: Lookup = { assignee: contact.class.Employee, - space: tracker.class.Team, + space: tracker.class.Project, _id: { subIssues: tracker.class.Issue } @@ -128,7 +136,7 @@ let issues: Issue[] = [] const lookupIssue: Lookup = { status: tracker.class.IssueStatus, - project: tracker.class.Project, + component: tracker.class.Component, sprint: tracker.class.Sprint, assignee: contact.class.Employee } @@ -167,15 +175,15 @@ } ) - const projectsQuery = createQuery() - let projects: Project[] = [] - $: projectsQuery.query( - tracker.class.Project, + const componentsQuery = createQuery() + let components: ComponentType[] = [] + $: componentsQuery.query( + tracker.class.Component, { space: currentSpace }, (result) => { - projects = result + components = result } ) @@ -202,7 +210,7 @@ viewOptions, viewOptionsConfig, statuses, - projects, + components, sprints, assignee ) @@ -215,7 +223,7 @@ viewOptions, viewOptionsConfig, statuses, - projects, + components, sprints, assignee ) @@ -228,7 +236,7 @@ viewOptions: ViewOptions, viewOptionsModel: ViewOptionModel[] | undefined, statuses: WithLookup[], - projects: Project[], + components: ComponentType[], sprints: Sprint[], assignee: Employee[] ) { @@ -251,7 +259,7 @@ } } const indexes = new Map(categories.map((p, i) => [p, i])) - const res = await mapKanbanCategories(groupByKey, categories, statuses, projects, sprints, assignee) + const res = await mapKanbanCategories(groupByKey, categories, statuses, components, sprints, assignee) res.sort((a, b) => { const aIndex = indexes.get(a._id ?? undefined) ?? -1 const bIndex = indexes.get(b._id ?? undefined) ?? -1 @@ -357,10 +365,10 @@
{#if issue && issue.subIssues > 0} - + {/if} - - +
diff --git a/plugins/tracker-resources/src/components/issues/RelationEditorPart.svelte b/plugins/tracker-resources/src/components/issues/RelationEditorPart.svelte index 9ef31b4364..dfc3eb87ec 100644 --- a/plugins/tracker-resources/src/components/issues/RelationEditorPart.svelte +++ b/plugins/tracker-resources/src/components/issues/RelationEditorPart.svelte @@ -30,7 +30,7 @@ (result) => { documents = result }, - { lookup: isIssue ? { space: tracker.class.Team } : {} } + { lookup: isIssue ? { space: tracker.class.Project } : {} } ) async function handleClick (issue: RelatedDocument) { diff --git a/plugins/tracker-resources/src/components/issues/StatusEditor.svelte b/plugins/tracker-resources/src/components/issues/StatusEditor.svelte index 077a5297d1..43a33ad032 100644 --- a/plugins/tracker-resources/src/components/issues/StatusEditor.svelte +++ b/plugins/tracker-resources/src/components/issues/StatusEditor.svelte @@ -15,7 +15,7 @@ @@ -194,7 +194,7 @@ {objectId} refContainer={thisRef} _class={tracker.class.Issue} - space={currentTeam._id} + space={currentProject._id} alwaysEdit showButtons maxHeight={'20vh'} @@ -208,7 +208,7 @@
- + it._id !== evt.detail) }} /> - +
@@ -124,18 +124,18 @@ - {#if currentTeam && issueStatuses} + {#if currentProject && issueStatuses} {/if} - {#if currentTeam} + {#if currentProject} {/if} diff --git a/plugins/tracker-resources/src/components/issues/timereport/EstimationStatsPresenter.svelte b/plugins/tracker-resources/src/components/issues/timereport/EstimationStatsPresenter.svelte index 25b2d66007..77e7dd686e 100644 --- a/plugins/tracker-resources/src/components/issues/timereport/EstimationStatsPresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/timereport/EstimationStatsPresenter.svelte @@ -15,18 +15,18 @@ 0 && !!selectedWorkDayType && !!selectedWorkDayLength} @@ -148,7 +147,7 @@
{ @@ -158,7 +157,7 @@
diff --git a/plugins/tracker-resources/src/components/teams/TeamIconChooser.svelte b/plugins/tracker-resources/src/components/projects/ProjectIconChooser.svelte similarity index 100% rename from plugins/tracker-resources/src/components/teams/TeamIconChooser.svelte rename to plugins/tracker-resources/src/components/projects/ProjectIconChooser.svelte diff --git a/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte b/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte index f41a5b4b5d..b5f48a6aa2 100644 --- a/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte +++ b/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte @@ -13,43 +13,31 @@ // limitations under the License. --> -{#if value} - -
- {#if withIcon} -
- -
- {/if} - - {value.label} - -
+{#if model.specials} + getActions(space)}> + {#each model.specials as special} + + + + {/each} + {/if} diff --git a/plugins/tracker-resources/src/components/projects/ProjectStatusEditor.svelte b/plugins/tracker-resources/src/components/projects/ProjectStatusEditor.svelte deleted file mode 100644 index e64f2e96fb..0000000000 --- a/plugins/tracker-resources/src/components/projects/ProjectStatusEditor.svelte +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/plugins/tracker-resources/src/components/scrums/NewScrum.svelte b/plugins/tracker-resources/src/components/scrums/NewScrum.svelte index 59fa82f890..09e5b9c316 100644 --- a/plugins/tracker-resources/src/components/scrums/NewScrum.svelte +++ b/plugins/tracker-resources/src/components/scrums/NewScrum.svelte @@ -16,13 +16,13 @@ import { Data, DateRangeMode, generateId, Ref } from '@hcengineering/core' import { IntlString } from '@hcengineering/platform' import { Card, getClient, SpaceSelector, UserBoxList } from '@hcengineering/presentation' - import { Scrum, Team } from '@hcengineering/tracker' + import { Scrum, Project } from '@hcengineering/tracker' import { DateRangePresenter, EditBox } from '@hcengineering/ui' import { createEventDispatcher } from 'svelte' import tracker from '../../plugin' import { StyledTextArea } from '@hcengineering/text-editor' - export let space: Ref + export let space: Ref const objectId: Ref = generateId() const dispatch = createEventDispatcher() @@ -66,7 +66,7 @@ on:close={() => dispatch('close')} > - + import { Ref } from '@hcengineering/core' import { createQuery } from '@hcengineering/presentation' - import { Scrum, ScrumRecord, Team } from '@hcengineering/tracker' + import { Scrum, ScrumRecord, Project } from '@hcengineering/tracker' import { closePopup, closeTooltip, location } from '@hcengineering/ui' import { onDestroy } from 'svelte' import tracker from '../../plugin' import ScrumRecordsView from './ScrumRecordsView.svelte' import ScrumsView from './ScrumsView.svelte' - export let currentSpace: Ref + export let currentSpace: Ref let scrumId: Ref | undefined let scrum: Scrum | undefined diff --git a/plugins/tracker-resources/src/components/scrums/ScrumsView.svelte b/plugins/tracker-resources/src/components/scrums/ScrumsView.svelte index 7641208ff6..3d71d509f5 100644 --- a/plugins/tracker-resources/src/components/scrums/ScrumsView.svelte +++ b/plugins/tracker-resources/src/components/scrums/ScrumsView.svelte @@ -15,7 +15,7 @@ @@ -70,17 +70,17 @@ on:close={() => dispatch('close')} > - + - - + + { showPopup(NewSprint, { space, targetElement: null }, 'top') } @@ -105,7 +105,7 @@