mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Scenes: Add modal ref to custom tabs (#85602)
This commit is contained in:
parent
0a7abe4445
commit
3ef23a5e3e
@ -51,16 +51,17 @@ export class ShareModal extends SceneObjectBase<ShareModalState> implements Moda
|
|||||||
|
|
||||||
private buildTabs() {
|
private buildTabs() {
|
||||||
const { dashboardRef, panelRef } = this.state;
|
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);
|
const dashboard = getDashboardSceneFor(this);
|
||||||
|
|
||||||
if (!panelRef) {
|
if (!panelRef) {
|
||||||
tabs.push(new ShareExportTab({ dashboardRef, modalRef: this.getRef() }));
|
tabs.push(new ShareExportTab({ dashboardRef, modalRef }));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contextSrv.isSignedIn && config.snapshotEnabled && dashboard.canEditDashboard()) {
|
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) {
|
if (panelRef) {
|
||||||
@ -69,17 +70,17 @@ export class ShareModal extends SceneObjectBase<ShareModalState> implements Moda
|
|||||||
const isLibraryPanel = panel.parent instanceof LibraryVizPanel;
|
const isLibraryPanel = panel.parent instanceof LibraryVizPanel;
|
||||||
if (panel instanceof VizPanel) {
|
if (panel instanceof VizPanel) {
|
||||||
if (!isLibraryPanel) {
|
if (!isLibraryPanel) {
|
||||||
tabs.push(new ShareLibraryPanelTab({ panelRef, dashboardRef, modalRef: this.getRef() }));
|
tabs.push(new ShareLibraryPanelTab({ panelRef, dashboardRef, modalRef }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!panelRef) {
|
if (!panelRef) {
|
||||||
tabs.push(...customDashboardTabs.map((Tab) => new Tab({ dashboardRef })));
|
tabs.push(...customDashboardTabs.map((Tab) => new Tab({ dashboardRef, modalRef })));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPublicDashboardsEnabled()) {
|
if (isPublicDashboardsEnabled()) {
|
||||||
tabs.push(new SharePublicDashboardTab({ dashboardRef, modalRef: this.getRef() }));
|
tabs.push(new SharePublicDashboardTab({ dashboardRef, modalRef }));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ tabs });
|
this.setState({ tabs });
|
||||||
|
Loading…
Reference in New Issue
Block a user