From 1ed75f97099a0893088538755dcac7e90a52f855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 11 Apr 2023 19:19:25 +0200 Subject: [PATCH] PageNotFound: Update design so that it looks better in topnav (#66295) --- public/app/AppWrapper.tsx | 1 - .../core/components/ErrorPage/ErrorPage.tsx | 117 ++++++++++-------- .../dashboard/containers/DashboardPage.tsx | 2 +- public/app/routes/routes.tsx | 2 +- 4 files changed, 64 insertions(+), 58 deletions(-) diff --git a/public/app/AppWrapper.tsx b/public/app/AppWrapper.tsx index 715f1de4645..b126832386e 100644 --- a/public/app/AppWrapper.tsx +++ b/public/app/AppWrapper.tsx @@ -62,7 +62,6 @@ export class AppWrapper extends React.Component { - navigationLogger('AppWrapper', false, 'Rendering route', route, 'with match', props.location); // TODO[Router]: test this logic if (roles?.length) { if (!roles.some((r: string) => contextSrv.hasRole(r))) { diff --git a/public/app/core/components/ErrorPage/ErrorPage.tsx b/public/app/core/components/ErrorPage/ErrorPage.tsx index 9324111739a..65d934bd173 100644 --- a/public/app/core/components/ErrorPage/ErrorPage.tsx +++ b/public/app/core/components/ErrorPage/ErrorPage.tsx @@ -1,71 +1,78 @@ +import { css } from '@emotion/css'; import React from 'react'; -import { config } from '@grafana/runtime'; -import { Icon } from '@grafana/ui'; +import { GrafanaTheme2, PageLayoutType } from '@grafana/data'; +import { useStyles2 } from '@grafana/ui'; +import { VizLegendSeriesIcon } from '@grafana/ui/src/components/VizLegend/VizLegendSeriesIcon'; import { Page } from '../Page/Page'; export function ErrorPage() { + const styles = useStyles2(getStyles); + return ( - - -
-
-
-
-
-

100%

-

80%

-

60%

-

40%

-

20%

-

0%

-
-
- graph -
-

Then

-

Now

-
-
-
+ +
+

Page not found

+
+ We could not find the page you are looking for. If the issue persists seek help on the{' '} + + community site. + +
+ +
+
+
+

100%

+

80%

+

60%

+

40%

+

20%

+

0%

-
-
-

current

-
-
- -
-
-

Chances you are on the page you are looking for.

-

0%

-
-
-

Sorry for the inconvenience

-

- Please go back to your{' '} - - home dashboard - {' '} - and try again. -

-

- If the error persists, seek help on the{' '} - - community site - - . -

-
-
+
+ graph +
+

Then

+

Now

+
+ +
Chances you are on the page you are looking for (Last: 0%)
+
- +
); } -export default ErrorPage; +export function getStyles(theme: GrafanaTheme2) { + return { + container: css({ + display: 'flex', + flexDirection: 'column', + padding: theme.spacing(4), + }), + subtitle: css({ + color: theme.colors.text.secondary, + marginBottom: theme.spacing(2), + }), + panel: css({ + display: 'flex', + flexDirection: 'column', + maxWidth: '874px', + border: `1px solid ${theme.colors.border.weak}`, + borderRadius: theme.shape.borderRadius(), + padding: theme.spacing(2), + background: theme.colors.background.primary, + }), + legend: css({ + display: 'flex', + justifyContent: 'flex-end', + alignItems: 'center', + }), + }; +} diff --git a/public/app/features/dashboard/containers/DashboardPage.tsx b/public/app/features/dashboard/containers/DashboardPage.tsx index bdb77e9aa8d..d79868e7968 100644 --- a/public/app/features/dashboard/containers/DashboardPage.tsx +++ b/public/app/features/dashboard/containers/DashboardPage.tsx @@ -19,7 +19,7 @@ import { selectors } from '@grafana/e2e-selectors'; import { config, locationService } from '@grafana/runtime'; import { Icon, Themeable2, withTheme2 } from '@grafana/ui'; import { notifyApp } from 'app/core/actions'; -import ErrorPage from 'app/core/components/ErrorPage/ErrorPage'; +import { ErrorPage } from 'app/core/components/ErrorPage/ErrorPage'; import { Page } from 'app/core/components/Page/Page'; import { GrafanaContext, GrafanaContextType } from 'app/core/context/GrafanaContext'; import { createErrorNotification } from 'app/core/copy/appNotification'; diff --git a/public/app/routes/routes.tsx b/public/app/routes/routes.tsx index 1e452d773fd..f9b3e6ed981 100644 --- a/public/app/routes/routes.tsx +++ b/public/app/routes/routes.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Redirect } from 'react-router-dom'; import { NavLandingPage } from 'app/core/components/AppChrome/NavLandingPage'; -import ErrorPage from 'app/core/components/ErrorPage/ErrorPage'; +import { ErrorPage } from 'app/core/components/ErrorPage/ErrorPage'; import { LoginPage } from 'app/core/components/Login/LoginPage'; import config from 'app/core/config'; import { contextSrv } from 'app/core/services/context_srv';