Showing
8 changed files
with
43 additions
and
11 deletions
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<div [formGroup]="deviceProfileDataFormGroup"> | 18 | +<div [formGroup]="deviceProfileDataFormGroup" style="padding-bottom: 16px;"> |
19 | <mat-accordion multi="true"> | 19 | <mat-accordion multi="true"> |
20 | <mat-expansion-panel [expanded]="true"> | 20 | <mat-expansion-panel [expanded]="true"> |
21 | <mat-expansion-panel-header> | 21 | <mat-expansion-panel-header> |
@@ -49,6 +49,11 @@ | @@ -49,6 +49,11 @@ | ||
49 | {{ 'device-profile.name-required' | translate }} | 49 | {{ 'device-profile.name-required' | translate }} |
50 | </mat-error> | 50 | </mat-error> |
51 | </mat-form-field> | 51 | </mat-form-field> |
52 | + <tb-entity-autocomplete | ||
53 | + label="device-profile.default-rule-chain" | ||
54 | + [entityType]="entityType.RULE_CHAIN" | ||
55 | + formControlName="defaultRuleChainId"> | ||
56 | + </tb-entity-autocomplete> | ||
52 | <mat-form-field class="mat-block"> | 57 | <mat-form-field class="mat-block"> |
53 | <mat-label translate>device-profile.type</mat-label> | 58 | <mat-label translate>device-profile.type</mat-label> |
54 | <mat-select formControlName="type" required> | 59 | <mat-select formControlName="type" required> |
@@ -64,10 +69,6 @@ | @@ -64,10 +69,6 @@ | ||
64 | formControlName="profileData" | 69 | formControlName="profileData" |
65 | required> | 70 | required> |
66 | </tb-device-profile-data> | 71 | </tb-device-profile-data> |
67 | - <tb-entity-autocomplete | ||
68 | - [entityType]="entityType.RULE_CHAIN" | ||
69 | - formControlName="defaultRuleChainId"> | ||
70 | - </tb-entity-autocomplete> | ||
71 | <mat-form-field class="mat-block"> | 72 | <mat-form-field class="mat-block"> |
72 | <mat-label translate>tenant-profile.description</mat-label> | 73 | <mat-label translate>tenant-profile.description</mat-label> |
73 | <textarea matInput formControlName="description" rows="2"></textarea> | 74 | <textarea matInput formControlName="description" rows="2"></textarea> |
@@ -96,7 +96,7 @@ export class DeviceProfileComponent extends EntityComponent<DeviceProfile> { | @@ -96,7 +96,7 @@ export class DeviceProfileComponent extends EntityComponent<DeviceProfile> { | ||
96 | }; | 96 | }; |
97 | } | 97 | } |
98 | profileData.configuration = createDeviceProfileConfiguration(deviceProfileType); | 98 | profileData.configuration = createDeviceProfileConfiguration(deviceProfileType); |
99 | - this.entityForm.patchValue({profileData}); | 99 | + form.patchValue({profileData}); |
100 | } | 100 | } |
101 | 101 | ||
102 | updateForm(entity: DeviceProfile) { | 102 | updateForm(entity: DeviceProfile) { |
@@ -85,7 +85,7 @@ export class TenantProfileDataComponent implements ControlValueAccessor, OnInit | @@ -85,7 +85,7 @@ export class TenantProfileDataComponent implements ControlValueAccessor, OnInit | ||
85 | private updateModel() { | 85 | private updateModel() { |
86 | let tenantProfileData: TenantProfileData = null; | 86 | let tenantProfileData: TenantProfileData = null; |
87 | if (this.tenantProfileDataFormGroup.valid) { | 87 | if (this.tenantProfileDataFormGroup.valid) { |
88 | - tenantProfileData = this.tenantProfileDataFormGroup.getRawValue().profileData; | 88 | + tenantProfileData = this.tenantProfileDataFormGroup.getRawValue().tenantProfileData; |
89 | } | 89 | } |
90 | this.propagateChange(tenantProfileData); | 90 | this.propagateChange(tenantProfileData); |
91 | } | 91 | } |
@@ -48,6 +48,8 @@ export class DeviceProfilesTableConfigResolver implements Resolve<EntityTableCon | @@ -48,6 +48,8 @@ export class DeviceProfilesTableConfigResolver implements Resolve<EntityTableCon | ||
48 | this.config.entityTranslations = entityTypeTranslations.get(EntityType.DEVICE_PROFILE); | 48 | this.config.entityTranslations = entityTypeTranslations.get(EntityType.DEVICE_PROFILE); |
49 | this.config.entityResources = entityTypeResources.get(EntityType.DEVICE_PROFILE); | 49 | this.config.entityResources = entityTypeResources.get(EntityType.DEVICE_PROFILE); |
50 | 50 | ||
51 | + this.config.addDialogStyle = {width: '600px'}; | ||
52 | + | ||
51 | this.config.columns.push( | 53 | this.config.columns.push( |
52 | new DateEntityTableColumn<DeviceProfile>('createdTime', 'common.created-time', this.datePipe, '150px'), | 54 | new DateEntityTableColumn<DeviceProfile>('createdTime', 'common.created-time', this.datePipe, '150px'), |
53 | new EntityTableColumn<DeviceProfile>('name', 'device-profile.name', '20%'), | 55 | new EntityTableColumn<DeviceProfile>('name', 'device-profile.name', '20%'), |
@@ -89,6 +89,21 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit | @@ -89,6 +89,21 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit | ||
89 | @Input() | 89 | @Input() |
90 | disabled: boolean; | 90 | disabled: boolean; |
91 | 91 | ||
92 | + labelValue: string; | ||
93 | + | ||
94 | + @Input() | ||
95 | + set label(label: string) { | ||
96 | + this.labelValue = label; | ||
97 | + this.entityText = label; | ||
98 | + } | ||
99 | + | ||
100 | + requiredTextValue: string; | ||
101 | + | ||
102 | + @Input() | ||
103 | + set requiredText(requiredText: string) { | ||
104 | + this.requiredTextValue = requiredText; | ||
105 | + } | ||
106 | + | ||
92 | @ViewChild('entityInput', {static: true}) entityInput: ElementRef; | 107 | @ViewChild('entityInput', {static: true}) entityInput: ElementRef; |
93 | 108 | ||
94 | entityText: string; | 109 | entityText: string; |
@@ -212,6 +227,13 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit | @@ -212,6 +227,13 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit | ||
212 | break; | 227 | break; |
213 | } | 228 | } |
214 | } | 229 | } |
230 | + if (this.labelValue) { | ||
231 | + this.entityText = this.labelValue; | ||
232 | + } | ||
233 | + if (this.requiredTextValue) { | ||
234 | + this.entityRequiredText = this.requiredTextValue; | ||
235 | + } | ||
236 | + | ||
215 | const currentEntity = this.getCurrentEntity(); | 237 | const currentEntity = this.getCurrentEntity(); |
216 | if (currentEntity) { | 238 | if (currentEntity) { |
217 | const currentEntityType = currentEntity.id.entityType; | 239 | const currentEntityType = currentEntity.id.entityType; |
@@ -91,6 +91,8 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va | @@ -91,6 +91,8 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va | ||
91 | 91 | ||
92 | errorShowed = false; | 92 | errorShowed = false; |
93 | 93 | ||
94 | + ignoreChange = false; | ||
95 | + | ||
94 | private propagateChange = null; | 96 | private propagateChange = null; |
95 | 97 | ||
96 | constructor(public elementRef: ElementRef, | 98 | constructor(public elementRef: ElementRef, |
@@ -118,8 +120,10 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va | @@ -118,8 +120,10 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va | ||
118 | this.jsonEditor.session.setUseWrapMode(false); | 120 | this.jsonEditor.session.setUseWrapMode(false); |
119 | this.jsonEditor.setValue(this.contentValue ? this.contentValue : '', -1); | 121 | this.jsonEditor.setValue(this.contentValue ? this.contentValue : '', -1); |
120 | this.jsonEditor.on('change', () => { | 122 | this.jsonEditor.on('change', () => { |
121 | - this.cleanupJsonErrors(); | ||
122 | - this.updateView(); | 123 | + if (!this.ignoreChange) { |
124 | + this.cleanupJsonErrors(); | ||
125 | + this.updateView(); | ||
126 | + } | ||
123 | }); | 127 | }); |
124 | this.editorResize$ = new ResizeObserver(() => { | 128 | this.editorResize$ = new ResizeObserver(() => { |
125 | this.onAceEditorResize(); | 129 | this.onAceEditorResize(); |
@@ -225,7 +229,9 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va | @@ -225,7 +229,9 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va | ||
225 | // | 229 | // |
226 | } | 230 | } |
227 | if (this.jsonEditor) { | 231 | if (this.jsonEditor) { |
232 | + this.ignoreChange = true; | ||
228 | this.jsonEditor.setValue(this.contentValue ? this.contentValue : '', -1); | 233 | this.jsonEditor.setValue(this.contentValue ? this.contentValue : '', -1); |
234 | + this.ignoreChange = false; | ||
229 | } | 235 | } |
230 | } | 236 | } |
231 | 237 |
@@ -767,13 +767,14 @@ | @@ -767,13 +767,14 @@ | ||
767 | "copyId": "Copy device profile Id", | 767 | "copyId": "Copy device profile Id", |
768 | "name": "Name", | 768 | "name": "Name", |
769 | "name-required": "Name is required.", | 769 | "name-required": "Name is required.", |
770 | - "type": "Type", | ||
771 | - "type-required": "Type is required.", | 770 | + "type": "Profile type", |
771 | + "type-required": "Profile type is required.", | ||
772 | "type-default": "Default", | 772 | "type-default": "Default", |
773 | "description": "Description", | 773 | "description": "Description", |
774 | "default": "Default", | 774 | "default": "Default", |
775 | "profile-configuration": "Profile configuration", | 775 | "profile-configuration": "Profile configuration", |
776 | "transport-configuration": "Transport configuration", | 776 | "transport-configuration": "Transport configuration", |
777 | + "default-rule-chain": "Default rule chain", | ||
777 | "delete-device-profile-title": "Are you sure you want to delete the device profile '{{deviceProfileName}}'?", | 778 | "delete-device-profile-title": "Are you sure you want to delete the device profile '{{deviceProfileName}}'?", |
778 | "delete-device-profile-text": "Be careful, after the confirmation the device profile and all related data will become unrecoverable.", | 779 | "delete-device-profile-text": "Be careful, after the confirmation the device profile and all related data will become unrecoverable.", |
779 | "delete-device-profiles-title": "Are you sure you want to delete { count, plural, 1 {1 device profile} other {# device profiles} }?", | 780 | "delete-device-profiles-title": "Are you sure you want to delete { count, plural, 1 {1 device profile} other {# device profiles} }?", |