[v9.4.x] Angular: Prevent angular from loading when disabled (#65777)
* Angular: Prevent angular from loading when disabled (#65755)
* Angular: Prevent angular from loading when disabled
* remove stuff
(cherry picked from commit 093498a03b)
* Update
---------
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
co-authored by
Torkel Ödegaard
parent
ecaeafd4f3
commit
f13eff4287
+1
-4
@@ -1,5 +1,5 @@
|
||||
// BETTERER RESULTS V2.
|
||||
//
|
||||
//
|
||||
// If this file contains merge conflicts, use `betterer merge` to automatically resolve them:
|
||||
// https://phenomnomnominal.github.io/betterer/docs/results-file/#merge
|
||||
//
|
||||
@@ -2128,9 +2128,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"]
|
||||
],
|
||||
"public/app/angular/services/nav_model_srv.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/angular/services/ng_react.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NavModel, NavModelItem } from '@grafana/data';
|
||||
import { NavModelItem } from '@grafana/data';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
import config from 'app/core/config';
|
||||
import { getNotFoundNav } from 'app/core/navigation/errorModels';
|
||||
|
||||
interface Nav {
|
||||
breadcrumbs: NavModelItem[];
|
||||
@@ -55,25 +56,4 @@ export class NavModelSrv {
|
||||
}
|
||||
}
|
||||
|
||||
export function getExceptionNav(error: any): NavModel {
|
||||
console.error(error);
|
||||
return getWarningNav('Exception thrown', 'See console for details');
|
||||
}
|
||||
|
||||
export function getNotFoundNav(): NavModel {
|
||||
return getWarningNav('Page not found', '404 Error');
|
||||
}
|
||||
|
||||
export function getWarningNav(text: string, subTitle?: string): NavModel {
|
||||
const node: NavModelItem = {
|
||||
text,
|
||||
subTitle,
|
||||
icon: 'exclamation-triangle',
|
||||
};
|
||||
return {
|
||||
node: node,
|
||||
main: node,
|
||||
};
|
||||
}
|
||||
|
||||
coreModule.service('navModelSrv', NavModelSrv);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { NavModel, NavModelItem } from '@grafana/data';
|
||||
|
||||
export function getExceptionNav(error: unknown): NavModel {
|
||||
console.error(error);
|
||||
return getWarningNav('Exception thrown', 'See console for details');
|
||||
}
|
||||
|
||||
export function getNotFoundNav(): NavModel {
|
||||
return getWarningNav('Page not found', '404 Error');
|
||||
}
|
||||
|
||||
export function getWarningNav(text: string, subTitle?: string): NavModel {
|
||||
const node: NavModelItem = {
|
||||
text,
|
||||
subTitle,
|
||||
icon: 'exclamation-triangle',
|
||||
};
|
||||
return {
|
||||
node: node,
|
||||
main: node,
|
||||
};
|
||||
}
|
||||
@@ -6,10 +6,10 @@ import { useLocation, useRouteMatch } from 'react-router-dom';
|
||||
|
||||
import { AppEvents, AppPlugin, AppPluginMeta, NavModel, NavModelItem, PluginType } from '@grafana/data';
|
||||
import { config, locationSearchToObject } from '@grafana/runtime';
|
||||
import { getNotFoundNav, getWarningNav, getExceptionNav } from 'app/angular/services/nav_model_srv';
|
||||
import { Page } from 'app/core/components/Page/Page';
|
||||
import PageLoader from 'app/core/components/PageLoader/PageLoader';
|
||||
import { appEvents } from 'app/core/core';
|
||||
import { getNotFoundNav, getWarningNav, getExceptionNav } from 'app/core/navigation/errorModels';
|
||||
|
||||
import { getPluginSettings } from '../pluginSettings';
|
||||
import { importAppPlugin } from '../plugin_loader';
|
||||
|
||||
Reference in New Issue
Block a user