mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
TSK-850 issue link presenter send extra requests (#2750)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
d3af23bbd1
commit
0972048655
@ -33,7 +33,8 @@ import core, {
|
|||||||
RefTo,
|
RefTo,
|
||||||
Tx,
|
Tx,
|
||||||
TxOperations,
|
TxOperations,
|
||||||
TxResult
|
TxResult,
|
||||||
|
WithLookup
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import login from '@hcengineering/login'
|
import login from '@hcengineering/login'
|
||||||
import { getMetadata, getResource, IntlString } from '@hcengineering/platform'
|
import { getMetadata, getResource, IntlString } from '@hcengineering/platform'
|
||||||
@ -72,6 +73,22 @@ class UIClient extends TxOperations implements Client {
|
|||||||
super(client, getCurrentAccount()._id)
|
super(client, getCurrentAccount()._id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override async findAll<T extends Doc>(
|
||||||
|
_class: Ref<Class<T>>,
|
||||||
|
query: DocumentQuery<T>,
|
||||||
|
options?: FindOptions<T>
|
||||||
|
): Promise<FindResult<T>> {
|
||||||
|
return await this.liveQuery.findAll(_class, query, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
override async findOne<T extends Doc>(
|
||||||
|
_class: Ref<Class<T>>,
|
||||||
|
query: DocumentQuery<T>,
|
||||||
|
options?: FindOptions<T>
|
||||||
|
): Promise<WithLookup<T> | undefined> {
|
||||||
|
return await this.liveQuery.findOne(_class, query, options)
|
||||||
|
}
|
||||||
|
|
||||||
override async tx (tx: Tx): Promise<TxResult> {
|
override async tx (tx: Tx): Promise<TxResult> {
|
||||||
return await super.tx(tx)
|
return await super.tx(tx)
|
||||||
}
|
}
|
||||||
|
@ -27,18 +27,24 @@ export async function getIssueTitle (client: TxOperations, ref: Ref<Doc>): Promi
|
|||||||
return getIssueId(object.$lookup.space, object)
|
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 })
|
||||||
|
if (object === undefined) return `?-${issue.number}`
|
||||||
|
return getIssueId(object, issue)
|
||||||
|
}
|
||||||
|
|
||||||
export function generateIssuePanelUri (issue: Issue): string {
|
export function generateIssuePanelUri (issue: Issue): string {
|
||||||
return getPanelURI(tracker.component.EditIssue, issue._id, issue._class, 'content')
|
return getPanelURI(tracker.component.EditIssue, issue._id, issue._class, 'content')
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function issueIdProvider (doc: Doc): Promise<string> {
|
export async function issueIdProvider (doc: Doc): Promise<string> {
|
||||||
const client = getClient()
|
return await getTitle(doc)
|
||||||
return await getIssueTitle(client, doc._id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function issueLinkFragmentProvider (doc: Doc): Promise<string> {
|
export async function issueLinkFragmentProvider (doc: Doc): Promise<string> {
|
||||||
const client = getClient()
|
return await getTitle(doc).then((p) => `${trackerId}|${p}`)
|
||||||
return await getIssueTitle(client, doc._id).then((p) => `${trackerId}|${p}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function issueTitleProvider (doc: Issue): Promise<string> {
|
export async function issueTitleProvider (doc: Issue): Promise<string> {
|
||||||
@ -46,8 +52,7 @@ export async function issueTitleProvider (doc: Issue): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function issueLinkProvider (doc: Doc): Promise<string> {
|
export async function issueLinkProvider (doc: Doc): Promise<string> {
|
||||||
const client = getClient()
|
return await getTitle(doc).then(generateIssueShortLink)
|
||||||
return await getIssueTitle(client, doc._id).then(generateIssueShortLink)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateIssueShortLink (issueId: string): string {
|
export function generateIssueShortLink (issueId: string): string {
|
||||||
|
Loading…
Reference in New Issue
Block a user