Browse Source

Merge pull request #14020 from mtsymbarov-del/fix/entities-table-widget

Fixed column order for "On cell click" action for Entities Table widget
pull/14063/head
Igor Kulikov 1 year ago
committed by GitHub
parent
commit
f4a3b78918
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html
  2. 21
      ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts

2
ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html

@ -57,7 +57,7 @@
<mat-option *ngFor="let column of configuredColumns; let $index = index"
[value]="$index"
[disabled]="usedCellClickColumns.includes($index)">
{{ getCellClickColumnInfo($index, column) }}
{{ getCellClickColumnInfo($index, column) | customTranslate }}
</mat-option>
</mat-select>
<mat-icon matSuffix

21
ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts

@ -926,7 +926,26 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, OnDe
if (this.modelValue) {
const configuredColumns = new Array<CellClickColumnInfo>();
if (this.modelValue.config?.datasources[0]?.dataKeys?.length) {
configuredColumns.push(...this.keysToCellClickColumns(this.modelValue.config.datasources[0].dataKeys));
const {
displayEntityLabel,
displayEntityName,
displayEntityType,
entityNameColumnTitle,
entityLabelColumnTitle
} = this.modelValue.config.settings;
const displayEntitiesArray = [];
if (isDefined(displayEntityName)) {
const displayName = entityNameColumnTitle ? entityNameColumnTitle : 'entityName';
displayEntitiesArray.push({name: displayName, label: displayName});
}
if (isDefined(displayEntityLabel)) {
const displayLabel = entityLabelColumnTitle ? entityLabelColumnTitle : 'entityLabel';
displayEntitiesArray.push({name: displayLabel, label: displayLabel});
}
if (isDefined(displayEntityType)) {
displayEntitiesArray.push({name: 'entityType', label: 'entityType'});
}
configuredColumns.push(...displayEntitiesArray, ...this.keysToCellClickColumns(this.modelValue.config.datasources[0].dataKeys));
}
if (this.modelValue.config?.alarmSource?.dataKeys?.length) {
configuredColumns.push(...this.keysToCellClickColumns(this.modelValue.config.alarmSource.dataKeys));

Loading…
Cancel
Save