mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 02:02:12 +08:00
DashboardScene: Support dashboard links (#77855)
* MenuItem: Allow react node as label * LinkButton: Expose ButtonLinkProps * Typecheck fix * DashboardLinks: Refactor and use LinkButton and menu * DashbaordLinks scene object * Use flex layout for dashboard controls * Update public/app/features/dashboard/components/SubMenu/DashboardLinksDashboard.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * fix keepTime and includeVars * Add ellipsis to menu item label and description * Use DashboardLink type from grafana/schema * Update dashboard scene controls layout * Fix e2e * Test fix * Bring back keyboard navigation * Remove unused code * One more fix --------- Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
@ -17,7 +17,6 @@ import {
|
||||
SceneRefreshPicker,
|
||||
SceneGridItem,
|
||||
SceneObject,
|
||||
SceneControlsSpacer,
|
||||
VizPanelMenu,
|
||||
behaviors,
|
||||
VizPanelState,
|
||||
@ -32,6 +31,8 @@ import { DashboardDTO } from 'app/types';
|
||||
|
||||
import { AlertStatesDataLayer } from '../scene/AlertStatesDataLayer';
|
||||
import { DashboardAnnotationsDataLayer } from '../scene/DashboardAnnotationsDataLayer';
|
||||
import { DashboardControls } from '../scene/DashboardControls';
|
||||
import { DashboardLinksControls } from '../scene/DashboardLinksControls';
|
||||
import { registerDashboardMacro } from '../scene/DashboardMacro';
|
||||
import { DashboardScene } from '../scene/DashboardScene';
|
||||
import { LibraryVizPanel } from '../scene/LibraryVizPanel';
|
||||
@ -215,23 +216,6 @@ export function createDashboardSceneFromDashboardModel(oldModel: DashboardModel)
|
||||
);
|
||||
}
|
||||
|
||||
let controls: SceneObject[] = [
|
||||
new VariableValueSelectors({}),
|
||||
...filtersSets,
|
||||
new SceneDataLayerControls(),
|
||||
new SceneControlsSpacer(),
|
||||
];
|
||||
|
||||
if (!Boolean(oldModel.timepicker.hidden)) {
|
||||
controls = controls.concat([
|
||||
new SceneTimePicker({}),
|
||||
new SceneRefreshPicker({
|
||||
refresh: oldModel.refresh,
|
||||
intervals: oldModel.timepicker.refresh_intervals,
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
return new DashboardScene({
|
||||
title: oldModel.title,
|
||||
uid: oldModel.uid,
|
||||
@ -261,7 +245,24 @@ export function createDashboardSceneFromDashboardModel(oldModel: DashboardModel)
|
||||
layers,
|
||||
})
|
||||
: undefined,
|
||||
controls: controls,
|
||||
controls: [
|
||||
new DashboardControls({
|
||||
variableControls: [new VariableValueSelectors({}), ...filtersSets, new SceneDataLayerControls()],
|
||||
timeControls: Boolean(oldModel.timepicker.hidden)
|
||||
? []
|
||||
: [
|
||||
new SceneTimePicker({}),
|
||||
new SceneRefreshPicker({
|
||||
refresh: oldModel.refresh,
|
||||
intervals: oldModel.timepicker.refresh_intervals,
|
||||
}),
|
||||
],
|
||||
linkControls: new DashboardLinksControls({
|
||||
links: oldModel.links,
|
||||
dashboardUID: oldModel.uid,
|
||||
}),
|
||||
}),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user