Commit f32aed7d5812005275710451a97ad1c0e7e53015
1 parent
a8ea887e
UI: Refactoring, rename locale file
Showing
4 changed files
with
145 additions
and
154 deletions
... | ... | @@ -23,7 +23,7 @@ import { |
23 | 23 | TenantProfile, |
24 | 24 | TenantProfileData, |
25 | 25 | TenantProfileType |
26 | -} from '@app/shared/models/tenant.model'; | |
26 | +} from '@shared/models/tenant.model'; | |
27 | 27 | import { ActionNotificationShow } from '@app/core/notification/notification.actions'; |
28 | 28 | import { TranslateService } from '@ngx-translate/core'; |
29 | 29 | import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; |
... | ... | @@ -73,7 +73,7 @@ export class TenantProfileComponent extends EntityComponent<TenantProfile> { |
73 | 73 | this.entityForm.patchValue({name: entity.name}); |
74 | 74 | this.entityForm.patchValue({isolatedTbCore: entity.isolatedTbCore}); |
75 | 75 | this.entityForm.patchValue({isolatedTbRuleEngine: entity.isolatedTbRuleEngine}); |
76 | - this.entityForm.patchValue({profileData: !this.isAdd ? entity.profileData: { | |
76 | + this.entityForm.patchValue({profileData: !this.isAdd ? entity.profileData : { | |
77 | 77 | configuration: createTenantProfileConfiguration(TenantProfileType.DEFAULT) |
78 | 78 | } as TenantProfileData}); |
79 | 79 | this.entityForm.patchValue({description: entity.description}); | ... | ... |
... | ... | @@ -15,127 +15,125 @@ |
15 | 15 | limitations under the License. |
16 | 16 | |
17 | 17 | --> |
18 | -<section [formGroup]="defaultTenantProfileConfigurationFormGroup"> | |
19 | - <section formGroupName="configuration" fxLayout="column"> | |
20 | - <mat-form-field class="mat-block"> | |
21 | - <mat-label translate>tenant-profile.maximum-devices</mat-label> | |
22 | - <input matInput required min="0" step="1" | |
23 | - formControlName="maxDevices" | |
24 | - type="number"> | |
25 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxDevices').hasError('required')"> | |
26 | - {{ 'tenant-profile.maximum-devices-required' | translate}} | |
27 | - </mat-error> | |
28 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxDevices').hasError('min')"> | |
29 | - {{ 'tenant-profile.maximum-devices-range' | translate}} | |
30 | - </mat-error> | |
31 | - </mat-form-field> | |
32 | - <mat-form-field class="mat-block"> | |
33 | - <mat-label translate>tenant-profile.maximum-assets</mat-label> | |
34 | - <input matInput required min="0" step="1" | |
35 | - formControlName="maxAssets" | |
36 | - type="number"> | |
37 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxAssets').hasError('required')"> | |
38 | - {{ 'tenant-profile.maximum-assets-required' | translate}} | |
39 | - </mat-error> | |
40 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxAssets').hasError('min')"> | |
41 | - {{ 'tenant-profile.maximum-assets-range' | translate}} | |
42 | - </mat-error> | |
43 | - </mat-form-field> | |
44 | - <mat-form-field class="mat-block"> | |
45 | - <mat-label translate>tenant-profile.max-transport-messages</mat-label> | |
46 | - <input matInput required min="0" step="1" | |
47 | - formControlName="maxTransportMessages" | |
48 | - type="number"> | |
49 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxTransportMessages').hasError('required')"> | |
50 | - {{ 'tenant-profile.max-transport-messages-range' | translate}} | |
51 | - </mat-error> | |
52 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxTransportMessages').hasError('min')"> | |
53 | - {{ 'tenant-profile.max-transport-messages-required' | translate}} | |
54 | - </mat-error> | |
55 | - </mat-form-field> | |
56 | - <mat-form-field class="mat-block"> | |
57 | - <mat-label translate>tenant-profile.max-transport-data-points</mat-label> | |
58 | - <input matInput required min="0" step="1" | |
59 | - formControlName="maxTransportDataPoints" | |
60 | - type="number"> | |
61 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxTransportDataPoints').hasError('required')"> | |
62 | - {{ 'tenant-profile.max-transport-data-points-required' | translate}} | |
63 | - </mat-error> | |
64 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxTransportDataPoints').hasError('min')"> | |
65 | - {{ 'tenant-profile.max-transport-data-points-range' | translate}} | |
66 | - </mat-error> | |
67 | - </mat-form-field> | |
68 | - <mat-form-field class="mat-block"> | |
69 | - <mat-label translate>tenant-profile.max-r-e-executions</mat-label> | |
70 | - <input matInput required min="0" step="1" | |
71 | - formControlName="maxREExecutions" | |
72 | - type="number"> | |
73 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxREExecutions').hasError('required')"> | |
74 | - {{ 'tenant-profile.max-r-e-executions-required' | translate}} | |
75 | - </mat-error> | |
76 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxREExecutions').hasError('min')"> | |
77 | - {{ 'tenant-profile.max-r-e-executions-range' | translate}} | |
78 | - </mat-error> | |
79 | - </mat-form-field> | |
80 | - <mat-form-field class="mat-block"> | |
81 | - <mat-label translate>tenant-profile.max-j-s-executions</mat-label> | |
82 | - <input matInput required min="0" step="1" | |
83 | - formControlName="maxJSExecutions" | |
84 | - type="number"> | |
85 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxJSExecutions').hasError('required')"> | |
86 | - {{ 'tenant-profile.max-j-s-executions-required' | translate}} | |
87 | - </mat-error> | |
88 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxJSExecutions').hasError('min')"> | |
89 | - {{ 'tenant-profile.max-j-s-executions-range' | translate}} | |
90 | - </mat-error> | |
91 | - </mat-form-field> | |
92 | - <mat-form-field class="mat-block"> | |
93 | - <mat-label translate>tenant-profile.max-d-p-storage-days</mat-label> | |
94 | - <input matInput required min="0" step="1" | |
95 | - formControlName="maxDPStorageDays" | |
96 | - type="number"> | |
97 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxDPStorageDays').hasError('required')"> | |
98 | - {{ 'tenant-profile.max-d-p-storage-days-required' | translate}} | |
99 | - </mat-error> | |
100 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxDPStorageDays').hasError('min')"> | |
101 | - {{ 'tenant-profile.max-d-p-storage-days-range' | translate}} | |
102 | - </mat-error> | |
103 | - </mat-form-field> | |
104 | - <mat-form-field class="mat-block"> | |
105 | - <mat-label translate>tenant-profile.max-rule-node-executions-per-message</mat-label> | |
106 | - <input matInput required min="0" step="1" | |
107 | - formControlName="maxRuleNodeExecutionsPerMessage" | |
108 | - type="number"> | |
109 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxRuleNodeExecutionsPerMessage').hasError('required')"> | |
110 | - {{ 'tenant-profile.max-rule-node-executions-per-message-required' | translate}} | |
111 | - </mat-error> | |
112 | - <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('configuration.maxRuleNodeExecutionsPerMessage').hasError('min')"> | |
113 | - {{ 'tenant-profile.max-rule-node-executions-per-message-range' | translate}} | |
114 | - </mat-error> | |
115 | - </mat-form-field> | |
116 | - <mat-form-field class="mat-block"> | |
117 | - <mat-label translate>tenant-profile.transport-tenant-msg-rate-limit</mat-label> | |
118 | - <input matInput formControlName="transportTenantMsgRateLimit"> | |
119 | - </mat-form-field> | |
120 | - <mat-form-field class="mat-block"> | |
121 | - <mat-label translate>tenant-profile.transport-tenant-telemetry-msg-rate-limit</mat-label> | |
122 | - <input matInput formControlName="transportTenantTelemetryMsgRateLimit"> | |
123 | - </mat-form-field> | |
124 | - <mat-form-field class="mat-block"> | |
125 | - <mat-label translate>tenant-profile.transport-tenant-telemetry-data-points-rate-limit</mat-label> | |
126 | - <input matInput formControlName="transportTenantTelemetryDataPointsRateLimit"> | |
127 | - </mat-form-field> | |
128 | - <mat-form-field class="mat-block"> | |
129 | - <mat-label translate>tenant-profile.transport-device-msg-rate-limit</mat-label> | |
130 | - <input matInput formControlName="transportDeviceMsgRateLimit"> | |
131 | - </mat-form-field> | |
132 | - <mat-form-field class="mat-block"> | |
133 | - <mat-label translate>tenant-profile.transport-device-telemetry-msg-rate-limit</mat-label> | |
134 | - <input matInput formControlName="transportDeviceTelemetryMsgRateLimit"> | |
135 | - </mat-form-field> | |
136 | - <mat-form-field class="mat-block"> | |
137 | - <mat-label translate>tenant-profile.transport-device-telemetry-data-points-rate-limit</mat-label> | |
138 | - <input matInput formControlName="transportDeviceTelemetryDataPointsRateLimit"> | |
139 | - </mat-form-field> | |
140 | - </section> | |
18 | +<section [formGroup]="defaultTenantProfileConfigurationFormGroup" fxLayout="column"> | |
19 | + <mat-form-field class="mat-block"> | |
20 | + <mat-label translate>tenant-profile.maximum-devices</mat-label> | |
21 | + <input matInput required min="0" step="1" | |
22 | + formControlName="maxDevices" | |
23 | + type="number"> | |
24 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxDevices').hasError('required')"> | |
25 | + {{ 'tenant-profile.maximum-devices-required' | translate}} | |
26 | + </mat-error> | |
27 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxDevices').hasError('min')"> | |
28 | + {{ 'tenant-profile.maximum-devices-range' | translate}} | |
29 | + </mat-error> | |
30 | + </mat-form-field> | |
31 | + <mat-form-field class="mat-block"> | |
32 | + <mat-label translate>tenant-profile.maximum-assets</mat-label> | |
33 | + <input matInput required min="0" step="1" | |
34 | + formControlName="maxAssets" | |
35 | + type="number"> | |
36 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxAssets').hasError('required')"> | |
37 | + {{ 'tenant-profile.maximum-assets-required' | translate}} | |
38 | + </mat-error> | |
39 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxAssets').hasError('min')"> | |
40 | + {{ 'tenant-profile.maximum-assets-range' | translate}} | |
41 | + </mat-error> | |
42 | + </mat-form-field> | |
43 | + <mat-form-field class="mat-block"> | |
44 | + <mat-label translate>tenant-profile.max-transport-messages</mat-label> | |
45 | + <input matInput required min="0" step="1" | |
46 | + formControlName="maxTransportMessages" | |
47 | + type="number"> | |
48 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxTransportMessages').hasError('required')"> | |
49 | + {{ 'tenant-profile.max-transport-messages-range' | translate}} | |
50 | + </mat-error> | |
51 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxTransportMessages').hasError('min')"> | |
52 | + {{ 'tenant-profile.max-transport-messages-required' | translate}} | |
53 | + </mat-error> | |
54 | + </mat-form-field> | |
55 | + <mat-form-field class="mat-block"> | |
56 | + <mat-label translate>tenant-profile.max-transport-data-points</mat-label> | |
57 | + <input matInput required min="0" step="1" | |
58 | + formControlName="maxTransportDataPoints" | |
59 | + type="number"> | |
60 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxTransportDataPoints').hasError('required')"> | |
61 | + {{ 'tenant-profile.max-transport-data-points-required' | translate}} | |
62 | + </mat-error> | |
63 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxTransportDataPoints').hasError('min')"> | |
64 | + {{ 'tenant-profile.max-transport-data-points-range' | translate}} | |
65 | + </mat-error> | |
66 | + </mat-form-field> | |
67 | + <mat-form-field class="mat-block"> | |
68 | + <mat-label translate>tenant-profile.max-r-e-executions</mat-label> | |
69 | + <input matInput required min="0" step="1" | |
70 | + formControlName="maxREExecutions" | |
71 | + type="number"> | |
72 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxREExecutions').hasError('required')"> | |
73 | + {{ 'tenant-profile.max-r-e-executions-required' | translate}} | |
74 | + </mat-error> | |
75 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxREExecutions').hasError('min')"> | |
76 | + {{ 'tenant-profile.max-r-e-executions-range' | translate}} | |
77 | + </mat-error> | |
78 | + </mat-form-field> | |
79 | + <mat-form-field class="mat-block"> | |
80 | + <mat-label translate>tenant-profile.max-j-s-executions</mat-label> | |
81 | + <input matInput required min="0" step="1" | |
82 | + formControlName="maxJSExecutions" | |
83 | + type="number"> | |
84 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxJSExecutions').hasError('required')"> | |
85 | + {{ 'tenant-profile.max-j-s-executions-required' | translate}} | |
86 | + </mat-error> | |
87 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxJSExecutions').hasError('min')"> | |
88 | + {{ 'tenant-profile.max-j-s-executions-range' | translate}} | |
89 | + </mat-error> | |
90 | + </mat-form-field> | |
91 | + <mat-form-field class="mat-block"> | |
92 | + <mat-label translate>tenant-profile.max-d-p-storage-days</mat-label> | |
93 | + <input matInput required min="0" step="1" | |
94 | + formControlName="maxDPStorageDays" | |
95 | + type="number"> | |
96 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxDPStorageDays').hasError('required')"> | |
97 | + {{ 'tenant-profile.max-d-p-storage-days-required' | translate}} | |
98 | + </mat-error> | |
99 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxDPStorageDays').hasError('min')"> | |
100 | + {{ 'tenant-profile.max-d-p-storage-days-range' | translate}} | |
101 | + </mat-error> | |
102 | + </mat-form-field> | |
103 | + <mat-form-field class="mat-block"> | |
104 | + <mat-label translate>tenant-profile.max-rule-node-executions-per-message</mat-label> | |
105 | + <input matInput required min="0" step="1" | |
106 | + formControlName="maxRuleNodeExecutionsPerMessage" | |
107 | + type="number"> | |
108 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxRuleNodeExecutionsPerMessage').hasError('required')"> | |
109 | + {{ 'tenant-profile.max-rule-node-executions-per-message-required' | translate}} | |
110 | + </mat-error> | |
111 | + <mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('maxRuleNodeExecutionsPerMessage').hasError('min')"> | |
112 | + {{ 'tenant-profile.max-rule-node-executions-per-message-range' | translate}} | |
113 | + </mat-error> | |
114 | + </mat-form-field> | |
115 | + <mat-form-field class="mat-block"> | |
116 | + <mat-label translate>tenant-profile.transport-tenant-msg-rate-limit</mat-label> | |
117 | + <input matInput formControlName="transportTenantMsgRateLimit"> | |
118 | + </mat-form-field> | |
119 | + <mat-form-field class="mat-block"> | |
120 | + <mat-label translate>tenant-profile.transport-tenant-telemetry-msg-rate-limit</mat-label> | |
121 | + <input matInput formControlName="transportTenantTelemetryMsgRateLimit"> | |
122 | + </mat-form-field> | |
123 | + <mat-form-field class="mat-block"> | |
124 | + <mat-label translate>tenant-profile.transport-tenant-telemetry-data-points-rate-limit</mat-label> | |
125 | + <input matInput formControlName="transportTenantTelemetryDataPointsRateLimit"> | |
126 | + </mat-form-field> | |
127 | + <mat-form-field class="mat-block"> | |
128 | + <mat-label translate>tenant-profile.transport-device-msg-rate-limit</mat-label> | |
129 | + <input matInput formControlName="transportDeviceMsgRateLimit"> | |
130 | + </mat-form-field> | |
131 | + <mat-form-field class="mat-block"> | |
132 | + <mat-label translate>tenant-profile.transport-device-telemetry-msg-rate-limit</mat-label> | |
133 | + <input matInput formControlName="transportDeviceTelemetryMsgRateLimit"> | |
134 | + </mat-form-field> | |
135 | + <mat-form-field class="mat-block"> | |
136 | + <mat-label translate>tenant-profile.transport-device-telemetry-data-points-rate-limit</mat-label> | |
137 | + <input matInput formControlName="transportDeviceTelemetryDataPointsRateLimit"> | |
138 | + </mat-form-field> | |
141 | 139 | </section> | ... | ... |
... | ... | @@ -19,11 +19,7 @@ import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Valida |
19 | 19 | import { Store } from '@ngrx/store'; |
20 | 20 | import { AppState } from '@app/core/core.state'; |
21 | 21 | import { coerceBooleanProperty } from '@angular/cdk/coercion'; |
22 | -import { | |
23 | - DefaultTenantProfileConfiguration, | |
24 | - TenantProfileConfiguration, | |
25 | - TenantProfileType | |
26 | -} from '@shared/models/tenant.model'; | |
22 | +import { DefaultTenantProfileConfiguration, TenantProfileConfiguration } from '@shared/models/tenant.model'; | |
27 | 23 | import { isDefinedAndNotNull } from '@core/utils'; |
28 | 24 | |
29 | 25 | @Component({ |
... | ... | @@ -56,6 +52,25 @@ export class DefaultTenantProfileConfigurationComponent implements ControlValueA |
56 | 52 | |
57 | 53 | constructor(private store: Store<AppState>, |
58 | 54 | private fb: FormBuilder) { |
55 | + this.defaultTenantProfileConfigurationFormGroup = this.fb.group({ | |
56 | + maxDevices: [null, [Validators.required, Validators.min(0)]], | |
57 | + maxAssets: [null, [Validators.required, Validators.min(0)]], | |
58 | + transportTenantMsgRateLimit: [null, []], | |
59 | + transportTenantTelemetryMsgRateLimit: [null, []], | |
60 | + transportTenantTelemetryDataPointsRateLimit: [null, []], | |
61 | + transportDeviceMsgRateLimit: [null, []], | |
62 | + transportDeviceTelemetryMsgRateLimit: [null, []], | |
63 | + transportDeviceTelemetryDataPointsRateLimit: [null, []], | |
64 | + maxTransportMessages: [null, [Validators.required, Validators.min(0)]], | |
65 | + maxTransportDataPoints: [null, [Validators.required, Validators.min(0)]], | |
66 | + maxREExecutions: [null, [Validators.required, Validators.min(0)]], | |
67 | + maxJSExecutions: [null, [Validators.required, Validators.min(0)]], | |
68 | + maxDPStorageDays: [null, [Validators.required, Validators.min(0)]], | |
69 | + maxRuleNodeExecutionsPerMessage: [null, [Validators.required, Validators.min(0)]] | |
70 | + }); | |
71 | + this.defaultTenantProfileConfigurationFormGroup.valueChanges.subscribe(() => { | |
72 | + this.updateModel(); | |
73 | + }); | |
59 | 74 | } |
60 | 75 | |
61 | 76 | registerOnChange(fn: any): void { |
... | ... | @@ -66,27 +81,6 @@ export class DefaultTenantProfileConfigurationComponent implements ControlValueA |
66 | 81 | } |
67 | 82 | |
68 | 83 | ngOnInit() { |
69 | - this.defaultTenantProfileConfigurationFormGroup = this.fb.group({ | |
70 | - configuration: this.fb.group({ | |
71 | - maxDevices: [null, [Validators.required, Validators.min(0)]], | |
72 | - maxAssets: [null, [Validators.required, Validators.min(0)]], | |
73 | - transportTenantMsgRateLimit: [null, []], | |
74 | - transportTenantTelemetryMsgRateLimit: [null, []], | |
75 | - transportTenantTelemetryDataPointsRateLimit: [null, []], | |
76 | - transportDeviceMsgRateLimit: [null, []], | |
77 | - transportDeviceTelemetryMsgRateLimit: [null, []], | |
78 | - transportDeviceTelemetryDataPointsRateLimit: [null, []], | |
79 | - maxTransportMessages: [null, [Validators.required, Validators.min(0)]], | |
80 | - maxTransportDataPoints: [null, [Validators.required, Validators.min(0)]], | |
81 | - maxREExecutions: [null, [Validators.required, Validators.min(0)]], | |
82 | - maxJSExecutions: [null, [Validators.required, Validators.min(0)]], | |
83 | - maxDPStorageDays: [null, [Validators.required, Validators.min(0)]], | |
84 | - maxRuleNodeExecutionsPerMessage: [null, [Validators.required, Validators.min(0)]] | |
85 | - }) | |
86 | - }); | |
87 | - this.defaultTenantProfileConfigurationFormGroup.valueChanges.subscribe(() => { | |
88 | - this.updateModel(); | |
89 | - }); | |
90 | 84 | } |
91 | 85 | |
92 | 86 | setDisabledState(isDisabled: boolean): void { |
... | ... | @@ -100,15 +94,14 @@ export class DefaultTenantProfileConfigurationComponent implements ControlValueA |
100 | 94 | |
101 | 95 | writeValue(value: DefaultTenantProfileConfiguration | null): void { |
102 | 96 | if (isDefinedAndNotNull(value)) { |
103 | - this.defaultTenantProfileConfigurationFormGroup.patchValue({configuration: value}, {emitEvent: false}); | |
97 | + this.defaultTenantProfileConfigurationFormGroup.patchValue(value, {emitEvent: false}); | |
104 | 98 | } |
105 | 99 | } |
106 | 100 | |
107 | 101 | private updateModel() { |
108 | 102 | let configuration: TenantProfileConfiguration = null; |
109 | 103 | if (this.defaultTenantProfileConfigurationFormGroup.valid) { |
110 | - configuration = this.defaultTenantProfileConfigurationFormGroup.getRawValue().configuration; | |
111 | - configuration.type = TenantProfileType.DEFAULT; | |
104 | + configuration = this.defaultTenantProfileConfigurationFormGroup.getRawValue(); | |
112 | 105 | } |
113 | 106 | this.propagateChange(configuration); |
114 | 107 | } | ... | ... |
ui-ngx/src/assets/locale/locale.constant-pt_BR.json
renamed from
ui-ngx/src/assets/locale/locale.constant-pl_BR.json