Skip to content

Commit 2276ebe

Browse files
committed
dashboard: Fix shared dashboard URL
The shared URL gets formed from the dashboard URL, and in order to make it work we need to replace `dashboard.py` or `dashboard_wip.py` by `share_dashboard.py` Change-Id: Ide84999ac4408d49417f2accfb1b83e9c233c237
1 parent e75d89a commit 2276ebe

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • packages/cmk-frontend-vue/src/dashboard-wip

packages/cmk-frontend-vue/src/dashboard-wip/utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,12 @@ export async function copyToClipboard(text: string): Promise<void> {
332332
}
333333

334334
export function getSharedDashboardLink(publicToken: string): string {
335+
const removeFileNameFromPath = (str: string) => {
336+
const idx = str.lastIndexOf('/')
337+
return idx !== -1 ? str.substring(0, idx) : str
338+
}
339+
335340
const checkmkUrl = new URL(window.parent.location.href ?? window.location.href)
336-
checkmkUrl.searchParams.set('cmk-token', `0:${publicToken}`)
337-
return checkmkUrl.toString()
341+
342+
return `${checkmkUrl.origin}${removeFileNameFromPath(checkmkUrl.pathname)}/shared_dashboard.py?=cmk-token=${publicToken}`
338343
}

0 commit comments

Comments
 (0)