mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* Reducing wrapping divs from RenderingService * Applying more styles to .kbnAppWrapper Some being temporary and will need a better solution when introducing the page layout component * Almost fixing tests for rendering service Can’t figure out how to have a optional Observable `Received: "kbnAppWrapper class-name”` * Adding some comments * [Dashboard] Using the APP_WRAPPER_CLASS * fix test & ts types * Fixin a few more tests that were using `.app-wrapper` * Creating docs for new var and cleaning up some selectors * Fixing reporting * Fixing banner position and truncation * Fixed CSS error in loading screen and jump in animation * Fixing selectors in Canvas * Remove unused var * Added `APP_WRAPPER_CLASS` export from `server` and updated reporting to use it * Fix monitoring icon clicks * move APP_WRAPPER_CLASS definition to src/core/common * Fixing Monitoring snapshots and wrapper class * Moved `APP_WRAPPER_CLASS` utils but exported from `public` and `server` * Remove old folder * Fix dashboard test by only showing HR in edit mode Co-authored-by: pgayvallet Co-authored-by: tsullivan
83 lines
2.3 KiB
TypeScript
83 lines
2.3 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import angular, { IModule } from 'angular';
|
|
import { uiRoutes } from './helpers/routes';
|
|
import { Legacy } from '../legacy_shims';
|
|
import { configureAppAngularModule } from '../../../../../src/plugins/kibana_legacy/public';
|
|
import { localAppModule, appModuleName } from './app_modules';
|
|
import { APP_WRAPPER_CLASS } from '../../../../../src/core/public';
|
|
|
|
import { MonitoringStartPluginDependencies } from '../types';
|
|
|
|
export class AngularApp {
|
|
private injector?: angular.auto.IInjectorService;
|
|
|
|
constructor(deps: MonitoringStartPluginDependencies) {
|
|
const {
|
|
core,
|
|
element,
|
|
data,
|
|
navigation,
|
|
isCloud,
|
|
pluginInitializerContext,
|
|
externalConfig,
|
|
triggersActionsUi,
|
|
usageCollection,
|
|
kibanaLegacy,
|
|
} = deps;
|
|
const app: IModule = localAppModule(deps);
|
|
app.run(($injector: angular.auto.IInjectorService) => {
|
|
this.injector = $injector;
|
|
Legacy.init(
|
|
{
|
|
core,
|
|
element,
|
|
data,
|
|
navigation,
|
|
isCloud,
|
|
pluginInitializerContext,
|
|
externalConfig,
|
|
kibanaLegacy,
|
|
triggersActionsUi,
|
|
usageCollection,
|
|
},
|
|
this.injector
|
|
);
|
|
});
|
|
|
|
app.config(($routeProvider: unknown) => uiRoutes.addToProvider($routeProvider));
|
|
|
|
const np = { core, env: pluginInitializerContext.env };
|
|
configureAppAngularModule(app, np, true);
|
|
const appElement = document.createElement('div');
|
|
appElement.setAttribute('style', 'height: 100%');
|
|
appElement.innerHTML = '<div ng-view style="height: 100%" id="monitoring-angular-app"></div>';
|
|
|
|
if (!element.classList.contains(APP_WRAPPER_CLASS)) {
|
|
element.classList.add(APP_WRAPPER_CLASS);
|
|
}
|
|
|
|
angular.bootstrap(appElement, [appModuleName]);
|
|
angular.element(element).append(appElement);
|
|
}
|
|
|
|
public destroy = () => {
|
|
if (this.injector) {
|
|
this.injector.get('$rootScope').$destroy();
|
|
}
|
|
};
|
|
|
|
public applyScope = () => {
|
|
if (!this.injector) {
|
|
return;
|
|
}
|
|
|
|
const rootScope = this.injector.get('$rootScope');
|
|
rootScope.$applyAsync();
|
|
};
|
|
}
|