From 4243f68f07a5cfc4186c8e95945b0f8b4ecc773c Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Sat, 3 Jun 2023 09:49:20 +0600 Subject: [PATCH] fix goto actions (#3333) --- models/contact/src/index.ts | 3 ++- models/recruit/src/index.ts | 10 ++++---- models/tracker/src/index.ts | 29 +++++++++++++++--------- models/tracker/src/plugin.ts | 1 - models/workbench/src/index.ts | 1 + plugins/tracker-assets/lang/en.json | 1 - plugins/tracker-assets/lang/ru.json | 1 - plugins/workbench-resources/src/utils.ts | 7 ++++++ 8 files changed, 33 insertions(+), 20 deletions(-) diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 7520db0f0c..1e7b85be34 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -576,7 +576,8 @@ export function createModel (builder: Builder): void { { label: contact.string.Profile, icon: contact.icon.Profile, - placeholder: contact.string.ProfilePlaceholder + placeholder: contact.string.ProfilePlaceholder, + action: contact.actionImpl.OpenChannel }, contact.channelProvider.Profile ) diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 87ef2d7160..6aa0fa0ed9 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -1070,11 +1070,11 @@ export function createModel (builder: Builder): void { }) } - createGotoSpecialAction(builder, talentsId, 'g->e', recruit.string.GotoTalents) - createGotoSpecialAction(builder, vacanciesId, 'g->v', recruit.string.GotoVacancies) - createGotoSpecialAction(builder, skillsId, 'g->s', recruit.string.GotoSkills) - createGotoSpecialAction(builder, myApplicationsId, 'g->h', recruit.string.GotoMyApplications) - createGotoSpecialAction(builder, candidatesId, 'g->a', recruit.string.GotoApplicants) + createGotoSpecialAction(builder, talentsId, 'keyG-keyE', recruit.string.GotoTalents) + createGotoSpecialAction(builder, vacanciesId, 'keyG->keyV', recruit.string.GotoVacancies) + createGotoSpecialAction(builder, skillsId, 'keyG->keyS', recruit.string.GotoSkills) + createGotoSpecialAction(builder, myApplicationsId, 'keyG->keyM', recruit.string.GotoMyApplications) + createGotoSpecialAction(builder, candidatesId, 'keyG->keyA', recruit.string.GotoApplicants) createAction(builder, { action: workbench.actionImpl.Navigate, diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 2daf03aed9..1c264d3d13 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -895,9 +895,6 @@ export function createModel (builder: Builder): void { ) const issuesId = 'issues' - const activeId = 'active' - const backlogId = 'backlog' - const boardId = 'board' const componentsId = 'components' const milestonesId = 'milestones' const templatesId = 'templates' @@ -1153,21 +1150,31 @@ export function createModel (builder: Builder): void { tracker.app.Tracker ) - function createGotoSpecialAction (builder: Builder, id: string, key: KeyBinding, label: IntlString): void { + function createGotoSpecialAction ( + builder: Builder, + id: string, + key: KeyBinding, + label: IntlString, + query?: Record + ): void { createNavigateAction(builder, key, label, tracker.app.Tracker, { application: trackerId, mode: 'space', spaceSpecial: id, - spaceClass: tracker.class.Project + spaceClass: tracker.class.Project, + query }) } - createGotoSpecialAction(builder, issuesId, 'g->e', tracker.string.GotoIssues) - 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, componentsId, 'g->c', tracker.string.GotoComponents) - createGotoSpecialAction(builder, myIssuesId, 'g->m', tracker.string.GotoMyIssues) + createGotoSpecialAction(builder, issuesId, 'keyG->keyE', tracker.string.GotoIssues) + createGotoSpecialAction(builder, issuesId, 'keyG->keyA', tracker.string.GotoActive, { mode: 'active' }) + createGotoSpecialAction(builder, issuesId, 'keyG->keyB', tracker.string.GotoBacklog, { mode: 'backlog' }) + createGotoSpecialAction(builder, componentsId, 'keyG->keyC', tracker.string.GotoComponents) + createNavigateAction(builder, 'keyG->keyM', tracker.string.GotoMyIssues, tracker.app.Tracker, { + application: trackerId, + mode: 'special', + special: myIssuesId + }) createAction(builder, { action: workbench.actionImpl.Navigate, diff --git a/models/tracker/src/plugin.ts b/models/tracker/src/plugin.ts index b5376103ae..ee0cd84958 100644 --- a/models/tracker/src/plugin.ts +++ b/models/tracker/src/plugin.ts @@ -32,7 +32,6 @@ export default mergeIds(trackerId, tracker, { GotoIssues: '' as IntlString, GotoActive: '' as IntlString, GotoBacklog: '' as IntlString, - GotoBoard: '' as IntlString, GotoComponents: '' as IntlString, GotoTrackerApplication: '' as IntlString, GotoMyIssues: '' as IntlString, diff --git a/models/workbench/src/index.ts b/models/workbench/src/index.ts index 2ce3eef554..8734eab5ea 100644 --- a/models/workbench/src/index.ts +++ b/models/workbench/src/index.ts @@ -73,6 +73,7 @@ export function createNavigateAction ( space?: Ref spaceClass?: Ref> spaceSpecial?: string + query?: Record } ): void { createAction(builder, { diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json index 754ed36ad4..1209893eaa 100644 --- a/plugins/tracker-assets/lang/en.json +++ b/plugins/tracker-assets/lang/en.json @@ -144,7 +144,6 @@ "GotoIssues": "Go to issues", "GotoActive": "Go to active issues", "GotoBacklog": "Go to backlog", - "GotoBoard": "Go to issue board", "GotoComponents": "Go to components", "GotoMyIssues": "Go to my issues", "GotoTrackerApplication": "Switch to Tracker Application", diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index 90bdc3a8b3..6f3150ab79 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -144,7 +144,6 @@ "GotoIssues": "Перейти к задачам", "GotoActive": "Перейти к активным задачам", "GotoBacklog": "Перейти к пулу задач", - "GotoBoard": "Перейти к канбану", "GotoComponents": "Перейти к компоненту", "GotoMyIssues": "Перейи к моим задачам", "GotoTrackerApplication": "Перейти к приложению Трекер", diff --git a/plugins/workbench-resources/src/utils.ts b/plugins/workbench-resources/src/utils.ts index f8e1fbe05b..1c9064d9f5 100644 --- a/plugins/workbench-resources/src/utils.ts +++ b/plugins/workbench-resources/src/utils.ts @@ -67,6 +67,7 @@ export async function doNavigate ( space?: Ref // If no space is selected, select first space from list spaceClass?: Ref> + query?: Record } ): Promise { evt?.preventDefault() @@ -83,6 +84,8 @@ export async function doNavigate ( } else { loc.path.length = 3 } + loc.query = props.query + loc.fragment = undefined navigate(loc) break case 'special': @@ -91,6 +94,8 @@ export async function doNavigate ( } loc.path[3] = props.special ?? '' loc.path.length = 4 + loc.query = props.query + loc.fragment = undefined navigate(loc) break case 'space': { @@ -114,6 +119,8 @@ export async function doNavigate ( } } loc.path.length = 5 + loc.query = props.query + loc.fragment = undefined navigate(loc) break