From d63ee083c6624a78aeacdf76b89c97398c5701ae Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Thu, 28 Nov 2024 23:16:32 +0400 Subject: [PATCH] UBERF-8607: Fix inbox embedding (#7236) + Few minor cleanups Signed-off-by: Andrey Sobolev --- dev/docker-compose.yaml | 2 +- .../ui/src/components/PanelInstance.svelte | 46 +++++++++---------- packages/ui/src/panelup.ts | 11 +++-- .../src/components/Guest.svelte | 7 +-- .../src/components/inbox/Inbox.svelte | 1 + .../src/components/inbox/Inbox.svelte | 1 - plugins/tracker-resources/src/index.ts | 2 - plugins/tracker-resources/src/plugin.ts | 1 - .../src/components/Workbench.svelte | 8 ++-- 9 files changed, 40 insertions(+), 39 deletions(-) delete mode 100644 plugins/tracker-resources/src/components/inbox/Inbox.svelte diff --git a/dev/docker-compose.yaml b/dev/docker-compose.yaml index c83b0f3c48..d92ff909c7 100644 --- a/dev/docker-compose.yaml +++ b/dev/docker-compose.yaml @@ -406,7 +406,7 @@ services: restart: unless-stopped links: - elastic - - postgres + - cockroach ports: - 4702:4702 environment: diff --git a/packages/ui/src/components/PanelInstance.svelte b/packages/ui/src/components/PanelInstance.svelte index c05d85bd37..6aeefe1204 100644 --- a/packages/ui/src/components/PanelInstance.svelte +++ b/packages/ui/src/components/PanelInstance.svelte @@ -14,13 +14,13 @@ // limitations under the License. --> { - if (props && contentPanel) fitPopup(props, contentPanel) + if (props != null && contentPanel != null) fitPopup(props, contentPanel) }} on:keydown={(evt) => { - if (props) handleKeydown(evt) + if (props != null) handleKeydown(evt) }} on:beforeprint={() => { - if (props && contentPanel) fitPopup(props, contentPanel) + if (props != null && contentPanel != null) fitPopup(props, contentPanel) }} on:afterprint={() => { - if (props && contentPanel) fitPopup(props, contentPanel) + if (props != null && contentPanel != null) fitPopup(props, contentPanel) }} /> {#if props} - {#if !component} + {#if !(component != null)} {:else} diff --git a/packages/ui/src/panelup.ts b/packages/ui/src/panelup.ts index d1434a8c8b..4b06c3d655 100644 --- a/packages/ui/src/panelup.ts +++ b/packages/ui/src/panelup.ts @@ -11,7 +11,9 @@ export interface PanelProps { refit?: () => void } -export const panelstore = writable<{ panel?: PanelProps | undefined }>({ panel: undefined }) +export const panelstore = writable<{ + panel?: PanelProps | undefined +}>({ panel: undefined }) let currentLocation: string | undefined export function getPanelURI (component: AnyComponent, _id: string, _class: string, element?: PopupAlignment): string { @@ -27,17 +29,18 @@ export function showPanel ( _id: string, _class: string, element?: PopupAlignment, - rightSection?: AnyComponent + rightSection?: AnyComponent, + doNavigate: boolean = true ): void { openPanel(component, _id, _class, element, rightSection) const loc = getLocation() - if (loc.fragment !== currentLocation) { + if (doNavigate && loc.fragment !== currentLocation) { loc.fragment = currentLocation navigate(loc) } } -export function openPanel ( +function openPanel ( component: AnyComponent, _id: string, _class: string, diff --git a/plugins/guest-resources/src/components/Guest.svelte b/plugins/guest-resources/src/components/Guest.svelte index a026073cd5..5893cf5879 100644 --- a/plugins/guest-resources/src/components/Guest.svelte +++ b/plugins/guest-resources/src/components/Guest.svelte @@ -33,7 +33,7 @@ getCurrentLocation, getLocation, navigate, - openPanel, + showPanel, defineSeparators, setResolvedLocation, deviceOptionsStore as deviceInfo @@ -207,12 +207,13 @@ provider, focus: doc }) - openPanel( + showPanel( props[0] as AnyComponent, _id, _class, (props[3] ?? undefined) as PopupAlignment, - (props[4] ?? undefined) as AnyComponent + (props[4] ?? undefined) as AnyComponent, + false ) } else { closePanel(false) diff --git a/plugins/notification-resources/src/components/inbox/Inbox.svelte b/plugins/notification-resources/src/components/inbox/Inbox.svelte index be08d9e374..c2bc98cd25 100644 --- a/plugins/notification-resources/src/components/inbox/Inbox.svelte +++ b/plugins/notification-resources/src/components/inbox/Inbox.svelte @@ -452,6 +452,7 @@ ? urlObjectClass ?? selectedContext.objectClass : selectedContext.objectClass, autofocus: false, + embedded: true, context: selectedContext, activityMessage: selectedMessage, props: { context: selectedContext, autofocus: false } diff --git a/plugins/tracker-resources/src/components/inbox/Inbox.svelte b/plugins/tracker-resources/src/components/inbox/Inbox.svelte deleted file mode 100644 index a2f9cf1f91..0000000000 --- a/plugins/tracker-resources/src/components/inbox/Inbox.svelte +++ /dev/null @@ -1 +0,0 @@ -Some inbox stuff here. diff --git a/plugins/tracker-resources/src/index.ts b/plugins/tracker-resources/src/index.ts index fd1f78ec9d..086587f69e 100644 --- a/plugins/tracker-resources/src/index.ts +++ b/plugins/tracker-resources/src/index.ts @@ -51,7 +51,6 @@ import ProjectComponents from './components/components/ProjectComponents.svelte' import CreateIssue from './components/CreateIssue.svelte' import EditRelatedTargets from './components/EditRelatedTargets.svelte' import EditRelatedTargetsPopup from './components/EditRelatedTargetsPopup.svelte' -import Inbox from './components/inbox/Inbox.svelte' import AssigneeEditor from './components/issues/AssigneeEditor.svelte' import DueDatePresenter from './components/issues/DueDatePresenter.svelte' import EditIssue from './components/issues/edit/EditIssue.svelte' @@ -582,7 +581,6 @@ export default async (): Promise => ({ component: { NopeComponent, Issues, - Inbox, MyIssues, Components, IssuePresenter, diff --git a/plugins/tracker-resources/src/plugin.ts b/plugins/tracker-resources/src/plugin.ts index b7be6e83be..09330b2801 100644 --- a/plugins/tracker-resources/src/plugin.ts +++ b/plugins/tracker-resources/src/plugin.ts @@ -305,7 +305,6 @@ export default mergeIds(trackerId, tracker, { }, component: { NopeComponent: '' as AnyComponent, - Inbox: '' as AnyComponent, MyIssues: '' as AnyComponent, Views: '' as AnyComponent, Issues: '' as AnyComponent, diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index d813de2a85..26a51ac531 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -63,7 +63,7 @@ locationToUrl, mainSeparators, navigate, - openPanel, + showPanel, PanelInstance, Popup, PopupAlignment, @@ -401,7 +401,6 @@ const prevTabLoc = prevTab ? getTabLocation(prevTab) : undefined if (prevTabLoc === undefined || prevTabLoc.path[2] !== loc.path[2]) { clear(1) - clear(2) } } prevTabIdStore.set($tabIdStore) @@ -529,12 +528,13 @@ provider, focus: doc }) - openPanel( + showPanel( props[0] as AnyComponent, _id, _class, (props[3] ?? undefined) as PopupAlignment, - (props[4] ?? undefined) as AnyComponent + (props[4] ?? undefined) as AnyComponent, + false ) } else { accessDeniedStore.set(true)