Browse Source
Merge pull request #10984 from maxunbearable/fix/gateway-status-sorting
Fixed gateway dashboard sorting connectors by status
pull/11071/head
Vladyslav Prykhodko
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
16 additions and
5 deletions
-
ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts
|
|
|
@ -238,12 +238,23 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie |
|
|
|
|
|
|
|
this.dataSource.sort = this.sort; |
|
|
|
this.dataSource.sortingDataAccessor = (data: AttributeData, sortHeaderId: string) => { |
|
|
|
if (sortHeaderId === 'syncStatus') { |
|
|
|
return this.isConnectorSynced(data) ? 1 : 0; |
|
|
|
} else if (sortHeaderId === 'enabled') { |
|
|
|
return this.activeConnectors.includes(data.key) ? 1 : 0; |
|
|
|
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 ? -1 : Infinity; |
|
|
|
} |
|
|
|
return errors; |
|
|
|
|
|
|
|
default: |
|
|
|
return data[sortHeaderId] || data.value[sortHeaderId]; |
|
|
|
} |
|
|
|
return data[sortHeaderId] || data.value[sortHeaderId]; |
|
|
|
}; |
|
|
|
|
|
|
|
if (this.device) { |
|
|
|
|