Browse Source

UI: Fixed cf and alarm rule in preview

pull/14761/head
ArtemDzhereleiko 9 months ago
parent
commit
2e1130d803
  1. 19
      ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.html
  2. 5
      ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.ts
  3. 11
      ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html
  4. 4
      ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.ts
  5. 6
      ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-schedule.component.html
  6. 2
      ui-ngx/src/app/modules/home/components/alarm-rules/create-cf-alarm-rules.component.html
  7. 12
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.html
  8. 7
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.ts
  9. 14
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.html
  10. 7
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.ts
  11. 9
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-list.component.html
  12. 12
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-list.component.ts
  13. 2
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate-list.component.html
  14. 5
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate-list.component.ts
  15. 4
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate-no-data-value.component.html
  16. 4
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate-value.component.html
  17. 4
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate.component.html
  18. 1
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate.component.ts
  19. 5
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.html
  20. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.html
  21. 1
      ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.ts
  22. 1
      ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.html
  23. 4
      ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.ts
  24. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.html
  25. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.ts
  26. 1
      ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/geofencing-configuration.component.html
  27. 4
      ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/geofencing-configuration.component.ts
  28. 1
      ui-ngx/src/app/modules/home/components/calculated-fields/components/propagation-configuration/propagation-configuration.component.html
  29. 4
      ui-ngx/src/app/modules/home/components/calculated-fields/components/propagation-configuration/propagation-configuration.component.ts
  30. 1
      ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/related-entities-aggregation-component.component.html
  31. 4
      ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/related-entities-aggregation-component.component.ts
  32. 1
      ui-ngx/src/app/modules/home/components/calculated-fields/components/simple-configuration/simple-configuration.component.html
  33. 4
      ui-ngx/src/app/modules/home/components/calculated-fields/components/simple-configuration/simple-configuration.component.ts
  34. 3
      ui-ngx/src/app/modules/home/pages/alarm/alarm-routing.module.ts

19
ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.html

@ -79,6 +79,7 @@
[entityId]="entityId" [entityId]="entityId"
[tenantId]="tenantId" [tenantId]="tenantId"
[ownerId]="ownerId" [ownerId]="ownerId"
[isEditValue]="isEditValue"
[watchKeyChange]="true" [watchKeyChange]="true"
[entityName]="entityName"/> [entityName]="entityName"/>
</div> </div>
@ -97,14 +98,16 @@
<tb-cf-alarm-rule formControlName="clearRule" class="flex-1" [arguments]="arguments" [testScript]="onTestScript.bind(this)" isClearCondition> <tb-cf-alarm-rule formControlName="clearRule" class="flex-1" [arguments]="arguments" [testScript]="onTestScript.bind(this)" isClearCondition>
</tb-cf-alarm-rule> </tb-cf-alarm-rule>
</div> </div>
<button mat-icon-button @if (isEditValue) {
class="button-icon" <button mat-icon-button
type="button" class="button-icon"
(click)="removeClearAlarmRule()" type="button"
matTooltip="{{ 'action.remove' | translate }}" (click)="removeClearAlarmRule()"
matTooltipPosition="above"> matTooltip="{{ 'action.remove' | translate }}"
<mat-icon>delete</mat-icon> matTooltipPosition="above">
</button> <mat-icon>delete</mat-icon>
</button>
}
</div> </div>
<div *ngIf="!configFormGroup.get('clearRule').value"> <div *ngIf="!configFormGroup.get('clearRule').value">
<span translate class="tb-prompt flex items-center justify-center text-base">alarm-rule.no-clear-alarm-rule</span> <span translate class="tb-prompt flex items-center justify-center text-base">alarm-rule.no-clear-alarm-rule</span>

5
ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.ts

@ -53,7 +53,7 @@ import { EntityService } from '@core/http/entity.service';
@Component({ @Component({
selector: 'tb-alarm-rules', selector: 'tb-alarm-rules',
templateUrl: './alarm-rules.component.html', templateUrl: './alarm-rules.component.html',
styleUrls: [] styleUrls: ['./alarm-rule-dialog.component.scss']
}) })
export class AlarmRulesComponent extends EntityComponent<CalculatedFieldsTableEntity> { export class AlarmRulesComponent extends EntityComponent<CalculatedFieldsTableEntity> {
@ -175,7 +175,8 @@ export class AlarmRulesComponent extends EntityComponent<CalculatedFieldsTableEn
expression: { expression: {
type: AlarmRuleExpressionType.SIMPLE type: AlarmRuleExpressionType.SIMPLE
} }
} },
alarmDetails: null
}; };
this.configFormGroup.patchValue({clearRule: clearAlarmRule}); this.configFormGroup.patchValue({clearRule: clearAlarmRule});
} }

11
ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html

@ -50,6 +50,7 @@
<tb-alarm-rule-filter-list <tb-alarm-rule-filter-list
[operation]="conditionFormGroup.get('expression.operation').value" [operation]="conditionFormGroup.get('expression.operation').value"
[arguments]="arguments" [arguments]="arguments"
[readonly]="readonly"
formControlName="filters"> formControlName="filters">
</tb-alarm-rule-filter-list> </tb-alarm-rule-filter-list>
</div> </div>
@ -75,7 +76,7 @@
matTooltip="{{ 'calculated-fields.test-script-function' | translate }}" matTooltip="{{ 'calculated-fields.test-script-function' | translate }}"
matTooltipPosition="above" matTooltipPosition="above"
class="tb-mat-32" class="tb-mat-32"
[disabled]="!argumentsList.length" [disabled]="!argumentsList.length || readonly"
(click)="onTestScript($event)"> (click)="onTestScript($event)">
<mat-icon class="material-icons" color="primary">bug_report</mat-icon> <mat-icon class="material-icons" color="primary">bug_report</mat-icon>
</button> </button>
@ -84,7 +85,7 @@
<button mat-button mat-raised-button color="primary" <button mat-button mat-raised-button color="primary"
type="button" type="button"
(click)="onTestScript($event)" (click)="onTestScript($event)"
[disabled]="!argumentsList.length"> [disabled]="!argumentsList.length || readonly">
{{ 'calculated-fields.test-script-function' | translate }} {{ 'calculated-fields.test-script-function' | translate }}
</button> </button>
</div> </div>
@ -111,7 +112,7 @@
required> required>
</tb-alarm-rule-filter-text> </tb-alarm-rule-filter-text>
} @else { } @else {
<span class="tb-prompt text-base justify-center">{{ 'alarm-rule.no-filter-preview' | translate }}</span> <span class="tb-prompt justify-center text-base">{{ 'alarm-rule.no-filter-preview' | translate }}</span>
} }
</div> </div>
</ng-template> </ng-template>
@ -135,7 +136,7 @@
<span>{{ 'alarm-rule.condition-type-hint' | translate }}</span> <span>{{ 'alarm-rule.condition-type-hint' | translate }}</span>
</div> </div>
} }
@if (conditionFormGroup.get('type').value == AlarmConditionType.DURATION) { @if (conditionFormGroup.get('type').value === AlarmConditionType.DURATION) {
<div class="tb-form-panel stroked no-padding-bottom"> <div class="tb-form-panel stroked no-padding-bottom">
<div class="flex flex-row items-center justify-between"> <div class="flex flex-row items-center justify-between">
<div class="tb-form-panel-title">{{ 'alarm-rule.value' | translate }}</div> <div class="tb-form-panel-title">{{ 'alarm-rule.value' | translate }}</div>
@ -167,7 +168,7 @@
</div> </div>
</div> </div>
</div> </div>
} @else if (conditionFormGroup.get('type').value == AlarmConditionType.REPEATING) { } @else if (conditionFormGroup.get('type').value === AlarmConditionType.REPEATING) {
<div class="tb-form-panel stroked"> <div class="tb-form-panel stroked">
<div class="flex flex-row items-center justify-between"> <div class="flex flex-row items-center justify-between">
<div class="tb-form-panel-title">{{ 'alarm-rule.value' | translate }}</div> <div class="tb-form-panel-title">{{ 'alarm-rule.value' | translate }}</div>

4
ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.ts

@ -196,6 +196,10 @@ export class CfAlarmRuleConditionDialogComponent extends DialogComponent<CfAlarm
this.updateValidators(this.conditionFormGroup.get('type').value ?? AlarmRuleConditionType.SIMPLE); this.updateValidators(this.conditionFormGroup.get('type').value ?? AlarmRuleConditionType.SIMPLE);
this.updateSpecText(this.conditionFormGroup.get('type').value ?? AlarmRuleConditionType.SIMPLE); this.updateSpecText(this.conditionFormGroup.get('type').value ?? AlarmRuleConditionType.SIMPLE);
this.updateExpressionTypeValidator(this.condition?.expression?.type ?? 'SIMPLE'); this.updateExpressionTypeValidator(this.condition?.expression?.type ?? 'SIMPLE');
if (this.readonly) {
this.conditionFormGroup.disable({emitEvent: false});
}
} }
updateStaticValueValidator(type: AlarmRuleConditionType, dynamicValue: boolean) { updateStaticValueValidator(type: AlarmRuleConditionType, dynamicValue: boolean) {

6
ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-schedule.component.html

@ -46,7 +46,7 @@
{{ dayOfWeekTranslationsArray[day] | translate }} {{ dayOfWeekTranslationsArray[day] | translate }}
</mat-chip-option> </mat-chip-option>
</mat-chip-listbox> </mat-chip-listbox>
<tb-error class="block mb-2" [error]="alarmScheduleForm.get('staticValue.daysOfWeek').hasError('required') <tb-error class="mb-2 block" [error]="alarmScheduleForm.get('staticValue.daysOfWeek').hasError('required')
? ('alarm-rule.schedule-days-of-week-required' | translate) : ''"></tb-error> ? ('alarm-rule.schedule-days-of-week-required' | translate) : ''"></tb-error>
<div class="flex flex-row xs:flex-col gt-xs:gap-2"> <div class="flex flex-row xs:flex-col gt-xs:gap-2">
<div class="flex flex-row gap-2 gt-md:flex-1"> <div class="flex flex-row gap-2 gt-md:flex-1">
@ -63,7 +63,7 @@
<input required matInput formControlName="endsOn" [matDatetimepicker]="endTimePicker"> <input required matInput formControlName="endsOn" [matDatetimepicker]="endTimePicker">
</mat-form-field> </mat-form-field>
</div> </div>
<div class="flex flex-1 items-center justify-center mb-[22px]"> <div class="flex flex-1 items-center justify-center" style="margin-bottom: 22px;">
<div class="text-center" [innerHTML]="getSchedulerRangeText(alarmScheduleForm.get('staticValue'))"></div> <div class="text-center" [innerHTML]="getSchedulerRangeText(alarmScheduleForm.get('staticValue'))"></div>
</div> </div>
</div> </div>
@ -90,7 +90,7 @@
<input required matInput formControlName="endsOn" [matDatetimepicker]="endTimePicker"> <input required matInput formControlName="endsOn" [matDatetimepicker]="endTimePicker">
</mat-form-field> </mat-form-field>
</div> </div>
<div class="flex flex-1 items-center justify-center sm:max-w-[120px] text-center" <div class="flex flex-1 items-center justify-center text-center sm:max-w-[120px]"
[innerHTML]="getSchedulerRangeText(itemsSchedulerForm.at(day))"> [innerHTML]="getSchedulerRangeText(itemsSchedulerForm.at(day))">
</div> </div>
</div> </div>

2
ui-ngx/src/app/modules/home/components/alarm-rules/create-cf-alarm-rules.component.html

@ -49,7 +49,7 @@
</div> </div>
} }
@if (!createAlarmRulesFormArray().controls.length) { @if (!createAlarmRulesFormArray().controls.length) {
<span translate class="flex items-center justify-center tb-prompt text-base required" [class.required]="!disabled"> <span translate class="tb-prompt required flex items-center justify-center text-base" [class.required]="!disabled">
alarm-rule.add-create-alarm-rule-prompt alarm-rule.add-create-alarm-rule-prompt
</span> </span>
} }

12
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.html

@ -52,10 +52,12 @@
cdkFocusInitial> cdkFocusInitial>
{{'action.cancel' | translate }} {{'action.cancel' | translate }}
</button> </button>
<button mat-raised-button color="primary" @if (!readonly) {
type="submit" <button mat-raised-button color="primary"
[disabled]="complexFilterFormGroup.invalid || !complexFilterFormGroup.dirty"> type="submit"
{{ (isAdd ? 'action.add' : 'action.update') | translate }} [disabled]="complexFilterFormGroup.invalid || !complexFilterFormGroup.dirty">
</button> {{ (isAdd ? 'action.add' : 'action.update') | translate }}
</button>
}
</div> </div>
</form> </form>

7
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.ts

@ -36,6 +36,7 @@ export interface AlarmRuleComplexFilterPredicateDialogData {
valueType: EntityKeyValueType; valueType: EntityKeyValueType;
arguments: Record<string, CalculatedFieldArgument>; arguments: Record<string, CalculatedFieldArgument>;
argumentInUse: string; argumentInUse: string;
readonly: boolean;
} }
@Component({ @Component({
@ -63,6 +64,8 @@ export class AlarmRuleComplexFilterPredicateDialogComponent extends
arguments = this.data.arguments; arguments = this.data.arguments;
readonly = this.data.readonly;
constructor(protected store: Store<AppState>, constructor(protected store: Store<AppState>,
protected router: Router, protected router: Router,
@Inject(MAT_DIALOG_DATA) public data: AlarmRuleComplexFilterPredicateDialogData, @Inject(MAT_DIALOG_DATA) public data: AlarmRuleComplexFilterPredicateDialogData,
@ -73,6 +76,10 @@ export class AlarmRuleComplexFilterPredicateDialogComponent extends
this.isAdd = this.data.isAdd; this.isAdd = this.data.isAdd;
this.complexFilterFormGroup.patchValue(this.data.complexPredicate, {emitEvent: false}); this.complexFilterFormGroup.patchValue(this.data.complexPredicate, {emitEvent: false});
if (this.readonly) {
this.complexFilterFormGroup.disable({emitEvent: false});
}
} }
cancel(): void { cancel(): void {

14
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.html

@ -46,7 +46,7 @@
</mat-icon> </mat-icon>
} }
</mat-form-field> </mat-form-field>
<mat-form-field class="flex-1 tb-value-type" appearance="outline" subscriptSizing="dynamic" hideRequiredMarker> <mat-form-field class="tb-value-type flex-1" appearance="outline" subscriptSizing="dynamic" hideRequiredMarker>
<mat-label translate>filter.value-type.value-type</mat-label> <mat-label translate>filter.value-type.value-type</mat-label>
<mat-select formControlName="valueType"> <mat-select formControlName="valueType">
<mat-select-trigger> <mat-select-trigger>
@ -93,10 +93,12 @@
cdkFocusInitial> cdkFocusInitial>
{{ 'action.cancel' | translate }} {{ 'action.cancel' | translate }}
</button> </button>
<button mat-raised-button color="primary" @if (!readonly) {
type="submit" <button mat-raised-button color="primary"
[disabled]="filterFormGroup.invalid || !filterFormGroup.dirty || !predicatesValid"> type="submit"
{{ (data.isAdd ? 'action.add' : 'action.update') | translate }} [disabled]="filterFormGroup.invalid || !filterFormGroup.dirty || !predicatesValid">
</button> {{ (data.isAdd ? 'action.add' : 'action.update') | translate }}
</button>
}
</div> </div>
</form> </form>

7
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.ts

@ -39,6 +39,7 @@
isAdd: boolean; isAdd: boolean;
arguments: Record<string, CalculatedFieldArgument>; arguments: Record<string, CalculatedFieldArgument>;
usedArguments: Array<string>; usedArguments: Array<string>;
readonly: boolean;
} }
@Component({ @Component({
@ -66,6 +67,8 @@ export class AlarmRuleFilterDialogComponent extends DialogComponent<AlarmRuleFil
arguments = this.data.arguments; arguments = this.data.arguments;
argumentsList: Array<string>; argumentsList: Array<string>;
readonly = this.data.readonly;
constructor(protected store: Store<AppState>, constructor(protected store: Store<AppState>,
protected router: Router, protected router: Router,
@Inject(MAT_DIALOG_DATA) public data: AlarmRuleFilterDialogData, @Inject(MAT_DIALOG_DATA) public data: AlarmRuleFilterDialogData,
@ -114,6 +117,10 @@ export class AlarmRuleFilterDialogComponent extends DialogComponent<AlarmRuleFil
} }
} }
}); });
if (this.readonly) {
this.filterFormGroup.disable({emitEvent: false});
}
} }
argumentInUse(argument: string): boolean { argumentInUse(argument: string): boolean {

9
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-list.component.html

@ -40,11 +40,11 @@
</div> </div>
<div class="flex max-w-92% flex-full flex-col"> <div class="flex max-w-92% flex-full flex-col">
<div class="flex flex-row items-center justify-start"> <div class="flex flex-row items-center justify-start">
<div class="flex-1 filters-text">{{ filterControl.value?.argument }}</div> <div class="filters-text flex-1">{{ filterControl.value?.argument }}</div>
<div class="flex-1 filters-text">{{ FilterPredicateTypeTranslationMap.get(filterControl.value?.valueType) | translate }}</div> <div class="filters-text flex-1">{{ FilterPredicateTypeTranslationMap.get(filterControl.value?.valueType) | translate }}</div>
<button mat-icon-button color="primary" class="tb-budge-button" <button mat-icon-button color="primary" class="tb-budge-button"
type="button" type="button"
(click)="editFilter(index)" (click)="editFilter(index, readonly)"
matTooltip="{{ 'alarm-rule.edit-filter' | translate }}" matTooltip="{{ 'alarm-rule.edit-filter' | translate }}"
matTooltipPosition="above"> matTooltipPosition="above">
<mat-icon <mat-icon
@ -53,11 +53,12 @@
matBadgeSize="small" matBadgeSize="small"
matBadge="*" matBadge="*"
> >
edit {{ readonly ? 'visibility' : 'edit' }}
</mat-icon> </mat-icon>
</button> </button>
<button mat-icon-button color="primary" <button mat-icon-button color="primary"
type="button" type="button"
[disabled]="disabled || readonly"
(click)="removeFilter(index)" (click)="removeFilter(index)"
matTooltip="{{ 'alarm-rule.remove-filter' | translate }}" matTooltip="{{ 'alarm-rule.remove-filter' | translate }}"
matTooltipPosition="above"> matTooltipPosition="above">

12
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-list.component.ts

@ -71,6 +71,9 @@ export class AlarmRuleFilterListComponent implements ControlValueAccessor, Valid
@Input() @Input()
operation: ComplexOperation = ComplexOperation.AND; operation: ComplexOperation = ComplexOperation.AND;
@Input()
readonly = false;
filterListFormGroup = this.fb.group({ filterListFormGroup = this.fb.group({
filters: this.fb.array([]) filters: this.fb.array([])
}); });
@ -143,17 +146,17 @@ export class AlarmRuleFilterListComponent implements ControlValueAccessor, Valid
}); });
} }
public editFilter(index: number) { public editFilter(index: number, readonly = false) {
const filter: AlarmRuleFilter = const filter: AlarmRuleFilter =
(this.filterListFormGroup.get('filters') as FormArray).at(index).value; (this.filterListFormGroup.get('filters') as FormArray).at(index).value;
this.openFilterDialog(filter).subscribe(result => { this.openFilterDialog(filter, readonly).subscribe(result => {
if (result) { if (result) {
(this.filterListFormGroup.get('filters') as FormArray).at(index).patchValue(result); (this.filterListFormGroup.get('filters') as FormArray).at(index).patchValue(result);
} }
}); });
} }
private openFilterDialog(filter?: AlarmRuleFilter): Observable<AlarmRuleFilter> { private openFilterDialog(filter?: AlarmRuleFilter, readonly = false): Observable<AlarmRuleFilter> {
const isAdd = !filter; const isAdd = !filter;
if (isAdd) { if (isAdd) {
filter = { filter = {
@ -171,7 +174,8 @@ export class AlarmRuleFilterListComponent implements ControlValueAccessor, Valid
filter: filter ? deepClone(filter) : null, filter: filter ? deepClone(filter) : null,
isAdd, isAdd,
arguments: this.arguments, arguments: this.arguments,
usedArguments: this.getUsedArguments usedArguments: this.getUsedArguments,
readonly
} }
}).afterClosed(); }).afterClosed();
} }

2
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate-list.component.html

@ -31,7 +31,7 @@
<mat-divider style="padding-bottom: 5px;"></mat-divider> <mat-divider style="padding-bottom: 5px;"></mat-divider>
<div class="predicate-list"> <div class="predicate-list">
@for (predicateControl of predicatesFormArray.controls; track predicateControl; let index = $index) { @for (predicateControl of predicatesFormArray.controls; track predicateControl; let index = $index) {
<div class="flex flex-row items-stretch justify-start relative" <div class="relative flex flex-row items-stretch justify-start"
[class.key-filter-list-divider]="$index"> [class.key-filter-list-divider]="$index">
@if (index) { @if (index) {
<div class="filters-operation-container"> <div class="filters-operation-container">

5
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate-list.component.ts

@ -80,6 +80,8 @@ export class AlarmRuleFilterPredicateListComponent implements ControlValueAccess
@Input() argumentInUse: string; @Input() argumentInUse: string;
@Input() readonly: boolean;
filterListFormGroup = this.fb.group({ filterListFormGroup = this.fb.group({
predicates: this.fb.array([]) predicates: this.fb.array([])
}); });
@ -197,7 +199,8 @@ export class AlarmRuleFilterPredicateListComponent implements ControlValueAccess
valueType: this.valueType, valueType: this.valueType,
isAdd: true, isAdd: true,
arguments: this.arguments, arguments: this.arguments,
argumentInUse: this.argumentInUse argumentInUse: this.argumentInUse,
readonly: this.readonly
} }
}).afterClosed().pipe( }).afterClosed().pipe(
map(result => result) map(result => result)

4
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate-no-data-value.component.html

@ -17,7 +17,7 @@
--> -->
<div class="tb-form-panel no-border no-gap no-padding" [formGroup]="filterPredicateValueNoDataFormGroup"> <div class="tb-form-panel no-border no-gap no-padding" [formGroup]="filterPredicateValueNoDataFormGroup">
<div class="tb-form-row no-padding no-border column-xs"> <div class="tb-form-row no-padding no-border column-xs">
<mat-form-field hideRequiredMarker class="flex-1 w-full max-w-30% xs:max-w-full" appearance="outline" subscriptSizing="dynamic"> <mat-form-field hideRequiredMarker class="w-full max-w-30% flex-1 xs:max-w-full" appearance="outline" subscriptSizing="dynamic">
<mat-select [formControl]="dynamicModeControl" placeholder="{{'filter.dynamic-source-type' | translate}}"> <mat-select [formControl]="dynamicModeControl" placeholder="{{'filter.dynamic-source-type' | translate}}">
<mat-option [value]="false">{{'alarm-rule.static' | translate}}</mat-option> <mat-option [value]="false">{{'alarm-rule.static' | translate}}</mat-option>
<mat-option [value]="true">{{'alarm-rule.dynamic' | translate}}</mat-option> <mat-option [value]="true">{{'alarm-rule.dynamic' | translate}}</mat-option>
@ -39,7 +39,7 @@
} }
</mat-form-field> </mat-form-field>
} @else { } @else {
<mat-form-field class="flex-1 w-full" appearance="outline" subscriptSizing="dynamic"> <mat-form-field class="w-full flex-1" appearance="outline" subscriptSizing="dynamic">
<mat-select formControlName="dynamicValueArgument" placeholder="{{ 'action.set' | translate }}"> <mat-select formControlName="dynamicValueArgument" placeholder="{{ 'action.set' | translate }}">
@for (argument of argumentsList; track argument) { @for (argument of argumentsList; track argument) {
<mat-option [value]="argument" [disabled]="argument === argumentInUse">{{ argument }}</mat-option> <mat-option [value]="argument" [disabled]="argument === argumentInUse">{{ argument }}</mat-option>

4
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate-value.component.html

@ -17,7 +17,7 @@
--> -->
<div class="tb-form-panel no-border no-gap no-padding" [formGroup]="filterPredicateValueFormGroup"> <div class="tb-form-panel no-border no-gap no-padding" [formGroup]="filterPredicateValueFormGroup">
<div class="tb-form-row no-padding no-border column-xs"> <div class="tb-form-row no-padding no-border column-xs">
<mat-form-field hideRequiredMarker class="flex-1 w-full max-w-30% xs:max-w-full" appearance="outline" subscriptSizing="dynamic"> <mat-form-field hideRequiredMarker class="w-full max-w-30% flex-1 xs:max-w-full" appearance="outline" subscriptSizing="dynamic">
<mat-select [formControl]="dynamicModeControl" placeholder="{{'filter.dynamic-source-type' | translate}}"> <mat-select [formControl]="dynamicModeControl" placeholder="{{'filter.dynamic-source-type' | translate}}">
<mat-option [value]="false">{{'alarm-rule.static' | translate}}</mat-option> <mat-option [value]="false">{{'alarm-rule.static' | translate}}</mat-option>
<mat-option [value]="true">{{'alarm-rule.dynamic' | translate}}</mat-option> <mat-option [value]="true">{{'alarm-rule.dynamic' | translate}}</mat-option>
@ -52,7 +52,7 @@
} }
} }
} @else { } @else {
<mat-form-field class="flex-1 w-full" appearance="outline" subscriptSizing="dynamic"> <mat-form-field class="w-full flex-1" appearance="outline" subscriptSizing="dynamic">
<mat-select formControlName="dynamicValueArgument" placeholder="{{ 'action.set' | translate }}"> <mat-select formControlName="dynamicValueArgument" placeholder="{{ 'action.set' | translate }}">
@for (argument of argumentsList; track argument) { @for (argument of argumentsList; track argument) {
<mat-option [value]="argument" [disabled]="argument === argumentInUse">{{ argument }}</mat-option> <mat-option [value]="argument" [disabled]="argument === argumentInUse">{{ argument }}</mat-option>

4
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate.component.html

@ -19,7 +19,7 @@
<div class="tb-form-panel no-border no-padding-right flex-1" style="flex-direction: row"> <div class="tb-form-panel no-border no-padding-right flex-1" style="flex-direction: row">
@switch (type) { @switch (type) {
@case (filterPredicateType.STRING) { @case (filterPredicateType.STRING) {
<div class="tb-form-row no-padding no-border column-xs w-full max-w-30% xs:max-w-full flex-1/"> <div class="tb-form-row no-padding no-border column-xs flex-1/ w-full max-w-30% xs:max-w-full">
<mat-form-field hideRequiredMarker class="flex-1" appearance="outline" subscriptSizing="dynamic"> <mat-form-field hideRequiredMarker class="flex-1" appearance="outline" subscriptSizing="dynamic">
<mat-select required formControlName="operation" placeholder="{{'filter.operation.operation' | translate}}"> <mat-select required formControlName="operation" placeholder="{{'filter.operation.operation' | translate}}">
<mat-option *ngFor="let operation of stringOperations" [value]="operation"> <mat-option *ngFor="let operation of stringOperations" [value]="operation">
@ -64,7 +64,7 @@
(click)="openComplexFilterDialog()"> (click)="openComplexFilterDialog()">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="w-full text-start" translate>filter.complex-filter</span> <span class="w-full text-start" translate>filter.complex-filter</span>
<mat-icon class="tb-mat-20 tb-alarm-rule-schedule-edit-icon">edit</mat-icon> <mat-icon class="tb-mat-20 tb-alarm-rule-schedule-edit-icon">{{ disabled ? 'visibility' : 'edit' }} </mat-icon>
</div> </div>
</button> </button>
</div> </div>

1
ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate.component.ts

@ -203,6 +203,7 @@ export class AlarmRuleFilterPredicateComponent implements ControlValueAccessor,
isAdd: false, isAdd: false,
arguments: this.arguments, arguments: this.arguments,
argumentInUse: this.argumentInUse, argumentInUse: this.argumentInUse,
readonly: this.disabled
} }
}).afterClosed().subscribe( }).afterClosed().subscribe(
(result) => { (result) => {

5
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.html

@ -101,6 +101,7 @@
[entityName]="entityName" [entityName]="entityName"
[ownerId]="ownerId" [ownerId]="ownerId"
[tenantId]="tenantId" [tenantId]="tenantId"
[isEditValue]="isEditValue"
></tb-geofencing-configuration> ></tb-geofencing-configuration>
} }
@case (CalculatedFieldType.PROPAGATION) { @case (CalculatedFieldType.PROPAGATION) {
@ -111,6 +112,7 @@
[tenantId]="tenantId" [tenantId]="tenantId"
[ownerId]="ownerId" [ownerId]="ownerId"
[testScript]="onTestScript.bind(this)" [testScript]="onTestScript.bind(this)"
[isEditValue]="isEditValue"
></tb-propagation-configuration> ></tb-propagation-configuration>
} }
@case (CalculatedFieldType.RELATED_ENTITIES_AGGREGATION) { @case (CalculatedFieldType.RELATED_ENTITIES_AGGREGATION) {
@ -120,6 +122,7 @@
[entityName]="entityName" [entityName]="entityName"
[tenantId]="tenantId" [tenantId]="tenantId"
[testScript]="onTestScript.bind(this)" [testScript]="onTestScript.bind(this)"
[isEditValue]="isEditValue"
></tb-related-entities-aggregation-component> ></tb-related-entities-aggregation-component>
} }
@case (CalculatedFieldType.ENTITY_AGGREGATION) { @case (CalculatedFieldType.ENTITY_AGGREGATION) {
@ -128,6 +131,7 @@
[entityId]="entityId" [entityId]="entityId"
[entityName]="entityName" [entityName]="entityName"
[tenantId]="tenantId" [tenantId]="tenantId"
[isEditValue]="isEditValue"
></tb-entity-aggregation-component> ></tb-entity-aggregation-component>
} }
@default { @default {
@ -139,6 +143,7 @@
[tenantId]="tenantId" [tenantId]="tenantId"
[isScript]="entityForm.get('type').value === CalculatedFieldType.SCRIPT" [isScript]="entityForm.get('type').value === CalculatedFieldType.SCRIPT"
[testScript]="onTestScript.bind(this)" [testScript]="onTestScript.bind(this)"
[isEditValue]="isEditValue"
></tb-simple-configuration> ></tb-simple-configuration>
} }
} }

2
ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.html

@ -93,7 +93,7 @@
<mat-header-cell *matHeaderCellDef class="w-20 min-w-20"/> <mat-header-cell *matHeaderCellDef class="w-20 min-w-20"/>
<mat-cell *matCellDef="let argument;"> <mat-cell *matCellDef="let argument;">
<div class="tb-form-table-row-cell-buttons min-w-20"> <div class="tb-form-table-row-cell-buttons min-w-20">
@if (disable) { @if (!isEditValue) {
<button type="button" <button type="button"
mat-icon-button mat-icon-button
#previewButton #previewButton

1
ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.ts

@ -89,6 +89,7 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces
@Input() ownerId: EntityId; @Input() ownerId: EntityId;
@Input() isScript: boolean; @Input() isScript: boolean;
@Input({transform: booleanAttribute}) disable = false; @Input({transform: booleanAttribute}) disable = false;
@Input({transform: booleanAttribute}) isEditValue = true;
@Input() watchKeyChange = false; @Input() watchKeyChange = false;
@ViewChild(MatSort, { static: true }) sort: MatSort; @ViewChild(MatSort, { static: true }) sort: MatSort;

1
ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.html

@ -26,6 +26,7 @@
<tb-entity-aggregation-arguments-table formControlName="arguments" <tb-entity-aggregation-arguments-table formControlName="arguments"
[entityId]="entityId" [entityId]="entityId"
[tenantId]="tenantId" [tenantId]="tenantId"
[isEditValue]="isEditValue"
[entityName]="entityName"/> [entityName]="entityName"/>
</div> </div>
<div class="tb-form-panel"> <div class="tb-form-panel">

4
ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.ts

@ -14,7 +14,7 @@
/// limitations under the License. /// limitations under the License.
/// ///
import { Component, forwardRef, Input } from '@angular/core'; import { booleanAttribute, Component, forwardRef, Input } from '@angular/core';
import { import {
ControlValueAccessor, ControlValueAccessor,
FormBuilder, FormBuilder,
@ -87,6 +87,8 @@ export class EntityAggregationComponentComponent implements ControlValueAccessor
@Input() testScript: (expression?: string) => Observable<string>; @Input() testScript: (expression?: string) => Observable<string>;
@Input({transform: booleanAttribute}) isEditValue = true;
readonly minAllowedAggregationIntervalInSecForCF = getCurrentAuthState(this.store).minAllowedAggregationIntervalInSecForCF; readonly minAllowedAggregationIntervalInSecForCF = getCurrentAuthState(this.store).minAllowedAggregationIntervalInSecForCF;
readonly intermediateAggregationIntervalInSecForCF = getCurrentAuthState(this.store).intermediateAggregationIntervalInSecForCF; readonly intermediateAggregationIntervalInSecForCF = getCurrentAuthState(this.store).intermediateAggregationIntervalInSecForCF;
readonly DayInSec = DAY / SECOND; readonly DayInSec = DAY / SECOND;

2
ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.html

@ -96,7 +96,7 @@
<mat-header-cell *matHeaderCellDef class="w-20 min-w-20"/> <mat-header-cell *matHeaderCellDef class="w-20 min-w-20"/>
<mat-cell *matCellDef="let geofenceZone;"> <mat-cell *matCellDef="let geofenceZone;">
<div class="tb-form-table-row-cell-buttons min-w-20"> <div class="tb-form-table-row-cell-buttons min-w-20">
@if (disable) { @if (!isEditValue) {
<button type="button" <button type="button"
mat-icon-button mat-icon-button
#previewButton #previewButton

2
ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.ts

@ -16,6 +16,7 @@
import { import {
AfterViewInit, AfterViewInit,
booleanAttribute,
ChangeDetectorRef, ChangeDetectorRef,
Component, Component,
DestroyRef, DestroyRef,
@ -82,6 +83,7 @@ export class CalculatedFieldGeofencingZoneGroupsTableComponent implements Contro
@Input({required: true}) tenantId: string; @Input({required: true}) tenantId: string;
@Input({required: true}) entityName: string; @Input({required: true}) entityName: string;
@Input({required: true}) ownerId: EntityId; @Input({required: true}) ownerId: EntityId;
@Input({transform: booleanAttribute}) isEditValue = true;
@ViewChild(MatSort, { static: true }) sort: MatSort; @ViewChild(MatSort, { static: true }) sort: MatSort;

1
ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/geofencing-configuration.component.html

@ -44,6 +44,7 @@
[entityId]="entityId" [entityId]="entityId"
[tenantId]="tenantId" [tenantId]="tenantId"
[ownerId]="ownerId" [ownerId]="ownerId"
[isEditValue]="isEditValue"
[entityName]="entityName"/> [entityName]="entityName"/>
<div class="tb-form-row space-between flex-1 columns-xs" [class.!hidden]="!isRelatedEntity"> <div class="tb-form-row space-between flex-1 columns-xs" [class.!hidden]="!isRelatedEntity">
<mat-slide-toggle class="mat-slide" formControlName="scheduledUpdateEnabled"> <mat-slide-toggle class="mat-slide" formControlName="scheduledUpdateEnabled">

4
ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/geofencing-configuration.component.ts

@ -14,7 +14,7 @@
/// limitations under the License. /// limitations under the License.
/// ///
import { Component, forwardRef, Input, OnChanges, SimpleChanges } from '@angular/core'; import { booleanAttribute, Component, forwardRef, Input, OnChanges, SimpleChanges } from '@angular/core';
import { import {
ControlValueAccessor, ControlValueAccessor,
FormBuilder, FormBuilder,
@ -72,6 +72,8 @@ export class GeofencingConfigurationComponent implements ControlValueAccessor, V
@Input({required: true}) @Input({required: true})
ownerId: EntityId; ownerId: EntityId;
@Input({transform: booleanAttribute}) isEditValue = true;
readonly minAllowedScheduledUpdateIntervalInSecForCF = getCurrentAuthState(this.store).minAllowedScheduledUpdateIntervalInSecForCF; readonly minAllowedScheduledUpdateIntervalInSecForCF = getCurrentAuthState(this.store).minAllowedScheduledUpdateIntervalInSecForCF;
readonly DataKeyType = DataKeyType; readonly DataKeyType = DataKeyType;

1
ui-ngx/src/app/modules/home/components/calculated-fields/components/propagation-configuration/propagation-configuration.component.html

@ -56,6 +56,7 @@
[entityName]="entityName" [entityName]="entityName"
[ownerId]="ownerId" [ownerId]="ownerId"
[watchKeyChange]="true" [watchKeyChange]="true"
[isEditValue]="isEditValue"
[isScript]="this.propagateConfiguration.get('applyExpressionToResolvedArguments').value"/> [isScript]="this.propagateConfiguration.get('applyExpressionToResolvedArguments').value"/>
</div> </div>
<div class="tb-form-panel no-gap" [class.!hidden]="!this.propagateConfiguration.get('applyExpressionToResolvedArguments').value"> <div class="tb-form-panel no-gap" [class.!hidden]="!this.propagateConfiguration.get('applyExpressionToResolvedArguments').value">

4
ui-ngx/src/app/modules/home/components/calculated-fields/components/propagation-configuration/propagation-configuration.component.ts

@ -14,7 +14,7 @@
/// limitations under the License. /// limitations under the License.
/// ///
import { Component, forwardRef, Input } from '@angular/core'; import { booleanAttribute, Component, forwardRef, Input } from '@angular/core';
import { import {
ControlValueAccessor, ControlValueAccessor,
FormBuilder, FormBuilder,
@ -77,6 +77,8 @@ export class PropagationConfigurationComponent implements ControlValueAccessor,
@Input({required: true}) @Input({required: true})
testScript: () => Observable<string>; testScript: () => Observable<string>;
@Input({transform: booleanAttribute}) isEditValue = true;
propagateConfiguration = this.fb.group({ propagateConfiguration = this.fb.group({
arguments: this.fb.control({}, notEmptyObjectValidator()), arguments: this.fb.control({}, notEmptyObjectValidator()),
applyExpressionToResolvedArguments: [false], applyExpressionToResolvedArguments: [false],

1
ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/related-entities-aggregation-component.component.html

@ -48,6 +48,7 @@
[entityId]="entityId" [entityId]="entityId"
[tenantId]="tenantId" [tenantId]="tenantId"
[entityName]="entityName" [entityName]="entityName"
[isEditValue]="isEditValue"
[relation]="relatedAggregationConfiguration.get('relation').value"/> [relation]="relatedAggregationConfiguration.get('relation').value"/>
</div> </div>
<div class="tb-form-panel"> <div class="tb-form-panel">

4
ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/related-entities-aggregation-component.component.ts

@ -14,7 +14,7 @@
/// limitations under the License. /// limitations under the License.
/// ///
import { Component, forwardRef, Input } from '@angular/core'; import { booleanAttribute, Component, forwardRef, Input } from '@angular/core';
import { import {
ControlValueAccessor, ControlValueAccessor,
FormBuilder, FormBuilder,
@ -76,6 +76,8 @@ export class RelatedEntitiesAggregationComponentComponent implements ControlValu
@Input({required: true}) @Input({required: true})
testScript: (expression?: string) => Observable<string>; testScript: (expression?: string) => Observable<string>;
@Input({transform: booleanAttribute}) isEditValue = true;
readonly ScriptLanguage = ScriptLanguage; readonly ScriptLanguage = ScriptLanguage;
readonly CalculatedFieldType = CalculatedFieldType; readonly CalculatedFieldType = CalculatedFieldType;
readonly OutputType = OutputType; readonly OutputType = OutputType;

1
ui-ngx/src/app/modules/home/components/calculated-fields/components/simple-configuration/simple-configuration.component.html

@ -26,6 +26,7 @@
[tenantId]="tenantId" [tenantId]="tenantId"
[ownerId]="ownerId" [ownerId]="ownerId"
[entityName]="entityName" [entityName]="entityName"
[isEditValue]="isEditValue"
[watchKeyChange]="true" [watchKeyChange]="true"
[isScript]="isScript" /> [isScript]="isScript" />
</div> </div>

4
ui-ngx/src/app/modules/home/components/calculated-fields/components/simple-configuration/simple-configuration.component.ts

@ -14,7 +14,7 @@
/// limitations under the License. /// limitations under the License.
/// ///
import { Component, forwardRef, Input, OnChanges, SimpleChanges } from '@angular/core'; import { booleanAttribute, Component, forwardRef, Input, OnChanges, SimpleChanges } from '@angular/core';
import { import {
ControlValueAccessor, ControlValueAccessor,
FormBuilder, FormBuilder,
@ -81,6 +81,8 @@ export class SimpleConfigurationComponent implements ControlValueAccessor, Valid
@Input({required: true}) @Input({required: true})
testScript: () => Observable<string>; testScript: () => Observable<string>;
@Input({transform: booleanAttribute}) isEditValue = true;
simpleConfiguration = this.fb.group({ simpleConfiguration = this.fb.group({
arguments: this.fb.control({}), arguments: this.fb.control({}),
expressionSIMPLE: ['', [Validators.required, Validators.pattern(oneSpaceInsideRegex), Validators.maxLength(255)]], expressionSIMPLE: ['', [Validators.required, Validators.pattern(oneSpaceInsideRegex), Validators.maxLength(255)]],

3
ui-ngx/src/app/modules/home/pages/alarm/alarm-routing.module.ts

@ -22,13 +22,10 @@ import { AlarmsMode } from '@shared/models/alarm.models';
import { MenuId } from '@core/services/menu.models'; import { MenuId } from '@core/services/menu.models';
import { RouterTabsComponent } from "@home/components/router-tabs.component"; import { RouterTabsComponent } from "@home/components/router-tabs.component";
import { AlarmRulesTableComponent } from "@home/components/alarm-rules/alarm-rules-table.component"; import { AlarmRulesTableComponent } from "@home/components/alarm-rules/alarm-rules-table.component";
import { CalculatedFieldsTableComponent } from '@home/components/calculated-fields/calculated-fields-table.component';
import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component';
import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard';
import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models';
import { BreadCrumbConfig } from '@shared/components/breadcrumb'; import { BreadCrumbConfig } from '@shared/components/breadcrumb';
import { CalculatedFieldsTableConfigResolver } from '@home/pages/calculated-fields/calculated-fields-routing.module';
import { CalculatedFieldsTableConfig } from '@home/components/calculated-fields/calculated-fields-table-config';
import { CalculatedFieldsService } from '@core/http/calculated-fields.service'; import { CalculatedFieldsService } from '@core/http/calculated-fields.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';

Loading…
Cancel
Save