Browse Source

Merge pull request #5034 from kalutkaz/AssetsEditModFix

[3.3.0] Fixed asset disappears menu
pull/5039/head
Igor Kulikov 5 years ago
committed by GitHub
parent
commit
49a156846d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      ui-ngx/src/app/modules/home/components/entity/contact-based.component.ts
  2. 6
      ui-ngx/src/app/modules/home/components/entity/entity.component.ts
  3. 7
      ui-ngx/src/app/modules/home/components/profile/device-profile.component.ts
  4. 7
      ui-ngx/src/app/modules/home/components/profile/tenant-profile.component.ts
  5. 11
      ui-ngx/src/app/modules/home/pages/admin/resource/resources-library.component.ts
  6. 7
      ui-ngx/src/app/modules/home/pages/asset/asset.component.ts
  7. 7
      ui-ngx/src/app/modules/home/pages/customer/customer.component.ts
  8. 7
      ui-ngx/src/app/modules/home/pages/dashboard/dashboard-form.component.ts
  9. 7
      ui-ngx/src/app/modules/home/pages/device/device.component.ts
  10. 7
      ui-ngx/src/app/modules/home/pages/edge/edge.component.ts
  11. 7
      ui-ngx/src/app/modules/home/pages/entity-view/entity-view.component.ts
  12. 7
      ui-ngx/src/app/modules/home/pages/ota-update/ota-update.component.ts
  13. 7
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.ts
  14. 7
      ui-ngx/src/app/modules/home/pages/tenant/tenant.component.ts
  15. 7
      ui-ngx/src/app/modules/home/pages/user/user.component.ts
  16. 7
      ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.ts

7
ui-ngx/src/app/modules/home/components/entity/contact-based.component.ts

@ -18,7 +18,7 @@ import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms';
import { ContactBased } from '@shared/models/contact-based.model';
import { AfterViewInit, Directive } from '@angular/core';
import { AfterViewInit, ChangeDetectorRef, Directive } from '@angular/core';
import { POSTAL_CODE_PATTERNS } from '@home/models/contact.models';
import { HasId } from '@shared/models/base-data';
import { EntityComponent } from './entity.component';
@ -30,8 +30,9 @@ export abstract class ContactBasedComponent<T extends ContactBased<HasId>> exten
protected constructor(protected store: Store<AppState>,
protected fb: FormBuilder,
protected entityValue: T,
protected entitiesTableConfigValue: EntityTableConfig<T>) {
super(store, fb, entityValue, entitiesTableConfigValue);
protected entitiesTableConfigValue: EntityTableConfig<T>,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
buildForm(entity: T): FormGroup {

6
ui-ngx/src/app/modules/home/components/entity/entity.component.ts

@ -17,7 +17,7 @@
import { BaseData, HasId } from '@shared/models/base-data';
import { FormBuilder, FormGroup } from '@angular/forms';
import { PageComponent } from '@shared/components/page.component';
import { Directive, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ChangeDetectorRef, Directive, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityAction } from '@home/models/entity/entity-component.models';
@ -50,6 +50,7 @@ export abstract class EntityComponent<T extends BaseData<HasId>,
@Input()
set isEdit(isEdit: boolean) {
this.isEditValue = isEdit;
this.cd.markForCheck();
this.updateFormState();
}
@ -80,7 +81,8 @@ export abstract class EntityComponent<T extends BaseData<HasId>,
protected constructor(protected store: Store<AppState>,
protected fb: FormBuilder,
protected entityValue: T,
protected entitiesTableConfigValue: C) {
protected entitiesTableConfigValue: C,
protected cd: ChangeDetectorRef) {
super(store);
this.entityForm = this.buildForm(this.entityValue);
}

7
ui-ngx/src/app/modules/home/components/profile/device-profile.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject, Input, Optional } from '@angular/core';
import { ChangeDetectorRef, Component, Inject, Input, Optional } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@ -77,8 +77,9 @@ export class DeviceProfileComponent extends EntityComponent<DeviceProfile> {
protected translate: TranslateService,
@Optional() @Inject('entity') protected entityValue: DeviceProfile,
@Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<DeviceProfile>,
protected fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
protected fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
hideDelete() {

7
ui-ngx/src/app/modules/home/components/profile/tenant-profile.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject, Input, Optional } from '@angular/core';
import { ChangeDetectorRef, Component, Inject, Input, Optional } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@ -43,8 +43,9 @@ export class TenantProfileComponent extends EntityComponent<TenantProfile> {
protected translate: TranslateService,
@Optional() @Inject('entity') protected entityValue: TenantProfile,
@Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<TenantProfile>,
protected fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
protected fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
hideDelete() {

11
ui-ngx/src/app/modules/home/pages/admin/resource/resources-library.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
import { ChangeDetectorRef, Component, Inject, OnDestroy, OnInit } from '@angular/core';
import { Subject } from 'rxjs';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
@ -30,7 +30,7 @@ import {
ResourceTypeTranslationMap
} from '@shared/models/resource.models';
import { pairwise, startWith, takeUntil } from 'rxjs/operators';
import { ActionNotificationShow } from "@core/notification/notification.actions";
import { ActionNotificationShow } from '@core/notification/notification.actions';
@Component({
selector: 'tb-resources-library',
@ -48,8 +48,9 @@ export class ResourcesLibraryComponent extends EntityComponent<Resource> impleme
protected translate: TranslateService,
@Inject('entity') protected entityValue: Resource,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<Resource>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
ngOnInit() {
@ -102,7 +103,7 @@ export class ResourcesLibraryComponent extends EntityComponent<Resource> impleme
if (this.isAdd) {
form.addControl('data', this.fb.control(null, Validators.required));
}
return form
return form;
}
updateForm(entity: Resource) {

7
ui-ngx/src/app/modules/home/pages/asset/asset.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject } from '@angular/core';
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityComponent } from '../../components/entity/entity.component';
@ -41,8 +41,9 @@ export class AssetComponent extends EntityComponent<AssetInfo> {
protected translate: TranslateService,
@Inject('entity') protected entityValue: AssetInfo,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<AssetInfo>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
ngOnInit() {

7
ui-ngx/src/app/modules/home/pages/customer/customer.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject } from '@angular/core';
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@ -42,8 +42,9 @@ export class CustomerComponent extends ContactBasedComponent<Customer> {
protected translate: TranslateService,
@Inject('entity') protected entityValue: Customer,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<Customer>,
protected fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
protected fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
hideDelete() {

7
ui-ngx/src/app/modules/home/pages/dashboard/dashboard-form.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject } from '@angular/core';
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityComponent } from '../../components/entity/entity.component';
@ -49,8 +49,9 @@ export class DashboardFormComponent extends EntityComponent<Dashboard> {
private dashboardService: DashboardService,
@Inject('entity') protected entityValue: Dashboard,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<Dashboard>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
ngOnInit() {

7
ui-ngx/src/app/modules/home/pages/device/device.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject } from '@angular/core';
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityComponent } from '../../components/entity/entity.component';
@ -56,8 +56,9 @@ export class DeviceComponent extends EntityComponent<DeviceInfo> {
protected translate: TranslateService,
@Inject('entity') protected entityValue: DeviceInfo,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<DeviceInfo>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
ngOnInit() {

7
ui-ngx/src/app/modules/home/pages/edge/edge.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject } from '@angular/core';
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityComponent } from '@home/components/entity/entity.component';
@ -42,8 +42,9 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
protected translate: TranslateService,
@Inject('entity') protected entityValue: EdgeInfo,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<EdgeInfo>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
ngOnInit() {

7
ui-ngx/src/app/modules/home/pages/entity-view/entity-view.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject } from '@angular/core';
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityComponent } from '../../components/entity/entity.component';
@ -53,8 +53,9 @@ export class EntityViewComponent extends EntityComponent<EntityViewInfo> {
protected translate: TranslateService,
@Inject('entity') protected entityValue: EntityViewInfo,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<EntityViewInfo>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
ngOnInit() {

7
ui-ngx/src/app/modules/home/pages/ota-update/ota-update.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
import { ChangeDetectorRef, Component, Inject, OnDestroy, OnInit } from '@angular/core';
import { combineLatest, Subject } from 'rxjs';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
@ -50,8 +50,9 @@ export class OtaUpdateComponent extends EntityComponent<OtaPackage> implements O
protected translate: TranslateService,
@Inject('entity') protected entityValue: OtaPackage,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<OtaPackage>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
ngOnInit() {

7
ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject } from '@angular/core';
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityComponent } from '../../components/entity/entity.component';
@ -37,8 +37,9 @@ export class RuleChainComponent extends EntityComponent<RuleChain> {
protected translate: TranslateService,
@Inject('entity') protected entityValue: RuleChain,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<RuleChain>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
ngOnInit() {

7
ui-ngx/src/app/modules/home/pages/tenant/tenant.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject } from '@angular/core';
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@ -36,8 +36,9 @@ export class TenantComponent extends ContactBasedComponent<TenantInfo> {
protected translate: TranslateService,
@Inject('entity') protected entityValue: TenantInfo,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<TenantInfo>,
protected fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
protected fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
hideDelete() {

7
ui-ngx/src/app/modules/home/pages/user/user.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject, Optional } from '@angular/core';
import { ChangeDetectorRef, Component, Inject, Optional } from '@angular/core';
import { select, Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityComponent } from '../../components/entity/entity.component';
@ -43,8 +43,9 @@ export class UserComponent extends EntityComponent<User> {
constructor(protected store: Store<AppState>,
@Optional() @Inject('entity') protected entityValue: User,
@Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<User>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
hideDelete() {

7
ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Inject } from '@angular/core';
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityComponent } from '../../components/entity/entity.component';
@ -32,8 +32,9 @@ export class WidgetsBundleComponent extends EntityComponent<WidgetsBundle> {
constructor(protected store: Store<AppState>,
@Inject('entity') protected entityValue: WidgetsBundle,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<WidgetsBundle>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
hideDelete() {

Loading…
Cancel
Save