Skip to content

Commit

Permalink
Feat: new deployment page on route
Browse files Browse the repository at this point in the history
  • Loading branch information
luckylooky2 committed Mar 8, 2024
1 parent 2b09e7a commit edd3f94
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,4 +633,7 @@ func (hs *HTTPServer) registerRoutes() {
r.Get("/api/snapshots/:key", routing.Wrap(hs.GetDashboardSnapshot))
r.Get("/api/snapshots-delete/:deleteKey", reqSnapshotPublicModeOrSignedIn, routing.Wrap(hs.DeleteDashboardSnapshotByDeleteKey))
r.Delete("/api/snapshots/:key", reqSignedIn, routing.Wrap(hs.DeleteDashboardSnapshot))

// deployment
r.Get("/deployment/", reqSignedIn, hs.Index)
}
15 changes: 15 additions & 0 deletions public/app/features/deployment/Deployment.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';

import { PageLayoutType } from '@grafana/data';

import { Page } from '../../core/components/Page/Page';

const Deployment = () => {
return (
<Page navId="home" layout={PageLayoutType.Canvas} pageNav={{ text: 'Page not found' }}>
<div>this is deployment page</div>
</Page>
);
};

export default Deployment;
20 changes: 20 additions & 0 deletions public/app/features/deployment/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { SafeDynamicImport } from '../../core/components/DynamicImports/SafeDynamicImport';
import { config } from '../../core/config';
import { RouteDescriptor } from '../../core/navigation/types';

export const getPublicDeploymentRoutes = (): RouteDescriptor[] => {
if (!config.publicDashboardsEnabled || !config.featureToggles.publicDashboards) {
return [];
}

return [
{
path: '/deployment',
pageClass: 'deployment',
routeName: 'deployment',
component: SafeDynamicImport(
() => import(/* webpackChunkName: "ListPublicDashboardPage" */ '../../features/deployment/Deployment')
),
},
];
};
10 changes: 10 additions & 0 deletions public/app/routes/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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 { getPublicDeploymentRoutes } from '../features/deployment/routes';

export const extraRoutes: RouteDescriptor[] = [];

Expand Down Expand Up @@ -486,6 +487,14 @@ export function getAppRoutes(): RouteDescriptor[] {
),
},
// {
// path: '/deployment',
// pageClass: 'page-dashboard',
// routeName: DashboardRoutes.Home,
// component: SafeDynamicImport(
// () => import(/* webpackChunkName: "DashboardPageProxy" */ '../features/deployment/Deployment')
// ),
// },
// {
// path: '/explore/metrics',
// chromeless: false,
// exact: false,
Expand All @@ -499,6 +508,7 @@ export function getAppRoutes(): RouteDescriptor[] {
// ...getProfileRoutes(),
...extraRoutes,
...getPublicDashboardRoutes(),
...getPublicDeploymentRoutes(),
// ...getDataConnectionsRoutes(),
{
path: '/*',
Expand Down

0 comments on commit edd3f94

Please sign in to comment.