|
|
@ -34,6 +34,7 @@ import { ActionNotificationShow } from '@core/notification/notification.actions' |
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; |
|
|
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; |
|
|
import { Subject } from 'rxjs'; |
|
|
import { Subject } from 'rxjs'; |
|
|
|
|
|
import { FirmwareType } from '@shared/models/firmware.models'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'tb-device', |
|
|
selector: 'tb-device', |
|
|
@ -48,6 +49,8 @@ export class DeviceComponent extends EntityComponent<DeviceInfo> { |
|
|
|
|
|
|
|
|
deviceScope: 'tenant' | 'customer' | 'customer_user' | 'edge'; |
|
|
deviceScope: 'tenant' | 'customer' | 'customer_user' | 'edge'; |
|
|
|
|
|
|
|
|
|
|
|
firmwareTypes = FirmwareType; |
|
|
|
|
|
|
|
|
constructor(protected store: Store<AppState>, |
|
|
constructor(protected store: Store<AppState>, |
|
|
protected translate: TranslateService, |
|
|
protected translate: TranslateService, |
|
|
@Inject('entity') protected entityValue: DeviceInfo, |
|
|
@Inject('entity') protected entityValue: DeviceInfo, |
|
|
@ -80,6 +83,7 @@ export class DeviceComponent extends EntityComponent<DeviceInfo> { |
|
|
name: [entity ? entity.name : '', [Validators.required]], |
|
|
name: [entity ? entity.name : '', [Validators.required]], |
|
|
deviceProfileId: [entity ? entity.deviceProfileId : null, [Validators.required]], |
|
|
deviceProfileId: [entity ? entity.deviceProfileId : null, [Validators.required]], |
|
|
firmwareId: [entity ? entity.firmwareId : null], |
|
|
firmwareId: [entity ? entity.firmwareId : null], |
|
|
|
|
|
softwareId: [entity ? entity.softwareId : null], |
|
|
label: [entity ? entity.label : ''], |
|
|
label: [entity ? entity.label : ''], |
|
|
deviceData: [entity ? entity.deviceData : null, [Validators.required]], |
|
|
deviceData: [entity ? entity.deviceData : null, [Validators.required]], |
|
|
additionalInfo: this.fb.group( |
|
|
additionalInfo: this.fb.group( |
|
|
@ -94,19 +98,19 @@ export class DeviceComponent extends EntityComponent<DeviceInfo> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
updateForm(entity: DeviceInfo) { |
|
|
updateForm(entity: DeviceInfo) { |
|
|
this.entityForm.patchValue({name: entity.name}); |
|
|
|
|
|
this.entityForm.patchValue({deviceProfileId: entity.deviceProfileId}); |
|
|
|
|
|
this.entityForm.patchValue({firmwareId: entity.firmwareId}); |
|
|
|
|
|
this.entityForm.patchValue({label: entity.label}); |
|
|
|
|
|
this.entityForm.patchValue({deviceData: entity.deviceData}); |
|
|
|
|
|
this.entityForm.patchValue({ |
|
|
this.entityForm.patchValue({ |
|
|
additionalInfo: |
|
|
name: entity.name, |
|
|
{ |
|
|
deviceProfileId: entity.deviceProfileId, |
|
|
gateway: entity.additionalInfo ? entity.additionalInfo.gateway : false, |
|
|
firmwareId: entity.firmwareId, |
|
|
overwriteActivityTime: entity.additionalInfo ? entity.additionalInfo.overwriteActivityTime : false |
|
|
softwareId: entity.softwareId, |
|
|
} |
|
|
label: entity.label, |
|
|
|
|
|
deviceData: entity.deviceData, |
|
|
|
|
|
additionalInfo: { |
|
|
|
|
|
gateway: entity.additionalInfo ? entity.additionalInfo.gateway : false, |
|
|
|
|
|
overwriteActivityTime: entity.additionalInfo ? entity.additionalInfo.overwriteActivityTime : false, |
|
|
|
|
|
description: entity.additionalInfo ? entity.additionalInfo.description : '' |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
this.entityForm.patchValue({additionalInfo: {description: entity.additionalInfo ? entity.additionalInfo.description : ''}}); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -152,6 +156,10 @@ export class DeviceComponent extends EntityComponent<DeviceInfo> { |
|
|
this.entityForm.markAsDirty(); |
|
|
this.entityForm.markAsDirty(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
this.entityForm.patchValue({ |
|
|
|
|
|
firmwareId: null, |
|
|
|
|
|
softwareId: null |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|