Browse Source

UI: enhancement and bug-fix for alarm rule and cf

pull/14578/head
ArtemDzhereleiko 10 months ago
parent
commit
1feb690c10
  1. 8
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-list.component.scss
  2. 8
      ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate-list.component.scss
  3. 4
      ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.scss
  4. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html
  5. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.html
  6. 14
      ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.html
  7. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.ts
  8. 11
      ui-ngx/src/app/modules/home/components/calculated-fields/components/output/calculated-field-output.component.html
  9. 2
      ui-ngx/src/app/shared/models/alarm-rule.models.ts
  10. 11
      ui-ngx/src/assets/locale/locale.constant-en_US.json

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

@ -20,13 +20,13 @@
font-size: 14px;
font-weight: 500;
}
.no-data-found {
height: 50px;
font-size: 16px;
}
.filter-list {
overflow: auto;
max-height: 300px;
.no-data-found {
height: 50px;
font-size: 16px;
}
&-divider {
border-top: 1px solid rgba(0, 0, 0, 0.12);

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

@ -19,11 +19,9 @@
font-size: 14px;
font-weight: 500;
}
.predicate-list {
.no-data-found {
height: 50px;
font-size: 16px;
}
.no-data-found {
height: 50px;
font-size: 16px;
}
.key-filter-list-divider {

4
ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.scss

@ -27,10 +27,6 @@
}
}
}
.tb-primary-fill {
overflow: visible;
}
}
:host ::ng-deep {

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

@ -15,7 +15,7 @@
limitations under the License.
-->
<div [formGroup]="fieldFormGroup" class="calculated-field-dialog-container flex max-w-4xl flex-col">
<div [formGroup]="fieldFormGroup" class="calculated-field-dialog-container flex flex-col">
<mat-toolbar color="primary">
<h2>{{ 'entity.type-calculated-field' | translate}}</h2>
<span class="flex-1"></span>

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

@ -127,7 +127,7 @@
<div class="tb-form-panel stroked">
<mat-slide-toggle class="mat-slide flex" formControlName="produceIntermediateResult">
<div tb-hint-tooltip-icon="{{ 'calculated-fields.entity-aggregation.produce-intermediate-result-hint' | translate: {
time: (intermediateAggregationIntervalInSecForCF * 1000 | milliSecondsToTimeString )
time: (intermediateAggregationIntervalInSecForCF * 1000 | milliSecondsToTimeString: false: true )
} }}">
{{ 'calculated-fields.entity-aggregation.produce-intermediate-result' | translate }}
</div>

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

@ -56,6 +56,20 @@
<div tbTruncateWithTooltip>{{ AggFunctionTranslations.get(metric.function) | translate }}</div>
</mat-cell>
</ng-container>
<ng-container [matColumnDef]="'argumentName'">
<mat-header-cell mat-sort-header *matHeaderCellDef class="xs:hidden lt-md:w-1/2" [class]="{
'w-1/5': !simpleMode,
'w-1/2': simpleMode,
}">
{{ 'calculated-fields.metrics.argument-name' | translate }}
</mat-header-cell>
<mat-cell *matCellDef="let metric" class="xs:hidden lt-md:w-1/2" [class]="{
'w-1/5': !simpleMode,
'w-1/2': simpleMode,
}">
<div tbTruncateWithTooltip>{{ metric.input.key }}</div>
</mat-cell>
</ng-container>
<ng-container [matColumnDef]="'filter'">
<mat-header-cell mat-sort-header *matHeaderCellDef class="w-1/5 lt-md:hidden">
{{ 'calculated-fields.metrics.filtered' | translate }}

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

@ -116,7 +116,7 @@ export class CalculatedFieldMetricsTableComponent implements OnInit, ControlValu
ngOnInit() {
if (this.simpleMode) {
this.displayColumns = ['name', 'function', 'actions'];
this.displayColumns = ['name', 'function', 'argumentName', 'actions'];
}
}

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

@ -51,14 +51,9 @@
} @else {
<div class="flex items-start gap-3 xs:flex-col xs:items-stretch">
<mat-form-field class="flex-1" appearance="outline" subscriptSizing="dynamic">
<mat-label>
{{
(outputForm.get('type').value === OutputType.Timeseries
? 'calculated-fields.timeseries-key'
: 'calculated-fields.attribute-key')
| translate
}}
</mat-label>
<mat-label>{{ (outputForm.get('type').value === OutputType.Timeseries
? 'calculated-fields.timeseries-key'
: 'calculated-fields.attribute-key') | translate }}</mat-label>
<input matInput formControlName="name" required>
@if (outputForm.get('name').errors && outputForm.get('name').touched) {
<mat-error>

2
ui-ngx/src/app/shared/models/alarm-rule.models.ts

@ -239,7 +239,7 @@ export const alarmRuleBooleanOperationTranslationMap = new Map<AlarmRuleBooleanO
);
export const alarmRuleDefaultScript =
'// Sample expression for an alarm rule: triggers when temperature is above 20 degree\n' +
'// Triggers when temperature is above 20 degrees\n' +
'return temperature > 20;'
export type AlarmRuleTestScriptFn = (calculatedField: CalculatedField, expression: string, argumentsObj?: Record<string, unknown>, closeAllOnSave?: boolean) => Observable<string>;

11
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -1226,10 +1226,11 @@
"metric-name": "Metric name",
"metric-name-required": "Metric name is required.",
"metric-name-pattern": "Metric name is invalid.",
"metric-name-duplicate": "Metric name with such name already exists.",
"metric-name-duplicate": "Metric with such name already exists.",
"metric-name-max-length": "Metric name should be less than 256 characters.",
"metric-name-forbidden": "Metric name is reserved and cannot be used.",
"copy-metric-name": "Copy metric name",
"argument-name": "Argument name",
"aggregation": "Aggregation",
"aggregation-type": {
"avg": "Average",
@ -1301,8 +1302,8 @@
"aggregate-period-hint-offset": "Your aggregation interval will be: {{ interval }}",
"aggregate-period-hint-offset-and-so-on": "Your aggregation interval will be: {{ interval }} and so on",
"entity-aggregation": {
"argument-hint": "Data will be fetched from selected entity",
"argument-setting-hint": "Latest telemetry is the only available argument type for this calculated field",
"argument-hint": "Data will be fetched from current entity",
"argument-setting-hint": "Latest telemetry is the only available argument type for this calculated field.",
"aggregation-interval": "Aggregation interval",
"aggregation-interval-hint": "Defines how often to perform aggregation. Example: every 1 hour aggregates data at 00:00, 01:00, 02:00, etc.",
"apply-offset": "Apply offset to aggregation interval",
@ -1312,11 +1313,11 @@
"offset-value-min": "Offset value must be a positive integer",
"offset-value-max": "Offset value should be less than the aggregate interval value",
"wait-delay": "Wait for delayed telemetry",
"wait-delay-hint": "Waits for delayed telemetry after the interval ends",
"wait-delay-hint": "Waits for delayed telemetry after the interval ends.",
"duration": "Duration",
"duration-required": "Duration is required",
"duration-min": "Duration should be at least 1 minute",
"duration-hint": "How long to wait for delayed data after the interval ends",
"duration-hint": "How long to wait for delayed data after the interval ends.",
"produce-intermediate-result": "Produce intermediate result",
"produce-intermediate-result-hint": "Calculates metrics during the current interval to produce an intermediate result. Updates occur no more often than once every {{ time }}."
},

Loading…
Cancel
Save