POC/Provisioning: Update provisioning routes (#97019)
* Update routes * Allow nested routes * Remove nested dry run
This commit is contained in:
1 parent
3640752dd0
commit
d937ec237e
5 files changed
+65
-32
No files matched your search
@@ -21,7 +21,8 @@ export interface Props
|
||||
|
||||
export function DashboardScenePage({ route, queryParams, location }: Props) {
|
||||
const params = useParams();
|
||||
const { type, slug, uid, path } = params;
|
||||
const { type, slug, uid } = params;
|
||||
const path = params['*'];
|
||||
const prevMatch = usePrevious({ params });
|
||||
const stateManager = getDashboardScenePageStateManager();
|
||||
const { dashboard, isLoading, loadError } = stateManager.useState();
|
||||
@@ -33,7 +34,7 @@ export function DashboardScenePage({ route, queryParams, location }: Props) {
|
||||
stateManager.loadSnapshot(slug!);
|
||||
} else {
|
||||
stateManager.loadDashboard({
|
||||
uid: path ?? uid ?? '',
|
||||
uid: (route.routeName === DashboardRoutes.Provisioning ? path : uid) ?? '',
|
||||
slug: slug,
|
||||
route: route.routeName as DashboardRoutes,
|
||||
urlFolderUid: queryParams.folderUid,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { css } from '@emotion/css';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { Card, EmptySearchResult, EmptyState, FilterInput, LinkButton, Stack } from '@grafana/ui';
|
||||
import { Card, EmptySearchResult, EmptyState, FilterInput, LinkButton, Stack, TextLink } from '@grafana/ui';
|
||||
import { Page } from 'app/core/components/Page/Page';
|
||||
|
||||
import { Resource } from '../apiserver/types';
|
||||
@@ -54,11 +54,13 @@ function RepositoryListPageContent({ items }: { items?: Array<Resource<Repositor
|
||||
return (
|
||||
<Card key={item.metadata.name} className={css({ alignItems: 'center' })}>
|
||||
<Stack direction={'column'}>
|
||||
<Card.Heading>{item.spec.title}</Card.Heading>
|
||||
<Card.Heading>
|
||||
<TextLink href={`${PROVISIONING_URL}/${item.metadata.name}`}>{item.spec.title}</TextLink>
|
||||
</Card.Heading>
|
||||
<Card.Meta>{item.spec.type}</Card.Meta>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<LinkButton variant="secondary" href={`${PROVISIONING_URL}/edit/${item.metadata.name}`}>
|
||||
<LinkButton variant="secondary" href={`${PROVISIONING_URL}/${item.metadata.name}/edit`}>
|
||||
Edit
|
||||
</LinkButton>
|
||||
<DeleteRepositoryButton name={item.metadata.name} />
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Page } from 'app/core/components/Page/Page';
|
||||
|
||||
export default function RepositoryStatusPage() {
|
||||
return (
|
||||
<Page
|
||||
navId="provisioning"
|
||||
pageNav={{ text: 'Repository status', subTitle: 'Check the status of a configured repository.' }}
|
||||
>
|
||||
<Page.Contents>
|
||||
<div>Repository status</div>
|
||||
</Page.Contents>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { SafeDynamicImport } from 'app/core/components/DynamicImports/SafeDynamicImport';
|
||||
import { RouteDescriptor } from 'app/core/navigation/types';
|
||||
import { DashboardRoutes } from 'app/types';
|
||||
|
||||
export function getProvisioningRoutes(): RouteDescriptor[] {
|
||||
return [
|
||||
{
|
||||
path: '/admin/provisioning',
|
||||
component: SafeDynamicImport(
|
||||
() => import(/* webpackChunkName: "RepositoryListPage"*/ 'app/features/provisioning/RepositoryListPage')
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/admin/provisioning/new',
|
||||
component: SafeDynamicImport(
|
||||
() => import(/* webpackChunkName: "NewRepositoryPage"*/ 'app/features/provisioning/NewRepositoryPage')
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/admin/provisioning/:name',
|
||||
component: SafeDynamicImport(
|
||||
() => import(/* webpackChunkName: "RepositoryStatusPage"*/ 'app/features/provisioning/RepositoryStatusPage')
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/admin/provisioning/:name/edit',
|
||||
component: SafeDynamicImport(
|
||||
() => import(/* webpackChunkName: "EditRepositoryPage"*/ 'app/features/provisioning/EditRepositoryPage')
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/admin/provisioning/:slug/dashboard/preview/*',
|
||||
pageClass: 'page-dashboard',
|
||||
routeName: DashboardRoutes.Provisioning,
|
||||
component: SafeDynamicImport(
|
||||
() =>
|
||||
import(/* webpackChunkName: "DashboardScenePage" */ 'app/features/dashboard-scene/pages/DashboardScenePage')
|
||||
),
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import { AccessControlAction, DashboardRoutes } from 'app/types';
|
||||
import { SafeDynamicImport } from '../core/components/DynamicImports/SafeDynamicImport';
|
||||
import { RouteDescriptor } from '../core/navigation/types';
|
||||
import { getPublicDashboardRoutes } from '../features/dashboard/routes';
|
||||
import { getProvisioningRoutes } from '../features/provisioning/utils/routes';
|
||||
|
||||
const isDevEnv = config.buildInfo.env === 'development';
|
||||
export const extraRoutes: RouteDescriptor[] = [];
|
||||
@@ -63,15 +64,6 @@ export function getAppRoutes(): RouteDescriptor[] {
|
||||
() => import(/* webpackChunkName: "DashboardPage" */ '../features/dashboard/containers/NewDashboardWithDS')
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/dashboard/provisioning/:slug/:path/*',
|
||||
pageClass: 'page-dashboard',
|
||||
routeName: DashboardRoutes.Provisioning,
|
||||
component: SafeDynamicImport(
|
||||
() =>
|
||||
import(/* webpackChunkName: "DashboardScenePage" */ '../features/dashboard-scene/pages/DashboardScenePage')
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/dashboard/:type/:slug',
|
||||
pageClass: 'page-dashboard',
|
||||
@@ -535,24 +527,6 @@ export function getAppRoutes(): RouteDescriptor[] {
|
||||
() => import(/* webpackChunkName: "BookmarksPage"*/ 'app/features/bookmarks/BookmarksPage')
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/admin/provisioning',
|
||||
component: SafeDynamicImport(
|
||||
() => import(/* webpackChunkName: "RepositoryListPage"*/ 'app/features/provisioning/RepositoryListPage')
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/admin/provisioning/new',
|
||||
component: SafeDynamicImport(
|
||||
() => import(/* webpackChunkName: "NewRepositoryPage"*/ 'app/features/provisioning/NewRepositoryPage')
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/admin/provisioning/edit/:name',
|
||||
component: SafeDynamicImport(
|
||||
() => import(/* webpackChunkName: "EditRepositoryPage"*/ 'app/features/provisioning/EditRepositoryPage')
|
||||
),
|
||||
},
|
||||
...getPluginCatalogRoutes(),
|
||||
...getSupportBundleRoutes(),
|
||||
...getAlertingRoutes(),
|
||||
@@ -560,6 +534,7 @@ export function getAppRoutes(): RouteDescriptor[] {
|
||||
...extraRoutes,
|
||||
...getPublicDashboardRoutes(),
|
||||
...getDataConnectionsRoutes(),
|
||||
...getProvisioningRoutes(),
|
||||
{
|
||||
path: '/goto/*',
|
||||
component: HandleGoToRedirect,
|
||||
|
||||
Reference in new issue
Block a user