From 4e514f06de48a951788484d3df954ddbe29849b7 Mon Sep 17 00:00:00 2001 From: RChandler234 <29521172+RChandler234@users.noreply.github.com> Date: Fri, 20 Dec 2024 19:05:30 -0600 Subject: [PATCH] #260 - move data type enum to src and rename --- .../acceleration-graphs.component.ts | 4 +- ...cceleration-over-time-display.component.ts | 4 +- .../brake-pressure-display.component.ts | 4 +- .../driver-component/driver-component.ts | 4 +- .../latency-display/latency-display.ts | 6 +-- .../motor-info/motor-info.component.ts | 8 ++-- .../raspberry-pi/raspberry-pi.component.ts | 12 ++--- .../speed-display/speed-display.component.ts | 4 +- .../speed-over-time-display.component.ts | 4 +- .../steering-angle-display.component.ts | 4 +- .../torque-display.component.ts | 4 +- .../typography/typography.component.ts | 2 +- ...ntifier-data-type.ts => data-type.enum.ts} | 2 +- .../charging-page-mobile.component.ts | 4 +- .../charging-page/charging-page.component.ts | 4 +- .../BMS-mode/BMS-mode-display.component.ts | 4 +- .../active-status/active-status.component.ts | 4 +- .../balancing-status.component.ts | 4 +- .../current-display.component.ts | 4 +- .../battery-info-display.ts | 12 ++--- .../cell-temp-display.component.ts | 6 +-- .../charging-status.component.ts | 4 +- .../fault-display/fault-display.component.ts | 48 +++++++++---------- .../faulted-status.component.ts | 4 +- .../high-low-cell-display.component.ts | 6 +-- .../pack-temp/pack-temp.component.ts | 4 +- .../pack-voltage-display.component.ts | 4 +- .../starting-soc-timer.component.ts | 4 +- .../state-of-charge-display.component.ts | 4 +- .../date-location.component.ts | 4 +- .../viewer-display.component.ts | 4 +- angular-client/src/pages/map/map.component.ts | 6 +-- angular-client/src/services/socket.service.ts | 4 +- .../utils/{enumerations => }/style-variant.ts | 0 34 files changed, 100 insertions(+), 100 deletions(-) rename angular-client/src/{utils/enumerations/identifier-data-type.ts => data-type.enum.ts} (98%) rename angular-client/src/utils/{enumerations => }/style-variant.ts (100%) diff --git a/angular-client/src/components/acceleration-graphs/acceleration-graphs.component.ts b/angular-client/src/components/acceleration-graphs/acceleration-graphs.component.ts index e8c1cbaf..c4cb8531 100644 --- a/angular-client/src/components/acceleration-graphs/acceleration-graphs.component.ts +++ b/angular-client/src/components/acceleration-graphs/acceleration-graphs.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { decimalPipe } from 'src/utils/pipes.utils'; import { GraphData } from 'src/utils/types.utils'; @@ -26,7 +26,7 @@ export class AccelerationGraphsComponent implements OnInit { maxDataPoints = 400; ngOnInit() { - this.storage.get(IdentifierDataType.XYZAccel).subscribe((value) => { + this.storage.get(DataTypeEnum.XYZAccel).subscribe((value) => { const x1 = decimalPipe(value.values[0]); const y1 = decimalPipe(value.values[1]); const time = +value.time; diff --git a/angular-client/src/components/acceleration-over-time-display/acceleration-over-time-display.component.ts b/angular-client/src/components/acceleration-over-time-display/acceleration-over-time-display.component.ts index a82c3645..f955df50 100644 --- a/angular-client/src/components/acceleration-over-time-display/acceleration-over-time-display.component.ts +++ b/angular-client/src/components/acceleration-over-time-display/acceleration-over-time-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { GraphData } from 'src/utils/types.utils'; @Component({ @@ -13,7 +13,7 @@ export default class AccelerationOverTimeDisplayComponent implements OnInit { data: GraphData[] = []; ngOnInit() { - this.storage.get(IdentifierDataType.ACCELERATION).subscribe((value) => { + this.storage.get(DataTypeEnum.ACCELERATION).subscribe((value) => { this.data.push({ x: new Date().getTime(), y: parseInt(value.values[0]) }); }); } diff --git a/angular-client/src/components/brake-pressure-display/brake-pressure-display.component.ts b/angular-client/src/components/brake-pressure-display/brake-pressure-display.component.ts index 9c9aff36..804a3762 100644 --- a/angular-client/src/components/brake-pressure-display/brake-pressure-display.component.ts +++ b/angular-client/src/components/brake-pressure-display/brake-pressure-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; @Component({ selector: 'brake-pressure-display', @@ -12,7 +12,7 @@ export default class BrakePressureDisplayComponent implements OnInit { brakePressure: number = 0; ngOnInit() { - this.storage.get(IdentifierDataType.BRAKE_PRESSURE).subscribe((value) => { + this.storage.get(DataTypeEnum.BRAKE_PRESSURE).subscribe((value) => { this.brakePressure = parseInt(value.values[0]); }); } diff --git a/angular-client/src/components/driver-component/driver-component.ts b/angular-client/src/components/driver-component/driver-component.ts index d07b7043..814a9380 100644 --- a/angular-client/src/components/driver-component/driver-component.ts +++ b/angular-client/src/components/driver-component/driver-component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; @Component({ selector: 'driver-component', @@ -12,7 +12,7 @@ export class DriverComponent implements OnInit { driver: string = 'No Driver'; ngOnInit() { - this.storage.get(IdentifierDataType.DRIVER).subscribe((value) => { + this.storage.get(DataTypeEnum.DRIVER).subscribe((value) => { [this.driver] = value.values || ['No Driver']; }); console.log(this.driver); diff --git a/angular-client/src/components/latency-display/latency-display.ts b/angular-client/src/components/latency-display/latency-display.ts index 756eba76..d031475a 100644 --- a/angular-client/src/components/latency-display/latency-display.ts +++ b/angular-client/src/components/latency-display/latency-display.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; @Component({ selector: 'latency-display', @@ -16,10 +16,10 @@ export default class LatencyDisplayComponent implements OnInit { newLatency: number = 0; ngOnInit(): void { - this.storage.get(IdentifierDataType.LATENCY).subscribe((value) => { + this.storage.get(DataTypeEnum.LATENCY).subscribe((value) => { this.latency = parseInt(value.values[0]); }); - this.storage.get(IdentifierDataType.NEW_LATENCY).subscribe((value) => { + this.storage.get(DataTypeEnum.NEW_LATENCY).subscribe((value) => { this.newLatency = parseInt(value.values[0]); }); } diff --git a/angular-client/src/components/motor-info/motor-info.component.ts b/angular-client/src/components/motor-info/motor-info.component.ts index 1dd28df8..57b619e3 100644 --- a/angular-client/src/components/motor-info/motor-info.component.ts +++ b/angular-client/src/components/motor-info/motor-info.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; // need access motor temp, motor consumption, and motor cooling @@ -19,13 +19,13 @@ export default class MotorInfoComponent implements OnInit { piechartData: { value: number; name: string }[] = []; ngOnInit() { - this.storage.get(IdentifierDataType.MOTOR_TEMP).subscribe((value) => { + this.storage.get(DataTypeEnum.MOTOR_TEMP).subscribe((value) => { this.motorTemp = floatPipe(value.values[0]); }); - this.storage.get(IdentifierDataType.MOTOR_USAGE).subscribe((value) => { + this.storage.get(DataTypeEnum.MOTOR_USAGE).subscribe((value) => { this.motorUsage = floatPipe(value.values[0]); }); - this.storage.get(IdentifierDataType.COOL_USAGE).subscribe((value) => { + this.storage.get(DataTypeEnum.COOL_USAGE).subscribe((value) => { this.coolUsage = floatPipe(value.values[0]); }); this.piechartData = [ diff --git a/angular-client/src/components/raspberry-pi/raspberry-pi.component.ts b/angular-client/src/components/raspberry-pi/raspberry-pi.component.ts index a8c76663..d94063ea 100644 --- a/angular-client/src/components/raspberry-pi/raspberry-pi.component.ts +++ b/angular-client/src/components/raspberry-pi/raspberry-pi.component.ts @@ -1,6 +1,6 @@ import { Component, HostListener, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; @Component({ @@ -20,19 +20,19 @@ export default class RasberryPiComponent implements OnInit { isMobile = window.innerWidth < this.mobileThreshold; ngOnInit() { - this.storage.get(IdentifierDataType.CPUUsage).subscribe((value) => { + this.storage.get(DataTypeEnum.CPUUsage).subscribe((value) => { this.cpuUsage = floatPipe(value.values[0]); }); - this.storage.get(IdentifierDataType.CPUTemp).subscribe((value) => { + this.storage.get(DataTypeEnum.CPUTemp).subscribe((value) => { this.cpuTemp = floatPipe(value.values[0]); }); - this.storage.get(IdentifierDataType.RAMUsage).subscribe((value) => { + this.storage.get(DataTypeEnum.RAMUsage).subscribe((value) => { this.ramUsage = Math.round((1 - floatPipe(value.values[0]) / 8000) * 100); }); - this.storage.get(IdentifierDataType.WIFIRSSI).subscribe((value) => { + this.storage.get(DataTypeEnum.WIFIRSSI).subscribe((value) => { this.wifiRSSI = floatPipe(value.values[0]); }); - this.storage.get(IdentifierDataType.MCS).subscribe((value) => { + this.storage.get(DataTypeEnum.MCS).subscribe((value) => { this.mcs = floatPipe(value.values[0]); }); } diff --git a/angular-client/src/components/speed-display/speed-display.component.ts b/angular-client/src/components/speed-display/speed-display.component.ts index b136f8e8..755628e4 100644 --- a/angular-client/src/components/speed-display/speed-display.component.ts +++ b/angular-client/src/components/speed-display/speed-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; @Component({ selector: 'speed-display', @@ -12,7 +12,7 @@ export default class SpeedDisplayComponent implements OnInit { speed: number = 0; ngOnInit() { - this.storage.get(IdentifierDataType.SPEED).subscribe((value) => { + this.storage.get(DataTypeEnum.SPEED).subscribe((value) => { this.speed = parseInt(value.values[0]); }); } diff --git a/angular-client/src/components/speed-over-time-display/speed-over-time-display.component.ts b/angular-client/src/components/speed-over-time-display/speed-over-time-display.component.ts index 0f48215e..81544538 100644 --- a/angular-client/src/components/speed-over-time-display/speed-over-time-display.component.ts +++ b/angular-client/src/components/speed-over-time-display/speed-over-time-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { GraphData } from 'src/utils/types.utils'; @Component({ @@ -13,7 +13,7 @@ export default class SpeedOverTimeDisplayComponent implements OnInit { data: GraphData[] = []; ngOnInit() { - this.storage.get(IdentifierDataType.SPEED).subscribe((value) => { + this.storage.get(DataTypeEnum.SPEED).subscribe((value) => { this.data.push({ x: new Date().getTime(), y: parseInt(value.values[0]) }); }); } diff --git a/angular-client/src/components/steering-angle-display/steering-angle-display.component.ts b/angular-client/src/components/steering-angle-display/steering-angle-display.component.ts index 5610bb97..bedcc670 100644 --- a/angular-client/src/components/steering-angle-display/steering-angle-display.component.ts +++ b/angular-client/src/components/steering-angle-display/steering-angle-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; /** @@ -18,7 +18,7 @@ export class SteeringAngleDisplayComponent implements OnInit { steeringAngle: number = 0; ngOnInit() { - this.storage.get(IdentifierDataType.STEERING_ANGLE).subscribe((value) => { + this.storage.get(DataTypeEnum.STEERING_ANGLE).subscribe((value) => { this.steeringAngle = floatPipe(value.values[0]); }); } diff --git a/angular-client/src/components/torque-display/torque-display.component.ts b/angular-client/src/components/torque-display/torque-display.component.ts index 1be66909..e49d1c91 100644 --- a/angular-client/src/components/torque-display/torque-display.component.ts +++ b/angular-client/src/components/torque-display/torque-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; @Component({ selector: 'torque-display', @@ -12,7 +12,7 @@ export default class TorqueDisplayComponent implements OnInit { torque: number = 0; ngOnInit() { - this.storage.get(IdentifierDataType.TORQUE).subscribe((value) => { + this.storage.get(DataTypeEnum.TORQUE).subscribe((value) => { this.torque = parseInt(value.values[0]); }); } diff --git a/angular-client/src/components/typography/typography.component.ts b/angular-client/src/components/typography/typography.component.ts index 81e19524..9466e4af 100644 --- a/angular-client/src/components/typography/typography.component.ts +++ b/angular-client/src/components/typography/typography.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import Theme from 'src/services/theme.service'; -import { StyleVariant } from 'src/utils/enumerations/style-variant'; +import { StyleVariant } from 'src/utils/style-variant'; /** * Custom typography component that allows for the use of different styles of text. diff --git a/angular-client/src/utils/enumerations/identifier-data-type.ts b/angular-client/src/data-type.enum.ts similarity index 98% rename from angular-client/src/utils/enumerations/identifier-data-type.ts rename to angular-client/src/data-type.enum.ts index 1e672b80..bf640058 100644 --- a/angular-client/src/utils/enumerations/identifier-data-type.ts +++ b/angular-client/src/data-type.enum.ts @@ -1,4 +1,4 @@ -export enum IdentifierDataType { +export enum DataTypeEnum { DRIVER = 'Driver', LOCATION = 'location', POINTS = 'GPS/Location', diff --git a/angular-client/src/pages/charging-page/charging-page-mobile/charging-page-mobile.component.ts b/angular-client/src/pages/charging-page/charging-page-mobile/charging-page-mobile.component.ts index d736e3fd..cf89606e 100644 --- a/angular-client/src/pages/charging-page/charging-page-mobile/charging-page-mobile.component.ts +++ b/angular-client/src/pages/charging-page/charging-page-mobile/charging-page-mobile.component.ts @@ -1,6 +1,6 @@ import { Component, HostListener, Input, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; @Component({ selector: 'charging-page-mobile', @@ -19,7 +19,7 @@ export default class ChargingPageMobileComponent implements OnInit { this.time = new Date(); }, 1000); - this.storage.get(IdentifierDataType.LOCATION).subscribe((value) => { + this.storage.get(DataTypeEnum.LOCATION).subscribe((value) => { [this.location] = value.values || ['No Location Set']; }); } diff --git a/angular-client/src/pages/charging-page/charging-page.component.ts b/angular-client/src/pages/charging-page/charging-page.component.ts index 42c8dfdd..c80ee5cc 100644 --- a/angular-client/src/pages/charging-page/charging-page.component.ts +++ b/angular-client/src/pages/charging-page/charging-page.component.ts @@ -1,6 +1,6 @@ import { Component, HostListener, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; /** * Container for the Charging page, obtains data from the storage service. @@ -22,7 +22,7 @@ export default class ChargingPageComponent implements OnInit { this.time = new Date(); }, 1000); - this.storage.get(IdentifierDataType.LOCATION).subscribe((value) => { + this.storage.get(DataTypeEnum.LOCATION).subscribe((value) => { [this.location] = value.values || ['No Location Set']; }); } diff --git a/angular-client/src/pages/charging-page/components/BMS-mode/BMS-mode-display.component.ts b/angular-client/src/pages/charging-page/components/BMS-mode/BMS-mode-display.component.ts index 143ad10a..74fa6294 100644 --- a/angular-client/src/pages/charging-page/components/BMS-mode/BMS-mode-display.component.ts +++ b/angular-client/src/pages/charging-page/components/BMS-mode/BMS-mode-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; enum BMSMODE { @@ -28,7 +28,7 @@ export default class BMSModeDisplayComponent implements OnInit { }; ngOnInit() { - this.storage.get(IdentifierDataType.BMS_MODE).subscribe((value) => { + this.storage.get(DataTypeEnum.BMS_MODE).subscribe((value) => { this.bmsMode = floatPipe(value.values[0]) as BMSMODE; }); } diff --git a/angular-client/src/pages/charging-page/components/active-status/active-status.component.ts b/angular-client/src/pages/charging-page/components/active-status/active-status.component.ts index 3772d815..9d623797 100644 --- a/angular-client/src/pages/charging-page/components/active-status/active-status.component.ts +++ b/angular-client/src/pages/charging-page/components/active-status/active-status.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; import Theme from 'src/services/theme.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; @Component({ @@ -17,7 +17,7 @@ export default class ActiveStatusComponent implements OnInit { intervalId!: NodeJS.Timeout; ngOnInit() { - this.storage.get(IdentifierDataType.BMS_MODE).subscribe((value) => { + this.storage.get(DataTypeEnum.BMS_MODE).subscribe((value) => { const statusStateValue = floatPipe(value.values[0]); if (this.isActive) { if (!(statusStateValue === 2)) { diff --git a/angular-client/src/pages/charging-page/components/balancing-status/balancing-status.component.ts b/angular-client/src/pages/charging-page/components/balancing-status/balancing-status.component.ts index a4d02775..93b38868 100644 --- a/angular-client/src/pages/charging-page/components/balancing-status/balancing-status.component.ts +++ b/angular-client/src/pages/charging-page/components/balancing-status/balancing-status.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; import Theme from 'src/services/theme.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; @Component({ @@ -17,7 +17,7 @@ export default class BalancingStatusComponent implements OnInit { intervalId!: NodeJS.Timeout; ngOnInit() { - this.storage.get(IdentifierDataType.STATUS_BALANCING).subscribe((value) => { + this.storage.get(DataTypeEnum.STATUS_BALANCING).subscribe((value) => { const statusBalancingValue = floatPipe(value.values[0]); if (this.isBalancing) { if (!(statusBalancingValue === 1)) { diff --git a/angular-client/src/pages/charging-page/components/battery-current/current-display/current-display.component.ts b/angular-client/src/pages/charging-page/components/battery-current/current-display/current-display.component.ts index 0b6437ed..059c0bf1 100644 --- a/angular-client/src/pages/charging-page/components/battery-current/current-display/current-display.component.ts +++ b/angular-client/src/pages/charging-page/components/battery-current/current-display/current-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; @Component({ @@ -13,7 +13,7 @@ export default class CurrentDisplayComponent implements OnInit { amps: number = 0; ngOnInit() { - this.storage.get(IdentifierDataType.CURRENT).subscribe((value) => { + this.storage.get(DataTypeEnum.CURRENT).subscribe((value) => { this.amps = floatPipe(value.values[0]); }); } diff --git a/angular-client/src/pages/charging-page/components/battery-info-display/battery-info-display.ts b/angular-client/src/pages/charging-page/components/battery-info-display/battery-info-display.ts index ef54491e..e29a0aef 100644 --- a/angular-client/src/pages/charging-page/components/battery-info-display/battery-info-display.ts +++ b/angular-client/src/pages/charging-page/components/battery-info-display/battery-info-display.ts @@ -1,5 +1,5 @@ import { Component, HostListener, OnInit, inject } from '@angular/core'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; import Storage from 'src/services/storage.service'; @@ -19,19 +19,19 @@ export class BatteryInfoDisplayComponent implements OnInit { isMobile = window.innerWidth < this.mobileThreshold; ngOnInit() { - this.storage.get(IdentifierDataType.PACK_TEMP).subscribe((value) => { + this.storage.get(DataTypeEnum.PACK_TEMP).subscribe((value) => { this.packTemp = floatPipe(value.values[0]); }); - this.storage.get(IdentifierDataType.PACK_VOLTAGE).subscribe((value) => { + this.storage.get(DataTypeEnum.PACK_VOLTAGE).subscribe((value) => { this.voltage = floatPipe(value.values[0]); }); - this.storage.get(IdentifierDataType.STATE_OF_CHARGE).subscribe((value) => { + this.storage.get(DataTypeEnum.STATE_OF_CHARGE).subscribe((value) => { this.stateOfCharge = floatPipe(value.values[0]); }); - this.storage.get(IdentifierDataType.CHARGE_CURRENT_LIMIT).subscribe((value) => { + this.storage.get(DataTypeEnum.CHARGE_CURRENT_LIMIT).subscribe((value) => { this.chargeCurrentLimit = floatPipe(value.values[0]); }); - this.storage.get(IdentifierDataType.DISCHARGE_CURRENT_LIMIT).subscribe((value) => { + this.storage.get(DataTypeEnum.DISCHARGE_CURRENT_LIMIT).subscribe((value) => { this.dischargeCurrentLimit = floatPipe(value.values[0]); }); } diff --git a/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.ts b/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.ts index e28a31ca..06ca9484 100644 --- a/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.ts +++ b/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.ts @@ -1,6 +1,6 @@ import { Component, HostListener, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; import { GraphData } from 'src/utils/types.utils'; @@ -29,11 +29,11 @@ export default class CellTempDisplayComponent implements OnInit { } ngOnInit() { - this.storage.get(IdentifierDataType.CELL_TEMP_HIGH).subscribe((value) => { + this.storage.get(DataTypeEnum.CELL_TEMP_HIGH).subscribe((value) => { this.maxTemp = floatPipe(value.values[0]); this.cellTempData.push({ x: +value.time, y: this.maxTemp }); }); - this.storage.get(IdentifierDataType.CELL_TEMP_AVG).subscribe((value) => { + this.storage.get(DataTypeEnum.CELL_TEMP_AVG).subscribe((value) => { this.avgTemp = floatPipe(value.values[0]); }); } diff --git a/angular-client/src/pages/charging-page/components/charging-state/charging-status.component.ts b/angular-client/src/pages/charging-page/components/charging-state/charging-status.component.ts index ca795e9e..9e7dc6ae 100644 --- a/angular-client/src/pages/charging-page/components/charging-state/charging-status.component.ts +++ b/angular-client/src/pages/charging-page/components/charging-state/charging-status.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; import Theme from 'src/services/theme.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; @Component({ @@ -17,7 +17,7 @@ export default class ChargingStatusComponent implements OnInit { intervalId!: NodeJS.Timeout; ngOnInit() { - this.storage.get(IdentifierDataType.CHARGING).subscribe((value) => { + this.storage.get(DataTypeEnum.CHARGING).subscribe((value) => { const chargingControlValue = floatPipe(value.values[0]); if (this.isCharging) { if (chargingControlValue === 1) { diff --git a/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.ts b/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.ts index 0b39c2ae..41c37eba 100644 --- a/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.ts +++ b/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; enum FaultType { BMS = 'BMS', @@ -27,23 +27,23 @@ export default class FaultDisplayComponent implements OnInit { const chargerFaultAndDisplayNames = [ { displayName: 'Comm Timeout', - faultIdentifier: IdentifierDataType.COMM_TIMEOUT_FAULT + faultIdentifier: DataTypeEnum.COMM_TIMEOUT_FAULT }, { displayName: 'Hardware Failure', - faultIdentifier: IdentifierDataType.HARDWARE_FAILURE_FAULT + faultIdentifier: DataTypeEnum.HARDWARE_FAILURE_FAULT }, { displayName: 'Over Temp', - faultIdentifier: IdentifierDataType.OVER_TEMP_FAULT + faultIdentifier: DataTypeEnum.OVER_TEMP_FAULT }, { displayName: 'Over Voltage Fault', - faultIdentifier: IdentifierDataType.OVER_VOLTAGE_FAULT + faultIdentifier: DataTypeEnum.OVER_VOLTAGE_FAULT }, { displayName: 'Wrong Battery Connect', - faultIdentifier: IdentifierDataType.WRONG_BAT_CONNECT_FAULT + faultIdentifier: DataTypeEnum.WRONG_BAT_CONNECT_FAULT } ]; // Subscribe to each charger fault, with a display name (to display when the fault is triggered) @@ -54,71 +54,71 @@ export default class FaultDisplayComponent implements OnInit { const bmsFaultAndDisplayNames = [ { displayName: 'Open Wire', - faultIdentifier: IdentifierDataType.OPEN_WIRE + faultIdentifier: DataTypeEnum.OPEN_WIRE }, { displayName: 'Charger Limit Enforcement', - faultIdentifier: IdentifierDataType.CHARGER_LIMIT_ENFORCEMENT_FAULT + faultIdentifier: DataTypeEnum.CHARGER_LIMIT_ENFORCEMENT_FAULT }, { displayName: 'Charger Can Fault', - faultIdentifier: IdentifierDataType.CHARGER_CAN_FAULT + faultIdentifier: DataTypeEnum.CHARGER_CAN_FAULT }, { displayName: 'Battery Thermistor', - faultIdentifier: IdentifierDataType.BATTERY_THERMISTOR + faultIdentifier: DataTypeEnum.BATTERY_THERMISTOR }, { displayName: 'Charger Safety Relay', - faultIdentifier: IdentifierDataType.CHARGER_SAFETY_RELAY + faultIdentifier: DataTypeEnum.CHARGER_SAFETY_RELAY }, { displayName: 'Discharge Limit Enforcement', - faultIdentifier: IdentifierDataType.DISCHARGE_LIMIT_ENFORCEMENT_FAULT + faultIdentifier: DataTypeEnum.DISCHARGE_LIMIT_ENFORCEMENT_FAULT }, { displayName: 'External Can Fault', - faultIdentifier: IdentifierDataType.EXTERNAL_CAN_FAULT + faultIdentifier: DataTypeEnum.EXTERNAL_CAN_FAULT }, { displayName: 'Weak Pack Fault', - faultIdentifier: IdentifierDataType.WEAK_PACK_FAULT + faultIdentifier: DataTypeEnum.WEAK_PACK_FAULT }, { displayName: 'Low Cell Voltage', - faultIdentifier: IdentifierDataType.LOW_CELL_VOLTAGE + faultIdentifier: DataTypeEnum.LOW_CELL_VOLTAGE }, { displayName: 'Charge Reading Mismatch', - faultIdentifier: IdentifierDataType.CHARGE_READING_MISMATCH + faultIdentifier: DataTypeEnum.CHARGE_READING_MISMATCH }, { displayName: 'Current Sensor Fault', - faultIdentifier: IdentifierDataType.CURRENT_SENSOR_FAULT + faultIdentifier: DataTypeEnum.CURRENT_SENSOR_FAULT }, { displayName: 'Internal Cell Comm Fault', - faultIdentifier: IdentifierDataType.INTERNAL_CELL_COMM_FAULT + faultIdentifier: DataTypeEnum.INTERNAL_CELL_COMM_FAULT }, { displayName: 'Internal Software Fault', - faultIdentifier: IdentifierDataType.INTERNAL_SOFTWARE_FAULT + faultIdentifier: DataTypeEnum.INTERNAL_SOFTWARE_FAULT }, { displayName: 'Pack Overheat', - faultIdentifier: IdentifierDataType.PACK_OVERHEAT + faultIdentifier: DataTypeEnum.PACK_OVERHEAT }, { displayName: 'Cell Undervoltage', - faultIdentifier: IdentifierDataType.CELL_UNDERVOLTAGE + faultIdentifier: DataTypeEnum.CELL_UNDERVOLTAGE }, { displayName: 'Cell Overvoltage', - faultIdentifier: IdentifierDataType.CELL_OVERVOLTAGE + faultIdentifier: DataTypeEnum.CELL_OVERVOLTAGE }, { displayName: 'Cells Not Balancing', - faultIdentifier: IdentifierDataType.CELLS_NOT_BALANCING + faultIdentifier: DataTypeEnum.CELLS_NOT_BALANCING } ]; @@ -136,7 +136,7 @@ export default class FaultDisplayComponent implements OnInit { * @param faultIdentifier the identifier for the fault. * @param faultType the type of the fault. */ - private faultSubcribe(displayName: string, faultIdentifier: IdentifierDataType, faultType: FaultType) { + private faultSubcribe(displayName: string, faultIdentifier: DataTypeEnum, faultType: FaultType) { let lastFaultValue = 0; this.storage.get(faultIdentifier).subscribe((value) => { const newValue = parseInt(value.values[0]); diff --git a/angular-client/src/pages/charging-page/components/faulted-status/faulted-status.component.ts b/angular-client/src/pages/charging-page/components/faulted-status/faulted-status.component.ts index f6fb5224..afc8ffc3 100644 --- a/angular-client/src/pages/charging-page/components/faulted-status/faulted-status.component.ts +++ b/angular-client/src/pages/charging-page/components/faulted-status/faulted-status.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; import Theme from 'src/services/theme.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; @Component({ @@ -17,7 +17,7 @@ export default class FaultedStatusComponent implements OnInit { intervalId!: NodeJS.Timeout; ngOnInit() { - this.storage.get(IdentifierDataType.BMS_MODE).subscribe((value) => { + this.storage.get(DataTypeEnum.BMS_MODE).subscribe((value) => { const statusStateValue = floatPipe(value.values[0]); if (this.isFaulted) { if (!(statusStateValue === 3)) { diff --git a/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-display/high-low-cell-display.component.ts b/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-display/high-low-cell-display.component.ts index 278a5520..3448f107 100644 --- a/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-display/high-low-cell-display.component.ts +++ b/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-display/high-low-cell-display.component.ts @@ -1,6 +1,6 @@ import { Component, HostListener, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { decimalPipe } from 'src/utils/pipes.utils'; import { GraphData } from 'src/utils/types.utils'; @@ -32,12 +32,12 @@ export default class HighLowCellDisplayComponent implements OnInit { } ngOnInit() { - this.storage.get(IdentifierDataType.VOLTS_LOW).subscribe((value) => { + this.storage.get(DataTypeEnum.VOLTS_LOW).subscribe((value) => { this.lowCellVoltage = decimalPipe(value.values[0], 3); this.delta = decimalPipe((this.highCellVoltage - this.lowCellVoltage).toFixed(3), 3); this.lowVoltsData.push({ x: +value.time, y: this.lowCellVoltage }); }); - this.storage.get(IdentifierDataType.VOLTS_HIGH).subscribe((value) => { + this.storage.get(DataTypeEnum.VOLTS_HIGH).subscribe((value) => { this.highCellVoltage = decimalPipe(value.values[0], 3); this.delta = decimalPipe((this.highCellVoltage - this.lowCellVoltage).toFixed(3), 3); this.highVoltsData.push({ x: +value.time, y: this.highCellVoltage }); diff --git a/angular-client/src/pages/charging-page/components/pack-temp/pack-temp.component.ts b/angular-client/src/pages/charging-page/components/pack-temp/pack-temp.component.ts index 9b2abefe..8797e811 100644 --- a/angular-client/src/pages/charging-page/components/pack-temp/pack-temp.component.ts +++ b/angular-client/src/pages/charging-page/components/pack-temp/pack-temp.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; @Component({ @@ -13,7 +13,7 @@ export default class PackTempComponent implements OnInit { packTemp: number = 0; ngOnInit() { - this.storage.get(IdentifierDataType.PACK_TEMP).subscribe((value) => { + this.storage.get(DataTypeEnum.PACK_TEMP).subscribe((value) => { this.packTemp = floatPipe(value.values[0]); }); } diff --git a/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.ts b/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.ts index 0a818313..93329f5a 100644 --- a/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.ts +++ b/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.ts @@ -1,6 +1,6 @@ import { Component, HostListener, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; import { GraphData } from 'src/utils/types.utils'; @@ -28,7 +28,7 @@ export default class PackVoltageDisplayComponent implements OnInit { } ngOnInit() { - this.storage.get(IdentifierDataType.PACK_VOLTAGE).subscribe((value) => { + this.storage.get(DataTypeEnum.PACK_VOLTAGE).subscribe((value) => { this.voltage = floatPipe(value.values[0]); this.packVoltData.push({ x: +value.time, y: this.voltage }); }); diff --git a/angular-client/src/pages/charging-page/components/starting-soc/starting-soc-timer.component.ts b/angular-client/src/pages/charging-page/components/starting-soc/starting-soc-timer.component.ts index 8356f8b4..db9421c6 100644 --- a/angular-client/src/pages/charging-page/components/starting-soc/starting-soc-timer.component.ts +++ b/angular-client/src/pages/charging-page/components/starting-soc/starting-soc-timer.component.ts @@ -1,7 +1,7 @@ import { Component, inject } from '@angular/core'; import { take } from 'rxjs'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; @Component({ @@ -14,7 +14,7 @@ export default class StartingSocTimerComponent { startingSoc: number = 0; constructor() { this.storage - .get(IdentifierDataType.STATE_OF_CHARGE) + .get(DataTypeEnum.STATE_OF_CHARGE) .pipe(take(1)) .subscribe((value) => { this.startingSoc = floatPipe(value.values[0]); diff --git a/angular-client/src/pages/charging-page/components/state-of-charge/state-of-charge-display/state-of-charge-display.component.ts b/angular-client/src/pages/charging-page/components/state-of-charge/state-of-charge-display/state-of-charge-display.component.ts index 29a0a5cc..f3c33c5b 100644 --- a/angular-client/src/pages/charging-page/components/state-of-charge/state-of-charge-display/state-of-charge-display.component.ts +++ b/angular-client/src/pages/charging-page/components/state-of-charge/state-of-charge-display/state-of-charge-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import { floatPipe } from 'src/utils/pipes.utils'; @Component({ @@ -13,7 +13,7 @@ export default class StateOfChargeDisplayComponent implements OnInit { stateOfCharge: number = 0; ngOnInit() { - this.storage.get(IdentifierDataType.STATE_OF_CHARGE).subscribe((value) => { + this.storage.get(DataTypeEnum.STATE_OF_CHARGE).subscribe((value) => { this.stateOfCharge = floatPipe(value.values[0]); }); } diff --git a/angular-client/src/pages/landing-page/components/date-location-display/date-location.component.ts b/angular-client/src/pages/landing-page/components/date-location-display/date-location.component.ts index 16b01ab5..6a419a0e 100644 --- a/angular-client/src/pages/landing-page/components/date-location-display/date-location.component.ts +++ b/angular-client/src/pages/landing-page/components/date-location-display/date-location.component.ts @@ -1,6 +1,6 @@ import { Component, HostListener, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; @Component({ selector: 'date-location', @@ -19,7 +19,7 @@ export class DateLocationComponent implements OnInit { this.time = new Date(); }, 1000); - this.storage.get(IdentifierDataType.LOCATION).subscribe((value) => { + this.storage.get(DataTypeEnum.LOCATION).subscribe((value) => { [this.location] = value.values || ['No Location Set']; }); } diff --git a/angular-client/src/pages/landing-page/components/viewer-display/viewer-display.component.ts b/angular-client/src/pages/landing-page/components/viewer-display/viewer-display.component.ts index 08d07eba..5adf16be 100644 --- a/angular-client/src/pages/landing-page/components/viewer-display/viewer-display.component.ts +++ b/angular-client/src/pages/landing-page/components/viewer-display/viewer-display.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, inject } from '@angular/core'; import Storage from 'src/services/storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; @Component({ selector: 'viewer-display', @@ -12,7 +12,7 @@ export class ViewerDisplayComponent implements OnInit { numViewers: number = 0; ngOnInit() { - this.storage.get(IdentifierDataType.VIEWERS).subscribe((value) => { + this.storage.get(DataTypeEnum.VIEWERS).subscribe((value) => { this.numViewers = parseInt(value.values[0]); }); } diff --git a/angular-client/src/pages/map/map.component.ts b/angular-client/src/pages/map/map.component.ts index 4dd047c0..4e60beef 100644 --- a/angular-client/src/pages/map/map.component.ts +++ b/angular-client/src/pages/map/map.component.ts @@ -3,7 +3,7 @@ import { MapService } from '../../services/map.service'; import { DataValue } from 'src/utils/socket.utils'; import APIService from 'src/services/api.service'; import { getDataByDataTypeNameAndRunId } from 'src/api/data.api'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; import Storage from 'src/services/storage.service'; import { Run } from 'src/utils/types.utils'; @@ -33,14 +33,14 @@ export default class MapComponent implements OnInit { setTimeout(() => { this.map.buildMap('map'); this.map.addPolyline([]); - this.storage.get(IdentifierDataType.POINTS).subscribe((value) => { + this.storage.get(DataTypeEnum.POINTS).subscribe((value) => { this.map.addCoordinateToPolyline(this.map.transformDataToCoordinate(value)); }); }, 100); } else { this.isLoading = true; const queryResponse = this.apiService.query(() => - getDataByDataTypeNameAndRunId(IdentifierDataType.POINTS, run.id) + getDataByDataTypeNameAndRunId(DataTypeEnum.POINTS, run.id) ); queryResponse.data.subscribe((points) => { this.isLoading = false; diff --git a/angular-client/src/services/socket.service.ts b/angular-client/src/services/socket.service.ts index 871dd3b9..5fccdfe3 100644 --- a/angular-client/src/services/socket.service.ts +++ b/angular-client/src/services/socket.service.ts @@ -1,7 +1,7 @@ import { Socket } from 'socket.io-client'; import { DataValue, ServerData } from 'src/utils/socket.utils'; import Storage from './storage.service'; -import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; +import { DataTypeEnum } from 'src/data-type.enum'; /** * Service for interacting with the socket @@ -35,7 +35,7 @@ export default class SocketService { storage.addValue(key, newValue); if (Date.now() - this.lastLatencyTimestamp > 1000) { const latency = Date.now() - data.timestamp; - storage.addValue(IdentifierDataType.LATENCY, { + storage.addValue(DataTypeEnum.LATENCY, { values: [latency.toString()], time: data.timestamp.toString(), unit: 'ms' diff --git a/angular-client/src/utils/enumerations/style-variant.ts b/angular-client/src/utils/style-variant.ts similarity index 100% rename from angular-client/src/utils/enumerations/style-variant.ts rename to angular-client/src/utils/style-variant.ts