From 76952a4fe969f83c0c4cdf0ce7950c6082ffddb5 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Tue, 18 Apr 2023 13:02:45 +0600 Subject: [PATCH] Fix open action (#3007) Signed-off-by: Denis Bykhov --- models/recruit/src/index.ts | 9 --------- plugins/view-resources/src/actionImpl.ts | 14 ++++++++++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 830159be11..579879b21a 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -921,15 +921,6 @@ export function createModel (builder: Builder): void { } }) - createAction(builder, { - ...viewTemplates.open, - target: recruit.class.Applicant, - context: { - mode: ['browser', 'context'], - group: 'create' - } - }) - createAction(builder, { ...viewTemplates.open, target: recruit.class.ApplicantMatch, diff --git a/plugins/view-resources/src/actionImpl.ts b/plugins/view-resources/src/actionImpl.ts index 67abdd61d7..821d88564e 100644 --- a/plugins/view-resources/src/actionImpl.ts +++ b/plugins/view-resources/src/actionImpl.ts @@ -6,6 +6,7 @@ import { AnySvelteComponent, closeTooltip, isPopupPosAlignment, + navigate, PopupAlignment, PopupPosAlignment, showPanel, @@ -16,7 +17,7 @@ import MoveView from './components/Move.svelte' import { contextStore } from './context' import view from './plugin' import { FocusSelection, focusStore, previewDocument, SelectDirection, selectionStore } from './selection' -import { deleteObjects } from './utils' +import { deleteObjects, getObjectLinkFragment } from './utils' /** * Action to be used for copying text to clipboard. @@ -144,7 +145,7 @@ function ShowPreview (doc: Doc | undefined, evt: Event): void { evt.preventDefault() } -function Open ( +async function Open ( doc: Doc, evt: Event, props: @@ -152,9 +153,14 @@ function Open ( component?: AnyComponent } | undefined -): void { +): Promise { evt.preventDefault() - showPanel(props?.component ?? view.component.EditDoc, doc._id, Hierarchy.mixinOrClass(doc), 'content') + const client = getClient() + const hierarchy = client.getHierarchy() + const panelComponent = hierarchy.classHierarchyMixin(doc._class, view.mixin.ObjectPanel) + const component = props?.component ?? panelComponent?.component ?? view.component.EditDoc + const loc = await getObjectLinkFragment(hierarchy, doc, {}, component) + navigate(loc) } /**