Add workbench tabs (#6788)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2024-10-03 01:49:49 +07:00
committed by GitHub
parent ce2621d472
commit b5fed4879f
36 changed files with 794 additions and 69 deletions
+4 -2
View File
@@ -144,7 +144,8 @@ import {
getCurrentEmployeePosition,
getPersonTooltip,
grouppingPersonManager,
resolveLocation
resolveLocation,
resolveLocationData
} from './utils'
export * from './utils'
@@ -444,7 +445,8 @@ export default async (): Promise<Resources> => ({
PersonFilterFunction: filterPerson
},
resolver: {
Location: resolveLocation
Location: resolveLocation,
LocationData: resolveLocationData
},
aggregation: {
// eslint-disable-next-line @typescript-eslint/unbound-method
+29 -1
View File
@@ -50,7 +50,7 @@ import core, {
type WithLookup
} from '@hcengineering/core'
import notification, { type DocNotifyContext, type InboxNotification } from '@hcengineering/notification'
import { getEmbeddedLabel, getResource, translate } from '@hcengineering/platform'
import { type IntlString, getEmbeddedLabel, getResource, translate } from '@hcengineering/platform'
import { createQuery, getClient } from '@hcengineering/presentation'
import { type TemplateDataProvider } from '@hcengineering/templates'
import {
@@ -64,6 +64,7 @@ import {
import view, { type Filter, type GrouppingManager } from '@hcengineering/view'
import { accessDeniedStore, FilterQuery } from '@hcengineering/view-resources'
import { derived, get, writable } from 'svelte/store'
import { type LocationData } from '@hcengineering/workbench'
import contact from './plugin'
import { personStore } from '.'
@@ -536,3 +537,30 @@ export function groupPersonAccountValuesWithEmpty (
}
return personAccountList.map((it) => it._id)
}
export async function resolveLocationData (loc: Location): Promise<LocationData> {
const special = loc.path[3]
const specialsData: Record<string, IntlString> = {
companies: contact.string.Organizations,
employees: contact.string.Employees,
persons: contact.string.Persons
}
if (special == null) {
return { nameIntl: contact.string.Contacts }
}
const specialLabel = specialsData[special]
if (specialLabel !== undefined) {
return { nameIntl: specialLabel }
}
const client = getClient()
const object = await client.findOne(contact.class.Contact, { _id: special as Ref<Contact> })
if (object === undefined) {
return { nameIntl: specialLabel }
}
return { name: getName(client.getHierarchy(), object) }
}