mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
Merge pull request #37499 from tspmelo/wip-ng-profiler
mgr/dashboard: Enable Angular's debug tools when using dev mode Reviewed-by: Alfonso Martínez <almartin@redhat.com> Reviewed-by: Ernesto Puerta <epuertat@redhat.com> Reviewed-by: Volker Theile <vtheile@suse.com>
This commit is contained in:
commit
48825c5eef
@ -1,4 +1,5 @@
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { ApplicationRef, enableProdMode, isDevMode } from '@angular/core';
|
||||
import { enableDebugTools } from '@angular/platform-browser';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
@ -10,4 +11,13 @@ if (environment.production) {
|
||||
|
||||
platformBrowserDynamic()
|
||||
.bootstrapModule(AppModule)
|
||||
.then((moduleRef) => {
|
||||
if (isDevMode()) {
|
||||
// source: https://medium.com/@dmitrymogilko/profiling-angular-change-detection-c00605862b9f
|
||||
const applicationRef = moduleRef.injector.get(ApplicationRef);
|
||||
const componentRef = applicationRef.components[0];
|
||||
// allows to run `ng.profiler.timeChangeDetection();`
|
||||
enableDebugTools(componentRef);
|
||||
}
|
||||
})
|
||||
.catch((err) => console.log(err));
|
||||
|
Loading…
Reference in New Issue
Block a user