Scenes: Add modal ref to custom tabs (#85602)

This commit is contained in:
Agnès Toulet 2024-04-05 09:28:10 +02:00 committed by GitHub
parent 0a7abe4445
commit 3ef23a5e3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -51,16 +51,17 @@ export class ShareModal extends SceneObjectBase<ShareModalState> implements Moda
private buildTabs() {
const { dashboardRef, panelRef } = this.state;
const modalRef = this.getRef();
const tabs: SceneShareTab[] = [new ShareLinkTab({ dashboardRef, panelRef, modalRef: this.getRef() })];
const tabs: SceneShareTab[] = [new ShareLinkTab({ dashboardRef, panelRef, modalRef })];
const dashboard = getDashboardSceneFor(this);
if (!panelRef) {
tabs.push(new ShareExportTab({ dashboardRef, modalRef: this.getRef() }));
tabs.push(new ShareExportTab({ dashboardRef, modalRef }));
}
if (contextSrv.isSignedIn && config.snapshotEnabled && dashboard.canEditDashboard()) {
tabs.push(new ShareSnapshotTab({ panelRef, dashboardRef, modalRef: this.getRef() }));
tabs.push(new ShareSnapshotTab({ panelRef, dashboardRef, modalRef }));
}
if (panelRef) {
@ -69,17 +70,17 @@ export class ShareModal extends SceneObjectBase<ShareModalState> implements Moda
const isLibraryPanel = panel.parent instanceof LibraryVizPanel;
if (panel instanceof VizPanel) {
if (!isLibraryPanel) {
tabs.push(new ShareLibraryPanelTab({ panelRef, dashboardRef, modalRef: this.getRef() }));
tabs.push(new ShareLibraryPanelTab({ panelRef, dashboardRef, modalRef }));
}
}
}
if (!panelRef) {
tabs.push(...customDashboardTabs.map((Tab) => new Tab({ dashboardRef })));
tabs.push(...customDashboardTabs.map((Tab) => new Tab({ dashboardRef, modalRef })));
}
if (isPublicDashboardsEnabled()) {
tabs.push(new SharePublicDashboardTab({ dashboardRef, modalRef: this.getRef() }));
tabs.push(new SharePublicDashboardTab({ dashboardRef, modalRef }));
}
this.setState({ tabs });