From 3b25cc2b83260d67c8e444c0edbe89f60908eb5e Mon Sep 17 00:00:00 2001 From: Anna No Date: Wed, 29 Jun 2022 15:08:59 +0700 Subject: [PATCH] [TSK-223] Workbench: App alias (Part 1) (#2162) Signed-off-by: Anna --- changelog.md | 3 +++ models/board/src/index.ts | 3 ++- models/calendar/src/index.ts | 3 ++- models/chunter/src/index.ts | 4 +++- models/contact/src/index.ts | 4 +++- models/hr/src/index.ts | 3 ++- models/inventory/src/index.ts | 3 ++- models/lead/src/index.ts | 7 ++++--- models/recruit/src/index.ts | 9 +++++---- models/setting/src/index.ts | 3 ++- models/tracker/src/index.ts | 10 ++++++---- models/workbench/src/index.ts | 10 ++++++---- plugins/chunter-resources/src/utils.ts | 4 ++-- plugins/devmodel-resources/src/index.ts | 2 ++ .../src/components/AccountPopup.svelte | 4 ++-- .../src/components/ClassAttributeBar.svelte | 4 ++-- .../src/components/AccountPopup.svelte | 6 +++--- .../src/components/Workbench.svelte | 18 ++++++++--------- plugins/workbench-resources/src/utils.ts | 4 ++-- plugins/workbench/src/index.ts | 3 ++- tests/sanity/tests/actions.spec.ts | 14 +++++-------- tests/sanity/tests/settings.spec.ts | 20 ++++++------------- tests/sanity/tests/tags.spec.ts | 10 +++++----- tests/sanity/tests/tracker.projects.spec.ts | 4 ++-- tests/sanity/tests/tracker.spec.ts | 2 +- tests/sanity/tests/workbench.spec.ts | 18 +++++++---------- 26 files changed, 90 insertions(+), 85 deletions(-) diff --git a/changelog.md b/changelog.md index 3ea9582a2c..cb1a8050ae 100644 --- a/changelog.md +++ b/changelog.md @@ -14,6 +14,9 @@ HR: Tracker: - Manual issues ordering +Workbench +- Use application aliases in URL + ## 0.6.29 Platform: diff --git a/models/board/src/index.ts b/models/board/src/index.ts index 454fa23658..cc47637af8 100644 --- a/models/board/src/index.ts +++ b/models/board/src/index.ts @@ -15,7 +15,7 @@ // To help typescript locate view plugin properly import automation, { AutomationSupport } from '@anticrm/automation' -import type { Board, Card, MenuPage, CommonBoardPreference, CardCover } from '@anticrm/board' +import { Board, Card, MenuPage, CommonBoardPreference, CardCover, boardId } from '@anticrm/board' import type { Employee } from '@anticrm/contact' import { Class, DOMAIN_MODEL, IndexKind, Markup, Ref, Type } from '@anticrm/core' import { @@ -140,6 +140,7 @@ export function createModel (builder: Builder): void { { label: board.string.BoardApplication, icon: board.icon.Board, + alias: boardId, hidden: false, navigatorModel: { spaces: [ diff --git a/models/calendar/src/index.ts b/models/calendar/src/index.ts index 2ca4211cb3..20793a7606 100644 --- a/models/calendar/src/index.ts +++ b/models/calendar/src/index.ts @@ -14,7 +14,7 @@ // import activity from '@anticrm/activity' -import { Calendar, Event, Reminder } from '@anticrm/calendar' +import { calendarId, Calendar, Event, Reminder } from '@anticrm/calendar' import { Employee } from '@anticrm/contact' import type { Domain, Markup, Ref, Timestamp } from '@anticrm/core' import { IndexKind } from '@anticrm/core' @@ -104,6 +104,7 @@ export function createModel (builder: Builder): void { { label: calendar.string.ApplicationLabelCalendar, icon: calendar.icon.Calendar, + alias: calendarId, hidden: false, component: calendar.component.Events }, diff --git a/models/chunter/src/index.ts b/models/chunter/src/index.ts index d2896704f5..815e13872f 100644 --- a/models/chunter/src/index.ts +++ b/models/chunter/src/index.ts @@ -14,9 +14,10 @@ // import activity from '@anticrm/activity' -import type { +import { Backlink, Channel, + chunterId, ChunterMessage, ChunterSpace, Comment, @@ -324,6 +325,7 @@ export function createModel (builder: Builder): void { { label: chunter.string.ApplicationLabelChunter, icon: chunter.icon.Chunter, + alias: chunterId, hidden: false, navigatorModel: { specials: [ diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 2fb0d8427b..9b3b2eac57 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -13,10 +13,11 @@ // limitations under the License. // -import type { +import { Channel, ChannelProvider, Contact, + contactId, Employee, EmployeeAccount, Member, @@ -170,6 +171,7 @@ export function createModel (builder: Builder): void { { label: contact.string.Contacts, icon: contact.icon.ContactApplication, + alias: contactId, hidden: false, component: contact.component.Contacts }, diff --git a/models/hr/src/index.ts b/models/hr/src/index.ts index f87c500068..d0fefe090a 100644 --- a/models/hr/src/index.ts +++ b/models/hr/src/index.ts @@ -15,7 +15,7 @@ import { Employee } from '@anticrm/contact' import { Arr, Class, Domain, DOMAIN_MODEL, IndexKind, Markup, Ref, Timestamp } from '@anticrm/core' -import type { Department, DepartmentMember, Request, RequestType, Staff } from '@anticrm/hr' +import { Department, DepartmentMember, hrId, Request, RequestType, Staff } from '@anticrm/hr' import { ArrOf, Builder, @@ -139,6 +139,7 @@ export function createModel (builder: Builder): void { { label: hr.string.HRApplication, icon: hr.icon.HR, + alias: hrId, hidden: false, navigatorModel: { specials: [ diff --git a/models/inventory/src/index.ts b/models/inventory/src/index.ts index bd32949503..f5ed4a6706 100644 --- a/models/inventory/src/index.ts +++ b/models/inventory/src/index.ts @@ -14,7 +14,7 @@ // import { Domain, IndexKind, Ref } from '@anticrm/core' -import type { Category, Product, Variant } from '@anticrm/inventory' +import { Category, inventoryId, Product, Variant } from '@anticrm/inventory' import { Builder, Collection, Index, Model, Prop, TypeRef, TypeString, UX } from '@anticrm/model' import attachment from '@anticrm/model-attachment' import core, { TAttachedDoc } from '@anticrm/model-core' @@ -114,6 +114,7 @@ export function createModel (builder: Builder): void { { label: inventory.string.Inventory, icon: inventory.icon.InventoryApplication, + alias: inventoryId, hidden: false, navigatorModel: { specials: [ diff --git a/models/lead/src/index.ts b/models/lead/src/index.ts index c64fa48af8..367d1e0943 100644 --- a/models/lead/src/index.ts +++ b/models/lead/src/index.ts @@ -16,7 +16,7 @@ // To help typescript locate view plugin properly import type { Employee } from '@anticrm/contact' import { Class, Doc, FindOptions, IndexKind, Ref } from '@anticrm/core' -import type { Customer, Funnel, Lead } from '@anticrm/lead' +import { Customer, Funnel, Lead, leadId } from '@anticrm/lead' import { Builder, Collection, Index, Mixin, Model, Prop, TypeRef, TypeString, TypeMarkup, UX } from '@anticrm/model' import attachment from '@anticrm/model-attachment' import chunter from '@anticrm/model-chunter' @@ -24,7 +24,7 @@ import contact, { TContact } from '@anticrm/model-contact' import core from '@anticrm/model-core' import task, { actionTemplates, TSpaceWithStates, TTask } from '@anticrm/model-task' import view, { createAction, actionTemplates as viewTemplates } from '@anticrm/model-view' -import workbench, { Application } from '@anticrm/model-workbench' +import workbench from '@anticrm/model-workbench' import setting from '@anticrm/setting' import lead from './plugin' @@ -101,6 +101,7 @@ export function createModel (builder: Builder): void { { label: lead.string.LeadApplication, icon: lead.icon.LeadApplication, + alias: leadId, hidden: false, navigatorModel: { specials: [ @@ -262,7 +263,7 @@ export function createModel (builder: Builder): void { action: workbench.actionImpl.Navigate, actionProps: { mode: 'app', - application: lead.app.Lead as Ref + application: leadId }, label: lead.string.GotoLeadApplication, icon: view.icon.ArrowRight, diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 5ff8f110b4..ca96e07b9b 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -40,7 +40,7 @@ import task, { TSpaceWithStates, TTask, actionTemplates } from '@anticrm/model-t import view, { createAction, actionTemplates as viewTemplates } from '@anticrm/model-view' import workbench, { Application, createNavigateAction } from '@anticrm/model-workbench' import { IntlString } from '@anticrm/platform' -import { Applicant, Candidate, Candidates, Vacancy } from '@anticrm/recruit' +import { Applicant, Candidate, Candidates, recruitId, Vacancy } from '@anticrm/recruit' import { KeyBinding } from '@anticrm/view' import setting from '@anticrm/setting' import recruit from './plugin' @@ -161,6 +161,7 @@ export function createModel (builder: Builder): void { { label: recruit.string.RecruitApplication, icon: recruit.icon.RecruitApplication, + alias: recruitId, hidden: false, navigatorModel: { spaces: [], @@ -571,8 +572,8 @@ export function createModel (builder: Builder): void { }) function createGotoSpecialAction (builder: Builder, id: string, key: KeyBinding, label: IntlString): void { - createNavigateAction(builder, key, label, { - application: recruit.app.Recruit as Ref, + createNavigateAction(builder, key, label, recruit.app.Recruit as Ref, { + application: recruitId, mode: 'special', special: id }) @@ -588,7 +589,7 @@ export function createModel (builder: Builder): void { action: workbench.actionImpl.Navigate, actionProps: { mode: 'app', - application: recruit.app.Recruit as Ref, + application: recruitId, special: talentsId }, label: recruit.string.GotoRecruitApplication, diff --git a/models/setting/src/index.ts b/models/setting/src/index.ts index b610dd7a9a..be82e05209 100644 --- a/models/setting/src/index.ts +++ b/models/setting/src/index.ts @@ -17,7 +17,7 @@ import { Builder, Mixin, Model } from '@anticrm/model' import { Ref, Domain, DOMAIN_MODEL } from '@anticrm/core' import core, { TClass, TDoc } from '@anticrm/model-core' import setting from './plugin' -import type { Editable, Integration, IntegrationType, Handler, SettingsCategory } from '@anticrm/setting' +import { Editable, Integration, IntegrationType, Handler, SettingsCategory, settingId } from '@anticrm/setting' import type { Asset, IntlString } from '@anticrm/platform' import task from '@anticrm/task' import activity from '@anticrm/activity' @@ -186,6 +186,7 @@ export function createModel (builder: Builder): void { { label: setting.string.Setting, icon: setting.icon.Setting, + alias: settingId, hidden: true, component: setting.component.Settings }, diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 7eda81f912..49cb19cbc1 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -49,7 +49,8 @@ import { IssueStatusCategory, Project, ProjectStatus, - Team + Team, + trackerId } from '@anticrm/tracker' import { KeyBinding } from '@anticrm/view' import tags from '@anticrm/tags' @@ -450,6 +451,7 @@ export function createModel (builder: Builder): void { { label: tracker.string.TrackerApplication, icon: tracker.icon.TrackerApplication, + alias: trackerId, hidden: false, navigatorModel: { specials: [ @@ -527,8 +529,8 @@ export function createModel (builder: Builder): void { ) function createGotoSpecialAction (builder: Builder, id: string, key: KeyBinding, label: IntlString): void { - createNavigateAction(builder, key, label, { - application: tracker.app.Tracker, + createNavigateAction(builder, key, label, tracker.app.Tracker, { + application: trackerId, mode: 'space', spaceSpecial: id, spaceClass: tracker.class.Team @@ -545,7 +547,7 @@ export function createModel (builder: Builder): void { action: workbench.actionImpl.Navigate, actionProps: { mode: 'app', - application: tracker.app.Tracker + application: trackerId }, label: tracker.string.GotoTrackerApplication, icon: view.icon.ArrowRight, diff --git a/models/workbench/src/index.ts b/models/workbench/src/index.ts index 5eb31ee263..a6aca39c93 100644 --- a/models/workbench/src/index.ts +++ b/models/workbench/src/index.ts @@ -30,6 +30,7 @@ export { Application } export class TApplication extends TDoc implements Application { label!: IntlString icon!: Asset + alias!: string hidden!: boolean } @@ -51,9 +52,10 @@ export function createNavigateAction ( builder: Builder, key: KeyBinding, label: IntlString, - config: { + application: Ref, + props: { mode: 'app' | 'special' | 'space' - application: Ref + application?: string special?: string space?: Ref spaceClass?: Ref> @@ -62,7 +64,7 @@ export function createNavigateAction ( ): void { createAction(builder, { action: workbench.actionImpl.Navigate, - actionProps: config, + actionProps: props, label, icon: view.icon.ArrowRight, keyBinding: [key], @@ -71,7 +73,7 @@ export function createNavigateAction ( target: core.class.Doc, context: { mode: ['workbench', 'browser', 'editor', 'panel', 'popup'], - application: config.application + application } }) } diff --git a/plugins/chunter-resources/src/utils.ts b/plugins/chunter-resources/src/utils.ts index 4c9af0878b..ce313a2fb5 100644 --- a/plugins/chunter-resources/src/utils.ts +++ b/plugins/chunter-resources/src/utils.ts @@ -1,4 +1,4 @@ -import { ChunterMessage } from '@anticrm/chunter' +import { chunterId, ChunterMessage } from '@anticrm/chunter' import contact, { EmployeeAccount, formatName } from '@anticrm/contact' import { Account, Class, Client, Obj, Ref, Space, getCurrentAccount, Timestamp } from '@anticrm/core' import { Asset } from '@anticrm/platform' @@ -58,7 +58,7 @@ export async function getDmName (client: Client, dm: Space): Promise { export function getSpaceLink (id: Ref): string { const loc = getCurrentLocation() - loc.path[1] = chunter.app.Chunter + loc.path[1] = chunterId loc.path[2] = id loc.path.length = 3 loc.fragment = undefined diff --git a/plugins/devmodel-resources/src/index.ts b/plugins/devmodel-resources/src/index.ts index 7dc2a838a4..d33e5fb7d2 100644 --- a/plugins/devmodel-resources/src/index.ts +++ b/plugins/devmodel-resources/src/index.ts @@ -28,6 +28,7 @@ import core, { TxResult, WithLookup } from '@anticrm/core' +import { devModelId } from '@anticrm/devmodel' import { Builder } from '@anticrm/model' import { getMetadata, IntlString, Resources } from '@anticrm/platform' import view from '@anticrm/view' @@ -155,6 +156,7 @@ export async function Hook (client: Client): Promise { { label: 'DevModel' as IntlString, icon: view.icon.Model, + alias: devModelId, hidden: false, navigatorModel: { spaces: [], diff --git a/plugins/tracker-resources/src/components/AccountPopup.svelte b/plugins/tracker-resources/src/components/AccountPopup.svelte index a247561a00..c54d47e104 100644 --- a/plugins/tracker-resources/src/components/AccountPopup.svelte +++ b/plugins/tracker-resources/src/components/AccountPopup.svelte @@ -17,7 +17,7 @@ import { getCurrentAccount } from '@anticrm/core' import login from '@anticrm/login' import { Avatar, createQuery } from '@anticrm/presentation' - import setting, { SettingsCategory } from '@anticrm/setting' + import setting, { SettingsCategory, settingId } from '@anticrm/setting' import { closePopup, getCurrentLocation, Icon, Label, navigate, setMetadataLocalStorage } from '@anticrm/ui' // const client = getClient() @@ -43,7 +43,7 @@ function selectCategory (sp: SettingsCategory): void { closePopup() const loc = getCurrentLocation() - loc.path[1] = setting.ids.SettingApp + loc.path[1] = settingId loc.path[2] = sp.name loc.path.length = 3 navigate(loc) diff --git a/plugins/view-resources/src/components/ClassAttributeBar.svelte b/plugins/view-resources/src/components/ClassAttributeBar.svelte index 9a9f207078..1de5fa7981 100644 --- a/plugins/view-resources/src/components/ClassAttributeBar.svelte +++ b/plugins/view-resources/src/components/ClassAttributeBar.svelte @@ -15,7 +15,7 @@