Angular: Prevent angular from loading when disabled (#65755)

* Angular: Prevent angular from loading when disabled

* remove stuff
This commit is contained in:
Torkel Ödegaard 2023-04-03 10:45:22 +02:00 committed by GitHub
parent 34f3878d26
commit 093498a03b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 23 deletions

View File

@ -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);

View File

@ -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,
};
}

View File

@ -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';