-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix variable propagation between main and drilldown pages
- Loading branch information
1 parent
48808c5
commit 4a51d23
Showing
7 changed files
with
186 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { EmbeddedScene, SceneAppPage, SceneAppPageLike, SceneControlsSpacer, SceneFlexLayout, SceneRefreshPicker, SceneRouteMatch, SceneTimePicker, VariableValueSelectors, sceneGraph } from "@grafana/scenes"; | ||
import { ROUTES } from "../../../constants"; | ||
import { prefixRoute } from "utils/utils.routing"; | ||
import { usePluginProps } from "utils/utils.plugin"; | ||
import { createTopLevelVariables, createTimeRange } from "../variableHelpers"; | ||
|
||
function getScene(deployment: string) { | ||
return new EmbeddedScene({ | ||
controls: [ | ||
new VariableValueSelectors({}), | ||
new SceneControlsSpacer(), | ||
new SceneTimePicker({ isOnCanvas: true }), | ||
new SceneRefreshPicker({ | ||
intervals: ['5s', '1m', '1h'], | ||
isOnCanvas: true, | ||
}), | ||
], | ||
body: new SceneFlexLayout({ | ||
direction: 'column', | ||
children: [] | ||
}), | ||
}) | ||
} | ||
|
||
export function getDeploymentPage(routeMatch: SceneRouteMatch<any>, parent: SceneAppPageLike) { | ||
|
||
const props = usePluginProps(); | ||
|
||
const variables = createTopLevelVariables({ | ||
datasource: props?.meta.jsonData?.datasource || 'prometheus' | ||
}) | ||
|
||
const timeRange = createTimeRange() | ||
|
||
return new SceneAppPage({ | ||
title: `Deployment - ${routeMatch.params.name}`, | ||
titleIcon: 'dashboard', | ||
$variables: variables, | ||
$timeRange: timeRange, | ||
url: prefixRoute(`${ROUTES.Workloads}/deployments/${routeMatch.params.name}`), | ||
getScene: () => getScene(routeMatch.params.name), | ||
getParentPage: () => parent, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { EmbeddedScene, SceneAppPage, SceneAppPageLike, SceneControlsSpacer, SceneFlexLayout, SceneRefreshPicker, SceneRouteMatch, SceneTimePicker, VariableValueSelectors } from "@grafana/scenes"; | ||
import { ROUTES } from "../../../constants"; | ||
import { prefixRoute } from "utils/utils.routing"; | ||
import { createTimeRange, createTopLevelVariables } from "../variableHelpers"; | ||
import { usePluginProps } from "utils/utils.plugin"; | ||
|
||
function getScene(statefulSet: string) { | ||
return new EmbeddedScene({ | ||
controls: [ | ||
new VariableValueSelectors({}), | ||
new SceneControlsSpacer(), | ||
new SceneTimePicker({ isOnCanvas: true }), | ||
new SceneRefreshPicker({ | ||
intervals: ['5s', '1m', '1h'], | ||
isOnCanvas: true, | ||
}), | ||
], | ||
body: new SceneFlexLayout({ | ||
direction: 'column', | ||
children: [] | ||
}), | ||
}) | ||
} | ||
|
||
export function getStatefulSetPage(routeMatch: SceneRouteMatch<any>, parent: SceneAppPageLike) { | ||
|
||
const props = usePluginProps(); | ||
|
||
const variables = createTopLevelVariables({ | ||
datasource: props?.meta.jsonData?.datasource || 'prometheus' | ||
}) | ||
|
||
const timeRange = createTimeRange() | ||
|
||
return new SceneAppPage({ | ||
title: `StatefulSet - ${routeMatch.params.name}`, | ||
titleIcon: 'dashboard', | ||
$variables: variables, | ||
$timeRange: timeRange, | ||
url: prefixRoute(`${ROUTES.Workloads}/statefulsets/${routeMatch.params.name}`), | ||
getScene: () => getScene(routeMatch.params.name), | ||
getParentPage: () => parent, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters