added debug logging message for detected devices.
adding a mocked class for Config. Adding device type to Device struct. Will eventually be needed for raid drives. adding End-to-end testing capabilties. Added testdata json files for webserver requests. Seperated Start code and Setup code in webapp so we can test. renamed "smart_attributes" to "ata_attributes" - Backwards incomatible change. Added front end device sorting (red, yellow, green) show unknown icon/status if drive has no smart data yet. Moved all attribute "getters" into the controller. created a device-sort pipe.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'deviceSort'
|
||||
})
|
||||
export class DeviceSortPipe implements PipeTransform {
|
||||
|
||||
numericalStatus(device): number {
|
||||
if(!device.smart_results[0]){
|
||||
return 0
|
||||
} else if (device.smart_results[0].smart_status == 'passed'){
|
||||
return 1
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
transform(devices: Array<unknown>, ...args: unknown[]): Array<unknown> {
|
||||
//failed, unknown/empty, passed
|
||||
devices.sort((a: any, b: any) => {
|
||||
|
||||
let left = this.numericalStatus(a)
|
||||
let right = this.numericalStatus(b)
|
||||
|
||||
return left - right;
|
||||
});
|
||||
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user