diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index 8d48c5f038..509be63ef7 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -414,18 +414,19 @@ export const createLabelFromDatasource = (datasource: Datasource, pattern: strin export const hasDatasourceLabelsVariables = (pattern: string): boolean => varsRegex.test(pattern) !== null; -export function formattedDataFormDatasourceData(input: DatasourceData[], dataIndex?: number): FormattedData[] { +export function formattedDataFormDatasourceData(input: DatasourceData[], dataIndex?: number, ts?: number): FormattedData[] { return _(input).groupBy(el => el.datasource.entityName + el.datasource.entityType) .values().value().map((entityArray, i) => { const datasource = entityArray[0].datasource; const obj = formattedDataFromDatasource(datasource, i); entityArray.filter(el => el.data.length).forEach(el => { const index = isDefined(dataIndex) ? dataIndex : el.data.length - 1; - if (!obj.hasOwnProperty(el.dataKey.label) || el.data[index][1] !== '') { - obj[el.dataKey.label] = el.data[index][1]; - obj[el.dataKey.label + '|ts'] = el.data[index][0]; + const dataSet = isDefined(ts) ? el.data.find(data => data[0] === ts) : el.data[index]; + if (dataSet !== undefined && (!obj.hasOwnProperty(el.dataKey.label) || dataSet[1] !== '')) { + obj[el.dataKey.label] = dataSet[1]; + obj[el.dataKey.label + '|ts'] = dataSet[0]; if (el.dataKey.label.toLowerCase() === 'type') { - obj.deviceType = el.data[index][1]; + obj.deviceType = dataSet[1]; } } }); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html index b07f490dcc..b52e3eaffd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html @@ -60,36 +60,38 @@ - + - +
- +
-
+
- + diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts index 3f97442695..20dff4d85a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts @@ -870,7 +870,7 @@ class TimeseriesDatasource implements DataSource { const rowsMap: {[timestamp: number]: TimeseriesRow} = {}; for (let d = 0; d < data.length; d++) { const columnData = data[d].data; - columnData.forEach((cellData, index) => { + columnData.forEach((cellData) => { const timestamp = cellData[0]; let row = rowsMap[timestamp]; if (!row) { @@ -879,7 +879,7 @@ class TimeseriesDatasource implements DataSource { }; if (this.cellButtonActions.length) { if (this.usedShowCellActionFunction) { - const parsedData = formattedDataFormDatasourceData(data, index); + const parsedData = formattedDataFormDatasourceData(data, undefined, timestamp); row.actionCellButtons = prepareTableCellButtonActions(this.widgetContext, this.cellButtonActions, parsedData[0], this.reserveSpaceForHiddenAction); row.hasActions = checkHasActions(row.actionCellButtons); diff --git a/ui-ngx/src/styles.scss b/ui-ngx/src/styles.scss index a2810d925e..a584985924 100644 --- a/ui-ngx/src/styles.scss +++ b/ui-ngx/src/styles.scss @@ -694,6 +694,10 @@ mat-label { .tb-table-widget { .mat-mdc-table { + .mat-mdc-row { + font-size: 13px; + } + .mat-mdc-cell { background: inherit; color: inherit;