From c17a3cbeb37d90f1143d3b92b2398630b798f514 Mon Sep 17 00:00:00 2001 From: Emil Abraham Date: Mon, 8 Apr 2019 22:03:38 -0400 Subject: [PATCH 1/8] Modiefied layout of statistics page to integrate faults/system status --- src/app/statistics/statistics.component.css | 12 ++ src/app/statistics/statistics.component.html | 181 +++++++++++++++---- 2 files changed, 159 insertions(+), 34 deletions(-) diff --git a/src/app/statistics/statistics.component.css b/src/app/statistics/statistics.component.css index a2248be..b721f9c 100644 --- a/src/app/statistics/statistics.component.css +++ b/src/app/statistics/statistics.component.css @@ -26,3 +26,15 @@ mwl-gauge > .gauge > .value-text { position: relative; padding: 5px; } +h6 +{ + font-size: 13px; +} +.faults +{ + font-size: 14px; +} +.status +{ + font-size: 14px; +} diff --git a/src/app/statistics/statistics.component.html b/src/app/statistics/statistics.component.html index 26e1388..65d94df 100644 --- a/src/app/statistics/statistics.component.html +++ b/src/app/statistics/statistics.component.html @@ -24,33 +24,33 @@ -
- -
-
- - -
-
+
+
+
+
+
+ +
-
-
-
- - +
-
+
+
+ +
-
-
-
- - +
+
-
+
+
+ +
-
-
+
+
+
+
@@ -97,23 +97,126 @@
+
- -
-
+
+

EPS Supplying Load

+
+
+

light

+
+
+

Not-In-Auto

+
+
+

light

+
+
+

System Ready

+
+
+

light

+
+
+

Generator Running

+
+
+

light

+
+
+

Comm. Status

+
+
+

light

+
+
+
+
+
@@ -154,9 +257,19 @@
+ + + + + + + Data is not available within the last 24 hours + +
+
- +
@@ -235,7 +235,7 @@
- +
@@ -243,7 +243,7 @@
- +
From 10aa0bb1013447aaeba5fb47c8d1ae819c67d1ba Mon Sep 17 00:00:00 2001 From: Emil Abraham Date: Mon, 15 Apr 2019 16:45:12 -0400 Subject: [PATCH 7/8] integrated ngifs with statuses, cleaned up code --- src/app/statistics/statistics.component.html | 43 ++++----- src/app/statistics/statistics.component.ts | 93 ++------------------ 2 files changed, 22 insertions(+), 114 deletions(-) diff --git a/src/app/statistics/statistics.component.html b/src/app/statistics/statistics.component.html index 419ba87..7d4410a 100644 --- a/src/app/statistics/statistics.component.html +++ b/src/app/statistics/statistics.component.html @@ -107,67 +107,61 @@

Faults

-
Overcrank
+
Overcrank
Overcrank
-
High Engine
Temperature
+
High Engine
Temperature
High Engine
Temperature
-
Low Oil
Pressure
+
Low Oil
Pressure
Low Oil
Pressure
-
Overspeed
+
Overspeed
Overspeed
-
Emergency Stop
+
Emergency Stop
Emergency Stop
-
Low Fuel
+
Low Fuel
Low Fuel
-
Low Coolant
Level/Aux
+
Low Coolant
Level/Aux
Low Coolant
Level/Aux
-
Low Cranking
Voltage
+
Low Cranking
Voltage
Low Cranking
Voltage
-
Battery Voltage
(Hi/Lo)
+
Battery Voltage
(Hi/Lo)
Battery Voltage
(Hi/Lo)
-
-
-
Battery Charger
Fail
- -
Battery Charger
Fail
-
-
+
-
Common Fault
+
Common Fault
Common Fault
@@ -178,35 +172,30 @@

System Status

-
EPS Supplying
Load
+
EPS Supplying
Load
EPS Supplying
Load
-
Not-In-Auto
+
Not-In-Auto
Not-In-Auto
-
System Running
+
System Ready
System Running
-
Generator
Running
+
Generator
Running
Generator
Running
-
-
Communication
Status
- -
Communication
Status
-
-
+
diff --git a/src/app/statistics/statistics.component.ts b/src/app/statistics/statistics.component.ts index 58e7664..c9bb285 100644 --- a/src/app/statistics/statistics.component.ts +++ b/src/app/statistics/statistics.component.ts @@ -53,35 +53,9 @@ export class StatisticsComponent implements OnInit { public metricYearAvg: any; public fuelTempYearAvg: any; - public isRecent: boolean = true; - public isHour: boolean = false; - public isDay: boolean = false; - public isWeek: boolean = false; - public isMonth: boolean = false; - public isYear: boolean = false; - - public isOvercrank: boolean = false; - public isHighEngineTemperature: boolean = false; - public isLowOilPressure: boolean = false; - public isOverspeed: boolean = false; - public isEmergencyStop: boolean = false; - public isLowFuel: boolean = false; - public isLowCoolant: boolean = false; - public isLowCrankingVoltage: boolean = false; - public isBatteryVoltage: boolean = false; - public isBatteryChargerFail: boolean = false; - public isCommonFault: boolean = false; - public isEPSSupplying: boolean = false; - public isNotInAuto: boolean = false; - public isSystemRunning: boolean = false; - public isGeneratorRunning: boolean = false; - public isCommunicationStatus: boolean = false; - - public testArray: String[] = ["overcrank", "high_engine_temp"]; - public generator : GeneratorState; goToGraphGen() @@ -95,45 +69,8 @@ export class StatisticsComponent implements OnInit { localStorage.setItem('data_type', dataType); } - lengthCheck(metricArray) - { - if (metricArray.length == 0) - { - return null; - - } - else - { - return metricArray[0][1]; - } - - } - setCheck(metricArray) - { - if(metricArray.length == 0) - { - console.log(false) - return false; - } - else - { - console.log(true); - return true; - } - } - statusChange(genStatus) - { - - if(genStatus == "overcrank") - { - return this.isOvercrank = true; - } - else if(genStatus == "high_engine_temp") - { - return this.isHighEngineTemperature = true; - } - } - + + async ngOnInit() { @@ -146,17 +83,8 @@ export class StatisticsComponent implements OnInit { try { this.data.getDevMetrics(jsonToken).subscribe((data) => { - //console.log(data.outputs[1].dps[0][1]); - this.metric = data; - //console.log(this.metric.outputs[0].dps.length == 0); - - - this.fuelTemp = this.lengthCheck(this.metric.outputs[0].dps); - //this.fuelTempCheck = this.setCheck(this.metric.outputs[0].dps); - //console.log(this.fuelTempCheck); - - //this.fuelTemp = this.metric.outputs[0].dps[0][1]; + this.metric = data; this.oilTemp = this.metric.outputs[1].dps[0][1]; this.pACurrent = this.metric.outputs[2].dps[0][1]; this.pBCurrent = this.metric.outputs[3].dps[0][1]; @@ -176,25 +104,16 @@ export class StatisticsComponent implements OnInit { }); + this.generator = await this.data2.getGeneratorState(gen_id,jsonToken); - if (this.generator.fault_count == 0) - { - console.log("hi"); - } - else - { - for(var i = 0; i< this.testArray.length; i++) - { - this.statusChange(this.testArray[i]); - - } - } + } catch (err) { return err; } + try { this.data.getYearMetrics(jsonToken).subscribe((data) => { From 800a3d696b56e464caebf5a1eaf59d2d6343a1b7 Mon Sep 17 00:00:00 2001 From: Emil Abraham Date: Mon, 15 Apr 2019 16:54:10 -0400 Subject: [PATCH 8/8] possibly fixed isRecent --- src/app/statistics/statistics.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/statistics/statistics.component.html b/src/app/statistics/statistics.component.html index 7d4410a..b01f43d 100644 --- a/src/app/statistics/statistics.component.html +++ b/src/app/statistics/statistics.component.html @@ -199,7 +199,7 @@
-
+