use OnPush change detection

pull/7954/head
ulferts 5 years ago
parent 935f1ce59c
commit 2c6044bd98
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 3
      frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts
  2. 3
      frontend/src/app/modules/time_entries/create/create.modal.ts
  3. 3
      frontend/src/app/modules/time_entries/edit/edit.modal.ts
  4. 8
      frontend/src/app/modules/time_entries/form/form.component.ts

@ -1,4 +1,4 @@
import {Component, ElementRef, Input, OnDestroy, OnInit, SecurityContext, ViewChild, AfterViewInit, Output, EventEmitter, Injector, ViewEncapsulation} from "@angular/core";
import {Component, ElementRef, Input, OnDestroy, OnInit, SecurityContext, ViewChild, AfterViewInit, Output, EventEmitter, Injector, ViewEncapsulation, ChangeDetectionStrategy} from "@angular/core";
import {FullCalendarComponent} from '@fullcalendar/angular';
import {States} from "core-components/states.service";
import * as moment from "moment";
@ -49,6 +49,7 @@ interface CalendarMoveEvent {
styleUrls: ['./te-calendar.component.sass'],
selector: 'te-calendar',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
TimeEntryEditService,
TimeEntryCreateService,

@ -1,4 +1,4 @@
import {Component, ElementRef, Inject, ChangeDetectorRef, ViewChild} from "@angular/core";
import {Component, ElementRef, Inject, ChangeDetectorRef, ViewChild, ChangeDetectionStrategy} from "@angular/core";
import {OpModalComponent} from "app/components/op-modals/op-modal.component";
import {OpModalLocalsToken} from "app/components/op-modals/op-modal.service";
import {OpModalLocalsMap} from "app/components/op-modals/op-modal.types";
@ -11,6 +11,7 @@ import {TimeEntryFormComponent} from "core-app/modules/time_entries/form/form.co
@Component({
templateUrl: './create.modal.html',
styleUrls: ['../edit/edit.modal.sass'],
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
HalResourceEditingService
]

@ -1,4 +1,4 @@
import {Component, ElementRef, Inject, ChangeDetectorRef} from "@angular/core";
import {Component, ElementRef, Inject, ChangeDetectorRef, ChangeDetectionStrategy} from "@angular/core";
import {OpModalComponent} from "app/components/op-modals/op-modal.component";
import {OpModalLocalsToken} from "app/components/op-modals/op-modal.service";
import {OpModalLocalsMap} from "app/components/op-modals/op-modal.types";
@ -11,6 +11,7 @@ import {SchemaResource} from "core-app/modules/hal/resources/schema-resource";
@Component({
templateUrl: './edit.modal.html',
styleUrls: ['./edit.modal.sass'],
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
HalResourceEditingService
]

@ -1,7 +1,7 @@
import {HalResourceEditingService} from "core-app/modules/fields/edit/services/hal-resource-editing.service";
import {TimeEntryResource} from "core-app/modules/hal/resources/time-entry-resource";
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import { ViewEncapsulation, Component, Input, EventEmitter, Output, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { ViewEncapsulation, Component, Input, EventEmitter, Output, OnInit, OnDestroy, ViewChild, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { untilComponentDestroyed } from 'ng2-rx-componentdestroyed';
import {SchemaResource} from "core-app/modules/hal/resources/schema-resource";
import {HalResource} from "core-app/modules/hal/resources/hal-resource";
@ -10,7 +10,8 @@ import { EditFormComponent } from 'core-app/modules/fields/edit/edit-form/edit-f
@Component({
templateUrl: './form.component.html',
selector: 'te-form',
encapsulation: ViewEncapsulation.None
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TimeEntryFormComponent implements OnInit, OnDestroy {
@Input() entry:TimeEntryResource;
@ -34,6 +35,7 @@ export class TimeEntryFormComponent implements OnInit, OnDestroy {
public customFields:{key:string, label:string}[] = [];
constructor(readonly halEditing:HalResourceEditingService,
readonly cdRef:ChangeDetectorRef,
readonly i18n:I18nService) {
}
@ -47,10 +49,12 @@ export class TimeEntryFormComponent implements OnInit, OnDestroy {
.subscribe(changeset => {
if (changeset && changeset.workPackage) {
this.workPackageSelected = true;
this.cdRef.markForCheck();
}
});
this.setCustomFields(this.entry.schema);
this.cdRef.detectChanges();
}
ngOnDestroy() {

Loading…
Cancel
Save