-
-
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.
feat: Cleanup and empty pages for jobs, cronjobs and daemonsets
- Loading branch information
1 parent
5ccd520
commit 5d6e5a1
Showing
7 changed files
with
158 additions
and
17 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
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 { usePluginProps } from "utils/utils.plugin"; | ||
import { createTopLevelVariables, createTimeRange } from "../variableHelpers"; | ||
|
||
function getScene(cronJob: 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 CronJobPage(routeMatch: SceneRouteMatch<any>, parent: SceneAppPageLike) { | ||
|
||
const props = usePluginProps(); | ||
|
||
const variables = createTopLevelVariables({ | ||
datasource: props?.meta.jsonData?.datasource || 'prometheus' | ||
}) | ||
|
||
const timeRange = createTimeRange() | ||
|
||
return new SceneAppPage({ | ||
title: `CronJob - ${routeMatch.params.name}`, | ||
titleIcon: 'dashboard', | ||
$variables: variables, | ||
$timeRange: timeRange, | ||
url: prefixRoute(`${ROUTES.Workloads}/cronjobs/${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
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 { usePluginProps } from "utils/utils.plugin"; | ||
import { createTopLevelVariables, createTimeRange } from "../variableHelpers"; | ||
|
||
function getScene(daemonSet: 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 DaemonSetPage(routeMatch: SceneRouteMatch<any>, parent: SceneAppPageLike) { | ||
|
||
const props = usePluginProps(); | ||
|
||
const variables = createTopLevelVariables({ | ||
datasource: props?.meta.jsonData?.datasource || 'prometheus' | ||
}) | ||
|
||
const timeRange = createTimeRange() | ||
|
||
return new SceneAppPage({ | ||
title: `DaemonSet - ${routeMatch.params.name}`, | ||
titleIcon: 'dashboard', | ||
$variables: variables, | ||
$timeRange: timeRange, | ||
url: prefixRoute(`${ROUTES.Workloads}/daemonsets/${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 { usePluginProps } from "utils/utils.plugin"; | ||
import { createTopLevelVariables, createTimeRange } from "../variableHelpers"; | ||
|
||
function getScene(job: 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 JobPage(routeMatch: SceneRouteMatch<any>, parent: SceneAppPageLike) { | ||
|
||
const props = usePluginProps(); | ||
|
||
const variables = createTopLevelVariables({ | ||
datasource: props?.meta.jsonData?.datasource || 'prometheus' | ||
}) | ||
|
||
const timeRange = createTimeRange() | ||
|
||
return new SceneAppPage({ | ||
title: `Job - ${routeMatch.params.name}`, | ||
titleIcon: 'dashboard', | ||
$variables: variables, | ||
$timeRange: timeRange, | ||
url: prefixRoute(`${ROUTES.Workloads}/jobs/${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