Commit 31f7ec98792899a679ec571d3195f09d8a4ceb9a

Authored by Kalutka Zhenya
1 parent e4bfbacd

Fixed asset disappears menu

... ... @@ -18,7 +18,7 @@ import { Store } from '@ngrx/store';
18 18 import { AppState } from '@core/core.state';
19 19 import { FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms';
20 20 import { ContactBased } from '@shared/models/contact-based.model';
21   -import { AfterViewInit, Directive } from '@angular/core';
  21 +import { AfterViewInit, ChangeDetectorRef, Directive } from '@angular/core';
22 22 import { POSTAL_CODE_PATTERNS } from '@home/models/contact.models';
23 23 import { HasId } from '@shared/models/base-data';
24 24 import { EntityComponent } from './entity.component';
... ... @@ -30,8 +30,9 @@ export abstract class ContactBasedComponent<T extends ContactBased<HasId>> exten
30 30 protected constructor(protected store: Store<AppState>,
31 31 protected fb: FormBuilder,
32 32 protected entityValue: T,
33   - protected entitiesTableConfigValue: EntityTableConfig<T>) {
34   - super(store, fb, entityValue, entitiesTableConfigValue);
  33 + protected entitiesTableConfigValue: EntityTableConfig<T>,
  34 + protected cd: ChangeDetectorRef) {
  35 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
35 36 }
36 37
37 38 buildForm(entity: T): FormGroup {
... ...
... ... @@ -17,7 +17,7 @@
17 17 import { BaseData, HasId } from '@shared/models/base-data';
18 18 import { FormBuilder, FormGroup } from '@angular/forms';
19 19 import { PageComponent } from '@shared/components/page.component';
20   -import { Directive, EventEmitter, Input, OnInit, Output } from '@angular/core';
  20 +import { ChangeDetectorRef, Directive, EventEmitter, Input, OnInit, Output } from '@angular/core';
21 21 import { Store } from '@ngrx/store';
22 22 import { AppState } from '@core/core.state';
23 23 import { EntityAction } from '@home/models/entity/entity-component.models';
... ... @@ -80,7 +80,8 @@ export abstract class EntityComponent<T extends BaseData<HasId>,
80 80 protected constructor(protected store: Store<AppState>,
81 81 protected fb: FormBuilder,
82 82 protected entityValue: T,
83   - protected entitiesTableConfigValue: C) {
  83 + protected entitiesTableConfigValue: C,
  84 + protected cd: ChangeDetectorRef) {
84 85 super(store);
85 86 this.entityForm = this.buildForm(this.entityValue);
86 87 }
... ... @@ -106,6 +107,7 @@ export abstract class EntityComponent<T extends BaseData<HasId>,
106 107 } else {
107 108 this.entityForm.disable({emitEvent: false});
108 109 }
  110 + this.cd.markForCheck();
109 111 }
110 112 }
111 113
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject, Input, Optional } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject, Input, Optional } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
... ... @@ -77,8 +77,9 @@ export class DeviceProfileComponent extends EntityComponent<DeviceProfile> {
77 77 protected translate: TranslateService,
78 78 @Optional() @Inject('entity') protected entityValue: DeviceProfile,
79 79 @Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<DeviceProfile>,
80   - protected fb: FormBuilder) {
81   - super(store, fb, entityValue, entitiesTableConfigValue);
  80 + protected fb: FormBuilder,
  81 + protected cd: ChangeDetectorRef) {
  82 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
82 83 }
83 84
84 85 hideDelete() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject, Input, Optional } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject, Input, Optional } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
... ... @@ -43,8 +43,9 @@ export class TenantProfileComponent extends EntityComponent<TenantProfile> {
43 43 protected translate: TranslateService,
44 44 @Optional() @Inject('entity') protected entityValue: TenantProfile,
45 45 @Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<TenantProfile>,
46   - protected fb: FormBuilder) {
47   - super(store, fb, entityValue, entitiesTableConfigValue);
  46 + protected fb: FormBuilder,
  47 + protected cd: ChangeDetectorRef) {
  48 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
48 49 }
49 50
50 51 hideDelete() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject, OnDestroy, OnInit } from '@angular/core';
18 18 import { Subject } from 'rxjs';
19 19 import { Store } from '@ngrx/store';
20 20 import { AppState } from '@core/core.state';
... ... @@ -30,7 +30,7 @@ import {
30 30 ResourceTypeTranslationMap
31 31 } from '@shared/models/resource.models';
32 32 import { pairwise, startWith, takeUntil } from 'rxjs/operators';
33   -import { ActionNotificationShow } from "@core/notification/notification.actions";
  33 +import { ActionNotificationShow } from '@core/notification/notification.actions';
34 34
35 35 @Component({
36 36 selector: 'tb-resources-library',
... ... @@ -48,8 +48,9 @@ export class ResourcesLibraryComponent extends EntityComponent<Resource> impleme
48 48 protected translate: TranslateService,
49 49 @Inject('entity') protected entityValue: Resource,
50 50 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<Resource>,
51   - public fb: FormBuilder) {
52   - super(store, fb, entityValue, entitiesTableConfigValue);
  51 + public fb: FormBuilder,
  52 + protected cd: ChangeDetectorRef) {
  53 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
53 54 }
54 55
55 56 ngOnInit() {
... ... @@ -102,7 +103,7 @@ export class ResourcesLibraryComponent extends EntityComponent<Resource> impleme
102 103 if (this.isAdd) {
103 104 form.addControl('data', this.fb.control(null, Validators.required));
104 105 }
105   - return form
  106 + return form;
106 107 }
107 108
108 109 updateForm(entity: Resource) {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { EntityComponent } from '../../components/entity/entity.component';
... ... @@ -41,8 +41,9 @@ export class AssetComponent extends EntityComponent<AssetInfo> {
41 41 protected translate: TranslateService,
42 42 @Inject('entity') protected entityValue: AssetInfo,
43 43 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<AssetInfo>,
44   - public fb: FormBuilder) {
45   - super(store, fb, entityValue, entitiesTableConfigValue);
  44 + public fb: FormBuilder,
  45 + protected cd: ChangeDetectorRef) {
  46 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
46 47 }
47 48
48 49 ngOnInit() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
... ... @@ -42,8 +42,9 @@ export class CustomerComponent extends ContactBasedComponent<Customer> {
42 42 protected translate: TranslateService,
43 43 @Inject('entity') protected entityValue: Customer,
44 44 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<Customer>,
45   - protected fb: FormBuilder) {
46   - super(store, fb, entityValue, entitiesTableConfigValue);
  45 + protected fb: FormBuilder,
  46 + protected cd: ChangeDetectorRef) {
  47 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
47 48 }
48 49
49 50 hideDelete() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { EntityComponent } from '../../components/entity/entity.component';
... ... @@ -49,8 +49,9 @@ export class DashboardFormComponent extends EntityComponent<Dashboard> {
49 49 private dashboardService: DashboardService,
50 50 @Inject('entity') protected entityValue: Dashboard,
51 51 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<Dashboard>,
52   - public fb: FormBuilder) {
53   - super(store, fb, entityValue, entitiesTableConfigValue);
  52 + public fb: FormBuilder,
  53 + protected cd: ChangeDetectorRef) {
  54 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
54 55 }
55 56
56 57 ngOnInit() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { EntityComponent } from '../../components/entity/entity.component';
... ... @@ -56,8 +56,9 @@ export class DeviceComponent extends EntityComponent<DeviceInfo> {
56 56 protected translate: TranslateService,
57 57 @Inject('entity') protected entityValue: DeviceInfo,
58 58 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<DeviceInfo>,
59   - public fb: FormBuilder) {
60   - super(store, fb, entityValue, entitiesTableConfigValue);
  59 + public fb: FormBuilder,
  60 + protected cd: ChangeDetectorRef) {
  61 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
61 62 }
62 63
63 64 ngOnInit() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { EntityComponent } from '@home/components/entity/entity.component';
... ... @@ -42,8 +42,9 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
42 42 protected translate: TranslateService,
43 43 @Inject('entity') protected entityValue: EdgeInfo,
44 44 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<EdgeInfo>,
45   - public fb: FormBuilder) {
46   - super(store, fb, entityValue, entitiesTableConfigValue);
  45 + public fb: FormBuilder,
  46 + protected cd: ChangeDetectorRef) {
  47 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
47 48 }
48 49
49 50 ngOnInit() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { EntityComponent } from '../../components/entity/entity.component';
... ... @@ -53,8 +53,9 @@ export class EntityViewComponent extends EntityComponent<EntityViewInfo> {
53 53 protected translate: TranslateService,
54 54 @Inject('entity') protected entityValue: EntityViewInfo,
55 55 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<EntityViewInfo>,
56   - public fb: FormBuilder) {
57   - super(store, fb, entityValue, entitiesTableConfigValue);
  56 + public fb: FormBuilder,
  57 + protected cd: ChangeDetectorRef) {
  58 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
58 59 }
59 60
60 61 ngOnInit() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject, OnDestroy, OnInit } from '@angular/core';
18 18 import { combineLatest, Subject } from 'rxjs';
19 19 import { Store } from '@ngrx/store';
20 20 import { AppState } from '@core/core.state';
... ... @@ -50,8 +50,9 @@ export class OtaUpdateComponent extends EntityComponent<OtaPackage> implements O
50 50 protected translate: TranslateService,
51 51 @Inject('entity') protected entityValue: OtaPackage,
52 52 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<OtaPackage>,
53   - public fb: FormBuilder) {
54   - super(store, fb, entityValue, entitiesTableConfigValue);
  53 + public fb: FormBuilder,
  54 + protected cd: ChangeDetectorRef) {
  55 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
55 56 }
56 57
57 58 ngOnInit() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { EntityComponent } from '../../components/entity/entity.component';
... ... @@ -37,8 +37,9 @@ export class RuleChainComponent extends EntityComponent<RuleChain> {
37 37 protected translate: TranslateService,
38 38 @Inject('entity') protected entityValue: RuleChain,
39 39 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<RuleChain>,
40   - public fb: FormBuilder) {
41   - super(store, fb, entityValue, entitiesTableConfigValue);
  40 + public fb: FormBuilder,
  41 + protected cd: ChangeDetectorRef) {
  42 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
42 43 }
43 44
44 45 ngOnInit() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
... ... @@ -36,8 +36,9 @@ export class TenantComponent extends ContactBasedComponent<TenantInfo> {
36 36 protected translate: TranslateService,
37 37 @Inject('entity') protected entityValue: TenantInfo,
38 38 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<TenantInfo>,
39   - protected fb: FormBuilder) {
40   - super(store, fb, entityValue, entitiesTableConfigValue);
  39 + protected fb: FormBuilder,
  40 + protected cd: ChangeDetectorRef) {
  41 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
41 42 }
42 43
43 44 hideDelete() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject, Optional } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject, Optional } from '@angular/core';
18 18 import { select, Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { EntityComponent } from '../../components/entity/entity.component';
... ... @@ -43,8 +43,9 @@ export class UserComponent extends EntityComponent<User> {
43 43 constructor(protected store: Store<AppState>,
44 44 @Optional() @Inject('entity') protected entityValue: User,
45 45 @Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<User>,
46   - public fb: FormBuilder) {
47   - super(store, fb, entityValue, entitiesTableConfigValue);
  46 + public fb: FormBuilder,
  47 + protected cd: ChangeDetectorRef) {
  48 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
48 49 }
49 50
50 51 hideDelete() {
... ...
... ... @@ -14,7 +14,7 @@
14 14 /// limitations under the License.
15 15 ///
16 16
17   -import { Component, Inject } from '@angular/core';
  17 +import { ChangeDetectorRef, Component, Inject } from '@angular/core';
18 18 import { Store } from '@ngrx/store';
19 19 import { AppState } from '@core/core.state';
20 20 import { EntityComponent } from '../../components/entity/entity.component';
... ... @@ -32,8 +32,9 @@ export class WidgetsBundleComponent extends EntityComponent<WidgetsBundle> {
32 32 constructor(protected store: Store<AppState>,
33 33 @Inject('entity') protected entityValue: WidgetsBundle,
34 34 @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<WidgetsBundle>,
35   - public fb: FormBuilder) {
36   - super(store, fb, entityValue, entitiesTableConfigValue);
  35 + public fb: FormBuilder,
  36 + protected cd: ChangeDetectorRef) {
  37 + super(store, fb, entityValue, entitiesTableConfigValue, cd);
37 38 }
38 39
39 40 hideDelete() {
... ...