mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-02-21 10:01:44 +00:00
Merge pull request #690 from GNS3/angular-onpush
Introducing onPush strategy
This commit is contained in:
commit
3c722f3baa
@ -1,4 +1,4 @@
|
||||
import { Component, Input } from "@angular/core";
|
||||
import { Component, Input, ChangeDetectionStrategy } from "@angular/core";
|
||||
import { Project } from '../../../models/project';
|
||||
import { Server } from '../../../models/server';
|
||||
import { NodeService } from '../../../services/node.service';
|
||||
@ -11,7 +11,8 @@ import { ServerService } from '../../../services/server.service';
|
||||
@Component({
|
||||
selector: 'app-nodes-menu',
|
||||
templateUrl: './nodes-menu.component.html',
|
||||
styleUrls: ['./nodes-menu.component.scss']
|
||||
styleUrls: ['./nodes-menu.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class NodesMenuComponent {
|
||||
@Input('project') project: Project;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, OnDestroy, Input } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy, Input, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Project } from '../../../models/project';
|
||||
import { Server } from '../../../models/server';
|
||||
import { ToolsService } from '../../../services/tools.service';
|
||||
@ -14,11 +14,11 @@ import { ScreenshotDialogComponent, Screenshot } from '../screenshot-dialog/scre
|
||||
import { saveAsPng, saveAsJpeg } from 'save-html-as-image';
|
||||
import { ThemeService } from '../../../services/theme.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-map-menu',
|
||||
templateUrl: './project-map-menu.component.html',
|
||||
styleUrls: ['./project-map-menu.component.scss']
|
||||
styleUrls: ['./project-map-menu.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class ProjectMapMenuComponent implements OnInit, OnDestroy {
|
||||
@Input() project: Project;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, OnDestroy, Input, AfterViewInit, Output, EventEmitter } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy, Input, AfterViewInit, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Project } from '../../models/project';
|
||||
import { Server } from '../../models/server';
|
||||
import { NodesDataSource } from '../../cartography/datasources/nodes-datasource';
|
||||
@ -16,7 +16,8 @@ import { ThemeService } from '../../services/theme.service';
|
||||
@Component({
|
||||
selector: 'app-topology-summary',
|
||||
templateUrl: './topology-summary.component.html',
|
||||
styleUrls: ['./topology-summary.component.scss']
|
||||
styleUrls: ['./topology-summary.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.Default
|
||||
})
|
||||
export class TopologySummaryComponent implements OnInit, OnDestroy {
|
||||
@Input() server: Server;
|
||||
|
14
src/main.ts
14
src/main.ts
@ -1,14 +1,20 @@
|
||||
import 'hammerjs';
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { enableProdMode, ApplicationRef } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
import { enableDebugTools } from '@angular/platform-browser';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic()
|
||||
.bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.then(moduleRef => {
|
||||
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…
x
Reference in New Issue
Block a user