Angular: Isolate angular more (#41440)

* Getting close

* Restore angular app boot at startup

* Moving angular annotations dependencies to app/angular or old graph

* Remove redundant setLinkSrv call

* Fixing graph test

* Minor refactor based on review feedback

* Create in get function
This commit is contained in:
Torkel Ödegaard
2021-11-10 11:05:36 +01:00
committed by GitHub
parent e7fd41d779
commit c96c92d712
51 changed files with 201 additions and 227 deletions
+4 -11
View File
@@ -15,6 +15,7 @@ import { GrafanaRoute } from './core/navigation/GrafanaRoute';
import { AppNotificationList } from './core/components/AppNotifications/AppNotificationList';
import { SearchWrapper } from 'app/features/search';
import { LiveConnectionWarning } from './features/live/LiveConnectionWarning';
import { AngularRoot } from './angular/AngularRoot';
interface AppWrapperProps {
app: GrafanaApp;
@@ -57,6 +58,7 @@ export class AppWrapper extends React.Component<AppWrapperProps, AppWrapperState
bootstrapNgApp() {
const injector = this.props.app.angularApp.bootstrap();
this.setState({ ngInjector: injector });
$('.preloader').remove();
}
renderRoute = (route: RouteDescriptor) => {
@@ -89,8 +91,6 @@ export class AppWrapper extends React.Component<AppWrapperProps, AppWrapperState
render() {
navigationLogger('AppWrapper', false, 'rendering');
// @ts-ignore
const appSeed = `<grafana-app ng-cloak></app-notifications-list></grafana-app>`;
const newNavigationEnabled = config.featureToggles.newNavigation;
return (
@@ -108,17 +108,10 @@ export class AppWrapper extends React.Component<AppWrapperProps, AppWrapperState
<Banner key={index.toString()} />
))}
<div
id="ngRoot"
ref={this.container}
dangerouslySetInnerHTML={{
__html: appSeed,
}}
/>
<AngularRoot ref={this.container} />
<AppNotificationList />
<SearchWrapper />
{this.state.ngInjector && this.container && this.renderRoutes()}
{this.state.ngInjector && this.renderRoutes()}
{bodyRenderHooks.map((Hook, index) => (
<Hook key={index.toString()} />
))}