30 changed files with 734 additions and 78 deletions
@ -0,0 +1,24 @@ |
|||||
|
<!-- |
||||
|
|
||||
|
Copyright © 2016-2020 The Thingsboard Authors |
||||
|
|
||||
|
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
you may not use this file except in compliance with the License. |
||||
|
You may obtain a copy of the License at |
||||
|
|
||||
|
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
|
||||
|
Unless required by applicable law or agreed to in writing, software |
||||
|
distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
See the License for the specific language governing permissions and |
||||
|
limitations under the License. |
||||
|
|
||||
|
--> |
||||
|
<form [formGroup]="lwm2mDeviceProfileTransportConfigurationFormGroup" style="padding-bottom: 16px;"> |
||||
|
<tb-json-object-edit |
||||
|
[required]="required" |
||||
|
label="{{ 'device-profile.transport-type-lwm2m' | translate }}" |
||||
|
formControlName="configuration"> |
||||
|
</tb-json-object-edit> |
||||
|
</form> |
||||
@ -0,0 +1,96 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2020 The Thingsboard Authors
|
||||
|
///
|
||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
/// you may not use this file except in compliance with the License.
|
||||
|
/// You may obtain a copy of the License at
|
||||
|
///
|
||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
///
|
||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
/// See the License for the specific language governing permissions and
|
||||
|
/// limitations under the License.
|
||||
|
///
|
||||
|
|
||||
|
import { Component, forwardRef, Input, OnInit } from '@angular/core'; |
||||
|
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; |
||||
|
import { Store } from '@ngrx/store'; |
||||
|
import { AppState } from '@app/core/core.state'; |
||||
|
import { coerceBooleanProperty } from '@angular/cdk/coercion'; |
||||
|
import { |
||||
|
DeviceProfileTransportConfiguration, |
||||
|
DeviceTransportType, Lwm2mDeviceProfileTransportConfiguration |
||||
|
} from '@shared/models/device.models'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'tb-lwm2m-device-profile-transport-configuration', |
||||
|
templateUrl: './lwm2m-device-profile-transport-configuration.component.html', |
||||
|
styleUrls: [], |
||||
|
providers: [{ |
||||
|
provide: NG_VALUE_ACCESSOR, |
||||
|
useExisting: forwardRef(() => Lwm2mDeviceProfileTransportConfigurationComponent), |
||||
|
multi: true |
||||
|
}] |
||||
|
}) |
||||
|
export class Lwm2mDeviceProfileTransportConfigurationComponent implements ControlValueAccessor, OnInit { |
||||
|
|
||||
|
lwm2mDeviceProfileTransportConfigurationFormGroup: FormGroup; |
||||
|
|
||||
|
private requiredValue: boolean; |
||||
|
get required(): boolean { |
||||
|
return this.requiredValue; |
||||
|
} |
||||
|
@Input() |
||||
|
set required(value: boolean) { |
||||
|
this.requiredValue = coerceBooleanProperty(value); |
||||
|
} |
||||
|
|
||||
|
@Input() |
||||
|
disabled: boolean; |
||||
|
|
||||
|
private propagateChange = (v: any) => { }; |
||||
|
|
||||
|
constructor(private store: Store<AppState>, |
||||
|
private fb: FormBuilder) { |
||||
|
} |
||||
|
|
||||
|
registerOnChange(fn: any): void { |
||||
|
this.propagateChange = fn; |
||||
|
} |
||||
|
|
||||
|
registerOnTouched(fn: any): void { |
||||
|
} |
||||
|
|
||||
|
ngOnInit() { |
||||
|
this.lwm2mDeviceProfileTransportConfigurationFormGroup = this.fb.group({ |
||||
|
configuration: [null, Validators.required] |
||||
|
}); |
||||
|
this.lwm2mDeviceProfileTransportConfigurationFormGroup.valueChanges.subscribe(() => { |
||||
|
this.updateModel(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
setDisabledState(isDisabled: boolean): void { |
||||
|
this.disabled = isDisabled; |
||||
|
if (this.disabled) { |
||||
|
this.lwm2mDeviceProfileTransportConfigurationFormGroup.disable({emitEvent: false}); |
||||
|
} else { |
||||
|
this.lwm2mDeviceProfileTransportConfigurationFormGroup.enable({emitEvent: false}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
writeValue(value: Lwm2mDeviceProfileTransportConfiguration | null): void { |
||||
|
this.lwm2mDeviceProfileTransportConfigurationFormGroup.patchValue({configuration: value}, {emitEvent: false}); |
||||
|
} |
||||
|
|
||||
|
private updateModel() { |
||||
|
let configuration: DeviceProfileTransportConfiguration = null; |
||||
|
if (this.lwm2mDeviceProfileTransportConfigurationFormGroup.valid) { |
||||
|
configuration = this.lwm2mDeviceProfileTransportConfigurationFormGroup.getRawValue().configuration; |
||||
|
configuration.type = DeviceTransportType.LWM2M; |
||||
|
} |
||||
|
this.propagateChange(configuration); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
<!-- |
||||
|
|
||||
|
Copyright © 2016-2020 The Thingsboard Authors |
||||
|
|
||||
|
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
you may not use this file except in compliance with the License. |
||||
|
You may obtain a copy of the License at |
||||
|
|
||||
|
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
|
||||
|
Unless required by applicable law or agreed to in writing, software |
||||
|
distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
See the License for the specific language governing permissions and |
||||
|
limitations under the License. |
||||
|
|
||||
|
--> |
||||
|
<form [formGroup]="mqttDeviceProfileTransportConfigurationFormGroup" style="padding-bottom: 16px;"> |
||||
|
<tb-json-object-edit |
||||
|
[required]="required" |
||||
|
label="{{ 'device-profile.transport-type-mqtt' | translate }}" |
||||
|
formControlName="configuration"> |
||||
|
</tb-json-object-edit> |
||||
|
</form> |
||||
@ -0,0 +1,96 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2020 The Thingsboard Authors
|
||||
|
///
|
||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
/// you may not use this file except in compliance with the License.
|
||||
|
/// You may obtain a copy of the License at
|
||||
|
///
|
||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
///
|
||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
/// See the License for the specific language governing permissions and
|
||||
|
/// limitations under the License.
|
||||
|
///
|
||||
|
|
||||
|
import { Component, forwardRef, Input, OnInit } from '@angular/core'; |
||||
|
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; |
||||
|
import { Store } from '@ngrx/store'; |
||||
|
import { AppState } from '@app/core/core.state'; |
||||
|
import { coerceBooleanProperty } from '@angular/cdk/coercion'; |
||||
|
import { |
||||
|
DeviceProfileTransportConfiguration, |
||||
|
DeviceTransportType, MqttDeviceProfileTransportConfiguration |
||||
|
} from '@shared/models/device.models'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'tb-mqtt-device-profile-transport-configuration', |
||||
|
templateUrl: './mqtt-device-profile-transport-configuration.component.html', |
||||
|
styleUrls: [], |
||||
|
providers: [{ |
||||
|
provide: NG_VALUE_ACCESSOR, |
||||
|
useExisting: forwardRef(() => MqttDeviceProfileTransportConfigurationComponent), |
||||
|
multi: true |
||||
|
}] |
||||
|
}) |
||||
|
export class MqttDeviceProfileTransportConfigurationComponent implements ControlValueAccessor, OnInit { |
||||
|
|
||||
|
mqttDeviceProfileTransportConfigurationFormGroup: FormGroup; |
||||
|
|
||||
|
private requiredValue: boolean; |
||||
|
get required(): boolean { |
||||
|
return this.requiredValue; |
||||
|
} |
||||
|
@Input() |
||||
|
set required(value: boolean) { |
||||
|
this.requiredValue = coerceBooleanProperty(value); |
||||
|
} |
||||
|
|
||||
|
@Input() |
||||
|
disabled: boolean; |
||||
|
|
||||
|
private propagateChange = (v: any) => { }; |
||||
|
|
||||
|
constructor(private store: Store<AppState>, |
||||
|
private fb: FormBuilder) { |
||||
|
} |
||||
|
|
||||
|
registerOnChange(fn: any): void { |
||||
|
this.propagateChange = fn; |
||||
|
} |
||||
|
|
||||
|
registerOnTouched(fn: any): void { |
||||
|
} |
||||
|
|
||||
|
ngOnInit() { |
||||
|
this.mqttDeviceProfileTransportConfigurationFormGroup = this.fb.group({ |
||||
|
configuration: [null, Validators.required] |
||||
|
}); |
||||
|
this.mqttDeviceProfileTransportConfigurationFormGroup.valueChanges.subscribe(() => { |
||||
|
this.updateModel(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
setDisabledState(isDisabled: boolean): void { |
||||
|
this.disabled = isDisabled; |
||||
|
if (this.disabled) { |
||||
|
this.mqttDeviceProfileTransportConfigurationFormGroup.disable({emitEvent: false}); |
||||
|
} else { |
||||
|
this.mqttDeviceProfileTransportConfigurationFormGroup.enable({emitEvent: false}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
writeValue(value: MqttDeviceProfileTransportConfiguration | null): void { |
||||
|
this.mqttDeviceProfileTransportConfigurationFormGroup.patchValue({configuration: value}, {emitEvent: false}); |
||||
|
} |
||||
|
|
||||
|
private updateModel() { |
||||
|
let configuration: DeviceProfileTransportConfiguration = null; |
||||
|
if (this.mqttDeviceProfileTransportConfigurationFormGroup.valid) { |
||||
|
configuration = this.mqttDeviceProfileTransportConfigurationFormGroup.getRawValue().configuration; |
||||
|
configuration.type = DeviceTransportType.MQTT; |
||||
|
} |
||||
|
this.propagateChange(configuration); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
<!-- |
||||
|
|
||||
|
Copyright © 2016-2020 The Thingsboard Authors |
||||
|
|
||||
|
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
you may not use this file except in compliance with the License. |
||||
|
You may obtain a copy of the License at |
||||
|
|
||||
|
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
|
||||
|
Unless required by applicable law or agreed to in writing, software |
||||
|
distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
See the License for the specific language governing permissions and |
||||
|
limitations under the License. |
||||
|
|
||||
|
--> |
||||
|
<form [formGroup]="lwm2mDeviceTransportConfigurationFormGroup" style="padding-bottom: 16px;"> |
||||
|
<tb-json-object-edit |
||||
|
[required]="required" |
||||
|
label="{{ 'device-profile.transport-type-lwm2m' | translate }}" |
||||
|
formControlName="configuration"> |
||||
|
</tb-json-object-edit> |
||||
|
</form> |
||||
@ -0,0 +1,96 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2020 The Thingsboard Authors
|
||||
|
///
|
||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
/// you may not use this file except in compliance with the License.
|
||||
|
/// You may obtain a copy of the License at
|
||||
|
///
|
||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
///
|
||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
/// See the License for the specific language governing permissions and
|
||||
|
/// limitations under the License.
|
||||
|
///
|
||||
|
|
||||
|
import { Component, forwardRef, Input, OnInit } from '@angular/core'; |
||||
|
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; |
||||
|
import { Store } from '@ngrx/store'; |
||||
|
import { AppState } from '@app/core/core.state'; |
||||
|
import { coerceBooleanProperty } from '@angular/cdk/coercion'; |
||||
|
import { |
||||
|
DeviceTransportConfiguration, |
||||
|
DeviceTransportType, Lwm2mDeviceTransportConfiguration |
||||
|
} from '@shared/models/device.models'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'tb-lwm2m-device-transport-configuration', |
||||
|
templateUrl: './lwm2m-device-transport-configuration.component.html', |
||||
|
styleUrls: [], |
||||
|
providers: [{ |
||||
|
provide: NG_VALUE_ACCESSOR, |
||||
|
useExisting: forwardRef(() => Lwm2mDeviceTransportConfigurationComponent), |
||||
|
multi: true |
||||
|
}] |
||||
|
}) |
||||
|
export class Lwm2mDeviceTransportConfigurationComponent implements ControlValueAccessor, OnInit { |
||||
|
|
||||
|
lwm2mDeviceTransportConfigurationFormGroup: FormGroup; |
||||
|
|
||||
|
private requiredValue: boolean; |
||||
|
get required(): boolean { |
||||
|
return this.requiredValue; |
||||
|
} |
||||
|
@Input() |
||||
|
set required(value: boolean) { |
||||
|
this.requiredValue = coerceBooleanProperty(value); |
||||
|
} |
||||
|
|
||||
|
@Input() |
||||
|
disabled: boolean; |
||||
|
|
||||
|
private propagateChange = (v: any) => { }; |
||||
|
|
||||
|
constructor(private store: Store<AppState>, |
||||
|
private fb: FormBuilder) { |
||||
|
} |
||||
|
|
||||
|
registerOnChange(fn: any): void { |
||||
|
this.propagateChange = fn; |
||||
|
} |
||||
|
|
||||
|
registerOnTouched(fn: any): void { |
||||
|
} |
||||
|
|
||||
|
ngOnInit() { |
||||
|
this.lwm2mDeviceTransportConfigurationFormGroup = this.fb.group({ |
||||
|
configuration: [null, Validators.required] |
||||
|
}); |
||||
|
this.lwm2mDeviceTransportConfigurationFormGroup.valueChanges.subscribe(() => { |
||||
|
this.updateModel(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
setDisabledState(isDisabled: boolean): void { |
||||
|
this.disabled = isDisabled; |
||||
|
if (this.disabled) { |
||||
|
this.lwm2mDeviceTransportConfigurationFormGroup.disable({emitEvent: false}); |
||||
|
} else { |
||||
|
this.lwm2mDeviceTransportConfigurationFormGroup.enable({emitEvent: false}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
writeValue(value: Lwm2mDeviceTransportConfiguration | null): void { |
||||
|
this.lwm2mDeviceTransportConfigurationFormGroup.patchValue({configuration: value}, {emitEvent: false}); |
||||
|
} |
||||
|
|
||||
|
private updateModel() { |
||||
|
let configuration: DeviceTransportConfiguration = null; |
||||
|
if (this.lwm2mDeviceTransportConfigurationFormGroup.valid) { |
||||
|
configuration = this.lwm2mDeviceTransportConfigurationFormGroup.getRawValue().configuration; |
||||
|
configuration.type = DeviceTransportType.LWM2M; |
||||
|
} |
||||
|
this.propagateChange(configuration); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
<!-- |
||||
|
|
||||
|
Copyright © 2016-2020 The Thingsboard Authors |
||||
|
|
||||
|
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
you may not use this file except in compliance with the License. |
||||
|
You may obtain a copy of the License at |
||||
|
|
||||
|
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
|
||||
|
Unless required by applicable law or agreed to in writing, software |
||||
|
distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
See the License for the specific language governing permissions and |
||||
|
limitations under the License. |
||||
|
|
||||
|
--> |
||||
|
<form [formGroup]="mqttDeviceTransportConfigurationFormGroup" style="padding-bottom: 16px;"> |
||||
|
<tb-json-object-edit |
||||
|
[required]="required" |
||||
|
label="{{ 'device-profile.transport-type-mqtt' | translate }}" |
||||
|
formControlName="configuration"> |
||||
|
</tb-json-object-edit> |
||||
|
</form> |
||||
@ -0,0 +1,96 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2020 The Thingsboard Authors
|
||||
|
///
|
||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
/// you may not use this file except in compliance with the License.
|
||||
|
/// You may obtain a copy of the License at
|
||||
|
///
|
||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
///
|
||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
/// See the License for the specific language governing permissions and
|
||||
|
/// limitations under the License.
|
||||
|
///
|
||||
|
|
||||
|
import { Component, forwardRef, Input, OnInit } from '@angular/core'; |
||||
|
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; |
||||
|
import { Store } from '@ngrx/store'; |
||||
|
import { AppState } from '@app/core/core.state'; |
||||
|
import { coerceBooleanProperty } from '@angular/cdk/coercion'; |
||||
|
import { |
||||
|
DeviceTransportConfiguration, |
||||
|
DeviceTransportType, MqttDeviceTransportConfiguration |
||||
|
} from '@shared/models/device.models'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'tb-mqtt-device-transport-configuration', |
||||
|
templateUrl: './mqtt-device-transport-configuration.component.html', |
||||
|
styleUrls: [], |
||||
|
providers: [{ |
||||
|
provide: NG_VALUE_ACCESSOR, |
||||
|
useExisting: forwardRef(() => MqttDeviceTransportConfigurationComponent), |
||||
|
multi: true |
||||
|
}] |
||||
|
}) |
||||
|
export class MqttDeviceTransportConfigurationComponent implements ControlValueAccessor, OnInit { |
||||
|
|
||||
|
mqttDeviceTransportConfigurationFormGroup: FormGroup; |
||||
|
|
||||
|
private requiredValue: boolean; |
||||
|
get required(): boolean { |
||||
|
return this.requiredValue; |
||||
|
} |
||||
|
@Input() |
||||
|
set required(value: boolean) { |
||||
|
this.requiredValue = coerceBooleanProperty(value); |
||||
|
} |
||||
|
|
||||
|
@Input() |
||||
|
disabled: boolean; |
||||
|
|
||||
|
private propagateChange = (v: any) => { }; |
||||
|
|
||||
|
constructor(private store: Store<AppState>, |
||||
|
private fb: FormBuilder) { |
||||
|
} |
||||
|
|
||||
|
registerOnChange(fn: any): void { |
||||
|
this.propagateChange = fn; |
||||
|
} |
||||
|
|
||||
|
registerOnTouched(fn: any): void { |
||||
|
} |
||||
|
|
||||
|
ngOnInit() { |
||||
|
this.mqttDeviceTransportConfigurationFormGroup = this.fb.group({ |
||||
|
configuration: [null, Validators.required] |
||||
|
}); |
||||
|
this.mqttDeviceTransportConfigurationFormGroup.valueChanges.subscribe(() => { |
||||
|
this.updateModel(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
setDisabledState(isDisabled: boolean): void { |
||||
|
this.disabled = isDisabled; |
||||
|
if (this.disabled) { |
||||
|
this.mqttDeviceTransportConfigurationFormGroup.disable({emitEvent: false}); |
||||
|
} else { |
||||
|
this.mqttDeviceTransportConfigurationFormGroup.enable({emitEvent: false}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
writeValue(value: MqttDeviceTransportConfiguration | null): void { |
||||
|
this.mqttDeviceTransportConfigurationFormGroup.patchValue({configuration: value}, {emitEvent: false}); |
||||
|
} |
||||
|
|
||||
|
private updateModel() { |
||||
|
let configuration: DeviceTransportConfiguration = null; |
||||
|
if (this.mqttDeviceTransportConfigurationFormGroup.valid) { |
||||
|
configuration = this.mqttDeviceTransportConfigurationFormGroup.getRawValue().configuration; |
||||
|
configuration.type = DeviceTransportType.MQTT; |
||||
|
} |
||||
|
this.propagateChange(configuration); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue