UI: Fixed process entity type in entity table widgets
This commit is contained in:
parent
92cfffab1e
commit
9c961878eb
@ -49,7 +49,7 @@ import { DataKeyType } from '@shared/models/telemetry/telemetry.models';
|
|||||||
import { BehaviorSubject, fromEvent, merge, Observable, Subject } from 'rxjs';
|
import { BehaviorSubject, fromEvent, merge, Observable, Subject } from 'rxjs';
|
||||||
import { emptyPageData, PageData } from '@shared/models/page/page-data';
|
import { emptyPageData, PageData } from '@shared/models/page/page-data';
|
||||||
import { EntityId } from '@shared/models/id/entity-id';
|
import { EntityId } from '@shared/models/id/entity-id';
|
||||||
import { entityTypeTranslations } from '@shared/models/entity-type.models';
|
import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models';
|
||||||
import { debounceTime, distinctUntilChanged, map, takeUntil } from 'rxjs/operators';
|
import { debounceTime, distinctUntilChanged, map, takeUntil } from 'rxjs/operators';
|
||||||
import { MatPaginator } from '@angular/material/paginator';
|
import { MatPaginator } from '@angular/material/paginator';
|
||||||
import { MatSort, SortDirection } from '@angular/material/sort';
|
import { MatSort, SortDirection } from '@angular/material/sort';
|
||||||
@ -408,7 +408,9 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
|
|||||||
} as EntityColumn
|
} as EntityColumn
|
||||||
);
|
);
|
||||||
this.contentsInfo.entityType = {
|
this.contentsInfo.entityType = {
|
||||||
useCellContentFunction: false
|
useCellContentFunction: true,
|
||||||
|
cellContentFunction: (entityType: EntityType) =>
|
||||||
|
entityType ? this.translate.instant(entityTypeTranslations.get(entityType).type) : ''
|
||||||
};
|
};
|
||||||
this.stylesInfo.entityType = {
|
this.stylesInfo.entityType = {
|
||||||
useCellStyleFunction: false
|
useCellStyleFunction: false
|
||||||
@ -869,9 +871,9 @@ class EntityDatasource implements DataSource<EntityData> {
|
|||||||
}
|
}
|
||||||
if (datasource.entityType) {
|
if (datasource.entityType) {
|
||||||
entity.id.entityType = datasource.entityType;
|
entity.id.entityType = datasource.entityType;
|
||||||
entity.entityType = this.translate.instant(entityTypeTranslations.get(datasource.entityType).type);
|
entity.entityType = datasource.entityType;
|
||||||
} else {
|
} else {
|
||||||
entity.entityType = '';
|
entity.entityType = null;
|
||||||
}
|
}
|
||||||
this.dataKeys.forEach((dataKey, index) => {
|
this.dataKeys.forEach((dataKey, index) => {
|
||||||
const keyData = data[index].data;
|
const keyData = data[index].data;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import { DataKeyType } from '@shared/models/telemetry/telemetry.models';
|
|||||||
import { WidgetContext } from '@home/models/widget-component.models';
|
import { WidgetContext } from '@home/models/widget-component.models';
|
||||||
import { UtilsService } from '@core/services/utils.service';
|
import { UtilsService } from '@core/services/utils.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { EntityType } from '@shared/models/entity-type.models';
|
||||||
|
|
||||||
type ColumnVisibilityOptions = 'visible' | 'hidden' | 'hidden-mobile';
|
type ColumnVisibilityOptions = 'visible' | 'hidden' | 'hidden-mobile';
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ export interface EntityData {
|
|||||||
id: EntityId;
|
id: EntityId;
|
||||||
entityName: string;
|
entityName: string;
|
||||||
entityLabel?: string;
|
entityLabel?: string;
|
||||||
entityType?: string;
|
entityType?: EntityType;
|
||||||
actionCellButtons?: TableCellButtonActionDescriptor[];
|
actionCellButtons?: TableCellButtonActionDescriptor[];
|
||||||
hasActions?: boolean;
|
hasActions?: boolean;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ return widgetContext.currentUser.authority === 'CUSTOMER_USER';
|
|||||||
* Display action only if the entity in the row is device and has type `thermostat`:
|
* Display action only if the entity in the row is device and has type `thermostat`:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
return data && data.entityType === 'Device' && data.Type === 'thermostat';
|
return data && data.entityType === 'DEVICE' && data.Type === 'thermostat';
|
||||||
{:copy-code}
|
{:copy-code}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user