mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Angular: Prevent angular from loading when disabled (#65755)
* Angular: Prevent angular from loading when disabled * remove stuff
This commit is contained in:
parent
34f3878d26
commit
093498a03b
@ -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);
|
||||
|
22
public/app/core/navigation/errorModels.ts
Normal file
22
public/app/core/navigation/errorModels.ts
Normal 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,
|
||||
};
|
||||
}
|
@ -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';
|
||||
|
Loading…
Reference in New Issue
Block a user