mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-21 17:17:54 +02:00
TSK-810 Rename Team -> Project, Project -> Component (#2756)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { Doc, DocumentUpdate, Ref, RelatedDocument, TxOperations } from '@hcengineering/core'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { Issue, Project, Sprint, Team, trackerId } from '@hcengineering/tracker'
|
||||
import { Issue, Component, Sprint, Project, trackerId } from '@hcengineering/tracker'
|
||||
import { getCurrentLocation, getPanelURI, Location, navigate } from '@hcengineering/ui'
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
import { writable } from 'svelte/store'
|
||||
import tracker from './plugin'
|
||||
|
||||
export const activeProject = writable<Ref<Project> | undefined>(undefined)
|
||||
export const activeComponent = writable<Ref<Component> | undefined>(undefined)
|
||||
export const activeSprint = writable<Ref<Sprint> | undefined>(undefined)
|
||||
|
||||
export function getIssueId (team: Team, issue: Issue): string {
|
||||
return `${team.identifier}-${issue.number}`
|
||||
export function getIssueId (project: Project, issue: Issue): string {
|
||||
return `${project.identifier}-${issue.number}`
|
||||
}
|
||||
|
||||
export function isIssueId (shortLink: string): boolean {
|
||||
@@ -21,16 +21,16 @@ export async function getIssueTitle (client: TxOperations, ref: Ref<Doc>): Promi
|
||||
const object = await client.findOne(
|
||||
tracker.class.Issue,
|
||||
{ _id: ref as Ref<Issue> },
|
||||
{ lookup: { space: tracker.class.Team } }
|
||||
{ lookup: { space: tracker.class.Project } }
|
||||
)
|
||||
if (object?.$lookup?.space === undefined) throw new Error(`Issue Team not found, _id: ${ref}`)
|
||||
if (object?.$lookup?.space === undefined) throw new Error(`Issue project not found, _id: ${ref}`)
|
||||
return getIssueId(object.$lookup.space, object)
|
||||
}
|
||||
|
||||
async function getTitle (doc: Doc): Promise<string> {
|
||||
const client = getClient()
|
||||
const issue = doc as Issue
|
||||
const object = await client.findOne(tracker.class.Team, { _id: issue.space })
|
||||
const object = await client.findOne(tracker.class.Project, { _id: issue.space })
|
||||
if (object === undefined) return `?-${issue.number}`
|
||||
return getIssueId(object, issue)
|
||||
}
|
||||
@@ -65,17 +65,17 @@ export async function generateIssueLocation (loc: Location, issueId: string): Pr
|
||||
if (tokens.length < 2) {
|
||||
return undefined
|
||||
}
|
||||
const teamId = tokens[0]
|
||||
const projectId = tokens[0]
|
||||
const issueNumber = Number(tokens[1])
|
||||
const client = getClient()
|
||||
const team = await client.findOne(tracker.class.Team, { identifier: teamId })
|
||||
if (team === undefined) {
|
||||
const project = await client.findOne(tracker.class.Project, { identifier: projectId })
|
||||
if (project === undefined) {
|
||||
console.error(
|
||||
`Could not find team ${teamId}. Make sure you are in correct workspace and the team was not deleted or renamed.`
|
||||
`Could not find project ${projectId}. Make sure you are in correct workspace and the project was not deleted or renamed.`
|
||||
)
|
||||
return undefined
|
||||
}
|
||||
const issue = await client.findOne(tracker.class.Issue, { number: issueNumber, space: team._id })
|
||||
const issue = await client.findOne(tracker.class.Issue, { number: issueNumber, space: project._id })
|
||||
if (issue === undefined) {
|
||||
console.error(`Could not find issue ${issueId}.`)
|
||||
return undefined
|
||||
|
||||
Reference in New Issue
Block a user