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