Revert "[PROD-3407] [FIX] fixed gateway dashboard sorting by status"
This reverts commit bb9e81db1e37a765872fd5f3b1c54cb3be260c0b.
This commit is contained in:
parent
bb9e81db1e
commit
9ea7042e92
@ -35,7 +35,7 @@ import { AttributeData, AttributeScope } from '@shared/models/telemetry/telemetr
|
||||
import { PageComponent } from '@shared/components/page.component';
|
||||
import { PageLink } from '@shared/models/page/page-link';
|
||||
import { AttributeDatasource } from '@home/models/datasource/attribute-datasource';
|
||||
import { Direction, SORT_ASC_PINNED_VALUE, SORT_DESC_PINNED_VALUE, SortOrder } from '@shared/models/page/sort-order';
|
||||
import { Direction, SortOrder } from '@shared/models/page/sort-order';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { TelemetryWebsocketService } from '@core/ws/telemetry-websocket.service';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
@ -238,26 +238,14 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
|
||||
|
||||
this.dataSource.sort = this.sort;
|
||||
this.dataSource.sortingDataAccessor = (data: AttributeData, sortHeaderId: string) => {
|
||||
switch (sortHeaderId) {
|
||||
case 'syncStatus':
|
||||
return this.isConnectorSynced(data) ? 1 : 0;
|
||||
|
||||
case 'enabled':
|
||||
return this.activeConnectors.includes(data.key) ? 1 : 0;
|
||||
|
||||
case 'errors':
|
||||
const errors = this.getErrorsCount(data);
|
||||
if (typeof errors === 'string') {
|
||||
return this.sort.direction.toUpperCase() === Direction.DESC ? SORT_DESC_PINNED_VALUE : SORT_ASC_PINNED_VALUE;
|
||||
}
|
||||
return errors;
|
||||
|
||||
default:
|
||||
return data[sortHeaderId] || data.value[sortHeaderId];
|
||||
if (sortHeaderId === 'syncStatus') {
|
||||
return this.isConnectorSynced(data) ? 1 : 0;
|
||||
} else if (sortHeaderId === 'enabled') {
|
||||
return this.activeConnectors.includes(data.key) ? 1 : 0;
|
||||
}
|
||||
return data[sortHeaderId] || data.value[sortHeaderId];
|
||||
};
|
||||
|
||||
|
||||
if (this.device) {
|
||||
if (this.device.id === NULL_UUID) {
|
||||
return;
|
||||
|
||||
@ -25,9 +25,6 @@ export enum Direction {
|
||||
DESC = 'DESC'
|
||||
}
|
||||
|
||||
export const SORT_DESC_PINNED_VALUE = -1;
|
||||
export const SORT_ASC_PINNED_VALUE = 9999;
|
||||
|
||||
export function sortOrderFromString(strSortOrder: string): SortOrder {
|
||||
let property: string;
|
||||
let direction = Direction.ASC;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user