From d6eee040cdd2de1ade326c61c54ac3b0e7338ea3 Mon Sep 17 00:00:00 2001 From: RChandler234 <29521172+RChandler234@users.noreply.github.com> Date: Fri, 20 Dec 2024 17:40:32 -0600 Subject: [PATCH 1/5] #260 - dataTypes converted to nodes on graph page to get support old functionality --- angular-client/src/api/node.api.ts | 4 +-- angular-client/src/api/urls.ts | 6 ++-- .../graph-page/graph-page.component.html | 10 +++--- .../pages/graph-page/graph-page.component.ts | 29 ++++++++--------- .../graph-sidebar-desktop.component.html | 2 +- .../graph-sidebar-desktop.component.ts | 10 +++++- .../graph-sidebar-mobile.component.html | 2 +- .../graph-sidebar-mobile.component.ts | 9 +++++- .../graph-sidebar.component.html | 4 +-- .../graph-sidebar/graph-sidebar.component.ts | 4 +-- angular-client/src/utils/dataTypes.utils.ts | 31 +++++++++++++++++++ 11 files changed, 79 insertions(+), 32 deletions(-) create mode 100644 angular-client/src/utils/dataTypes.utils.ts diff --git a/angular-client/src/api/node.api.ts b/angular-client/src/api/node.api.ts index 7a12bf6d..c3dfde72 100644 --- a/angular-client/src/api/node.api.ts +++ b/angular-client/src/api/node.api.ts @@ -4,6 +4,6 @@ import { urls } from './urls'; * Fetches all nodes from the server * @returns A promise containing the response from the server */ -export const getAllNodes = (): Promise => { - return fetch(urls.getAllNodes()); +export const getAllDatatypes = (): Promise => { + return fetch(urls.getAllDatatypes()); }; diff --git a/angular-client/src/api/urls.ts b/angular-client/src/api/urls.ts index d0839d79..8ffe3688 100644 --- a/angular-client/src/api/urls.ts +++ b/angular-client/src/api/urls.ts @@ -3,8 +3,8 @@ import { environment } from 'src/environment/environment'; // eslint-disable-next-line @typescript-eslint/no-explicit-any const baseURL = (environment as any).url || 'http://localhost:8000'; -/* Nodes */ -const getAllNodes = () => `${baseURL}/nodes`; +/* Datatypes */ +const getAllDatatypes = () => `${baseURL}/datatypes`; /* Systems */ const getAllSystems = () => `${baseURL}/systems`; @@ -18,7 +18,7 @@ const getAllRuns = () => `${baseURL}/runs`; const startNewRun = () => `${baseURL}/runs/new`; export const urls = { - getAllNodes, + getAllDatatypes, getAllSystems, diff --git a/angular-client/src/pages/graph-page/graph-page.component.html b/angular-client/src/pages/graph-page/graph-page.component.html index 0d08ca06..40ddedf6 100644 --- a/angular-client/src/pages/graph-page/graph-page.component.html +++ b/angular-client/src/pages/graph-page/graph-page.component.html @@ -1,9 +1,9 @@ -@if (nodesIsError) { +@if (dataTypesIsError) {
- +
} @else { - @if (!nodes || nodesIsLoading) { + @if (!dataTypes || dataTypesIsLoading) {
@@ -11,7 +11,7 @@
- +
(getAllNodes); - nodeQueryResponse.isLoading.subscribe((isLoading: boolean) => { - this.nodesIsLoading = isLoading; + const dataTypesQueryResponse = this.serverService.query(getAllDatatypes); + dataTypesQueryResponse.isLoading.subscribe((isLoading: boolean) => { + this.dataTypesIsLoading = isLoading; }); - nodeQueryResponse.error.subscribe((error: Error) => { - this.nodesIsError = true; - this.nodesError = error; + dataTypesQueryResponse.error.subscribe((error: Error) => { + this.dataTypesIsError = true; + this.dataTypesError = error; }); - nodeQueryResponse.data.subscribe((data: Node[]) => { - this.nodes = data; + dataTypesQueryResponse.data.subscribe((data: DataType[]) => { + console.log(data); + this.dataTypes = data; }); } diff --git a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.html b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.html index 03716a9e..865a0ac5 100644 --- a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.html +++ b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.html @@ -28,7 +28,7 @@
diff --git a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.ts b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.ts index 15ab20bc..64cf40ef 100644 --- a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.ts +++ b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-desktop/graph-sidebar-desktop.component.ts @@ -5,6 +5,8 @@ import Storage from 'src/services/storage.service'; import { decimalPipe } from 'src/utils/pipes.utils'; import { FormControl, FormGroup } from '@angular/forms'; import { debounceTime, Observable, of, Subscription } from 'rxjs'; +import { dataTypesToNodes } from 'src/utils/dataTypes.utils'; +import { dataTypeNamePipe } from 'src/utils/dataTypes.utils'; /** * Sidebar component that displays the nodes and their data types. @@ -48,9 +50,10 @@ import { debounceTime, Observable, of, Subscription } from 'rxjs'; }) export default class GraphSidebarDesktopComponent implements OnInit, OnDestroy { private storage = inject(Storage); - @Input() nodes!: Node[]; + @Input() dataTypes!: DataType[]; @Input() selectDataType!: (dataType: DataType) => void; nodesWithVisibilityToggle!: Observable; + nodes!: Node[]; filterForm: FormGroup = new FormGroup({ searchFilter: new FormControl('') @@ -64,6 +67,7 @@ export default class GraphSidebarDesktopComponent implements OnInit, OnDestroy { * Initializes the nodes with the visibility toggle. */ ngOnInit(): void { + this.nodes = dataTypesToNodes(this.dataTypes); this.nodesWithVisibilityToggle = of( this.nodes.map((node: Node) => { return { @@ -104,4 +108,8 @@ export default class GraphSidebarDesktopComponent implements OnInit, OnDestroy { toggleDataTypeVisibility(node: NodeWithVisibilityToggle) { node.dataTypesAreVisible = !node.dataTypesAreVisible; } + + transformDataTypeName(dataTypeName: string) { + return dataTypeNamePipe(dataTypeName); + } } diff --git a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.html b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.html index cd5ef34e..cf372b32 100644 --- a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.html +++ b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.html @@ -18,7 +18,7 @@ @if (node.dataTypesAreVisible) {
@for (dataType of node.dataTypes; track dataType) { - + }
} diff --git a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.ts b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.ts index 55cf12a6..1a087062 100644 --- a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.ts +++ b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar-mobile/graph-sidebar-mobile.component.ts @@ -1,5 +1,6 @@ import { animate, style, transition, trigger } from '@angular/animations'; import { Component, Input, OnInit } from '@angular/core'; +import { dataTypeNamePipe, dataTypesToNodes } from 'src/utils/dataTypes.utils'; import { DataType, Node, NodeWithVisibilityToggle, Run } from 'src/utils/types.utils'; @Component({ @@ -58,16 +59,18 @@ import { DataType, Node, NodeWithVisibilityToggle, Run } from 'src/utils/types.u ] }) export default class GraphSidebarMobileComponent implements OnInit { - @Input() nodes!: Node[]; + @Input() dataTypes!: DataType[]; @Input() selectDataType!: (dataType: DataType) => void; @Input() onRunSelected!: (run: Run) => void; nodesWithVisibilityToggle!: NodeWithVisibilityToggle[]; showSelection = false; + nodes!: Node[]; /** * Initializes the nodes with the visibility toggle. */ ngOnInit(): void { + this.nodes = dataTypesToNodes(this.dataTypes); this.nodesWithVisibilityToggle = this.nodes.map((node: Node) => { return { ...node, @@ -90,4 +93,8 @@ export default class GraphSidebarMobileComponent implements OnInit { toggleSidebar = () => { this.showSelection = !this.showSelection; }; + + transformDataTypeName(dataTypeName: string) { + return dataTypeNamePipe(dataTypeName); + } } diff --git a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar.component.html b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar.component.html index fd743f7b..acd18713 100644 --- a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar.component.html +++ b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar.component.html @@ -1,7 +1,7 @@ @if (isMobile) {
- +
} @else { - + } diff --git a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar.component.ts b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar.component.ts index d4eb6cd4..6b878712 100644 --- a/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar.component.ts +++ b/angular-client/src/pages/graph-page/graph-sidebar/graph-sidebar.component.ts @@ -1,5 +1,5 @@ import { Component, HostListener, Input, OnInit } from '@angular/core'; -import { DataType, Node, Run } from 'src/utils/types.utils'; +import { DataType, Run } from 'src/utils/types.utils'; /** * Sidebar component wrapper that determines to display mobile or desktop sidebar. @@ -12,7 +12,7 @@ import { DataType, Node, Run } from 'src/utils/types.utils'; styleUrls: ['./graph-sidebar.component.css'] }) export default class GraphSidebarComponent implements OnInit { - @Input() nodes!: Node[]; + @Input() dataTypes!: DataType[]; @Input() selectDataType!: (dataType: DataType) => void; @Input() onRunSelected!: (run: Run) => void; diff --git a/angular-client/src/utils/dataTypes.utils.ts b/angular-client/src/utils/dataTypes.utils.ts new file mode 100644 index 00000000..39676a9d --- /dev/null +++ b/angular-client/src/utils/dataTypes.utils.ts @@ -0,0 +1,31 @@ +import { DataType, Node } from './types.utils'; + +export const dataTypesToNodes = (dataTypes: DataType[]) => { + let addedDataType = false; + const nodes: Node[] = []; + dataTypes.forEach((dataType: DataType) => { + addedDataType = false; + nodes.forEach((node: Node) => { + if (node.name === getNodeNameFromDataType(dataType)) { + node.dataTypes.push(dataType); + addedDataType = true; + } + }); + if (!addedDataType) { + nodes.push({ name: getNodeNameFromDataType(dataType), dataTypes: [dataType] }); + } + }); + + return nodes; +}; + +export const getNodeNameFromDataType = (dataType: DataType) => { + return dataType.name.split('/')[0]; +}; + +export const dataTypeNamePipe = (dataTypeName: string) => { + const updatedNameArray = dataTypeName.split('/'); + updatedNameArray.shift(); + const updatedName = updatedNameArray.join('-'); + return updatedName; +}; From bb48fa30102205bc46f339b5b717aae76c56f76b Mon Sep 17 00:00:00 2001 From: RChandler234 <29521172+RChandler234@users.noreply.github.com> Date: Fri, 20 Dec 2024 19:02:02 -0600 Subject: [PATCH 2/5] #260 - update data type enum --- .../enumerations/identifier-data-type.ts | 111 ++++++++++-------- 1 file changed, 62 insertions(+), 49 deletions(-) diff --git a/angular-client/src/utils/enumerations/identifier-data-type.ts b/angular-client/src/utils/enumerations/identifier-data-type.ts index 97e3392b..1e672b80 100644 --- a/angular-client/src/utils/enumerations/identifier-data-type.ts +++ b/angular-client/src/utils/enumerations/identifier-data-type.ts @@ -1,61 +1,74 @@ export enum IdentifierDataType { DRIVER = 'Driver', LOCATION = 'location', - SYSTEM = 'system', - PACK_TEMP = 'Status/Temp_Average', - MOTOR_TEMP = 'Temps/Motor_Temperature', - MOTOR_USAGE = 'Motor Usage', - COOL_USAGE = 'Cooling Usage', - STATE_OF_CHARGE = 'Pack/SOC', POINTS = 'GPS/Location', + VIEWERS = 'Viewers', + + // Special Latency info sent by Scylla LATENCY = 'Old_Latency', NEW_LATENCY = 'Latency', + + //Fake Data Points + MOTOR_USAGE = 'Motor Usage', + COOL_USAGE = 'Cooling Usage', STEERING_ANGLE = 'Steering Angle', - CURRENT = 'Charging/Current', - // Charger Faults - COMM_TIMEOUT_FAULT = 'Box/F_CommTimeout', - HARDWARE_FAILURE_FAULT = 'Box/F_HardwareFailure', - OVER_TEMP_FAULT = 'Box/F_OverTemp', - OVER_VOLTAGE_FAULT = 'Box/F_OverVoltage', - WRONG_BAT_CONNECT_FAULT = 'Box/F_WrongBatConnect', - // BMS Faults - OPEN_WIRE = 'Status/F/Open_Wire', - CHARGER_LIMIT_ENFORCEMENT_FAULT = 'Status/F/CCL_Enforce', - CHARGER_CAN_FAULT = 'Status/F/Charger_Can', - BATTERY_THERMISTOR = 'Status/F/Battery_Therm', - CHARGER_SAFETY_RELAY = 'Status/F/Charger_Safety', - DISCHARGE_LIMIT_ENFORCEMENT_FAULT = 'Status/F/DCL_Enforce', - EXTERNAL_CAN_FAULT = 'Status/F/External_Can', - WEAK_PACK_FAULT = 'Status/F/Weak_Pack', - LOW_CELL_VOLTAGE = 'Status/F/Low_Cell_Volts', - CHARGE_READING_MISMATCH = 'Status/F/Charge_Reading', - CURRENT_SENSOR_FAULT = 'Status/F/Current_Sense', - INTERNAL_CELL_COMM_FAULT = 'Status/F/IC_Comm', - INTERNAL_THERMAL_ERROR = 'Status/F/Thermal_Err', - INTERNAL_SOFTWARE_FAULT = 'Status/F/Software', - PACK_OVERHEAT = 'Status/F/Pack_Overheat', - CELL_UNDERVOLTAGE = 'Status/F/Cell_Undervoltage', - CELL_OVERVOLTAGE = 'Status/F/Cell_Overvoltage', - CELLS_NOT_BALANCING = 'Status/F/Cells_Not_Balancing', - VIEWERS = 'Viewers', - SPEED = 'State/Speed', TORQUE = 'Torque', BRAKE_PRESSURE = 'Brake Pressure', - CPUUsage = 'OnBoard/CpuUsage', - CPUTemp = 'OnBoard/CpuTemp', - RAMUsage = 'OnBoard/MemAvailable', - WIFIRSSI = 'HaLow/RSSI', - MCS = 'HaLow/ApMCS', ACCELERATION = 'Acceleration', - CHARGE_CURRENT_LIMIT = 'Pack/CCL', - DISCHARGE_CURRENT_LIMIT = 'Pack/DCL', XYZAccel = 'XYZAcceleration', - STATUS_BALANCING = 'Status/Balancing', - BMS_MODE = 'Status/State', - VOLTS_HIGH = 'Cells/Volts_High_Value', - VOLTS_LOW = 'Cells/Volts_Low_Value', - CHARGING = 'Charging/Control', - PACK_VOLTAGE = 'Pack/Voltage', - CELL_TEMP_HIGH = 'Cells/Temp_High_Value', - CELL_TEMP_AVG = 'Cells/Temp_Avg_Value' + + // MPU + SPEED = 'MPU/State/Speed', + + // DTI + MOTOR_TEMP = 'DTI/Temps/Motor_Temperature', + + // TPU + CPUUsage = 'TPU/OnBoard/CpuUsage', + CPUTemp = 'TPU/OnBoard/CpuTemp', + RAMUsage = 'TPU/OnBoard/MemAvailable', + WIFIRSSI = 'TPU/HaLow/RSSI', + MCS = 'TPU/HaLow/ApMCS', + + // BMS + PACK_TEMP = 'BMS/Status/Temp_Average', + STATE_OF_CHARGE = 'BMS/Pack/SOC', + CURRENT = 'BMS/Charging/Current', + CHARGE_CURRENT_LIMIT = 'BMS/Pack/CCL', + DISCHARGE_CURRENT_LIMIT = 'BMS/Pack/DCL', + STATUS_BALANCING = 'BMS/Status/Balancing', + BMS_MODE = 'BMS/Status/State', + VOLTS_HIGH = 'BMS/Cells/Volts_High_Value', + VOLTS_LOW = 'BMS/Cells/Volts_Low_Value', + CHARGING = 'BMS/Charging/Control', + PACK_VOLTAGE = 'BMS/Pack/Voltage', + CELL_TEMP_HIGH = 'BMS/Cells/Temp_High_Value', + CELL_TEMP_AVG = 'BMS/Cells/Temp_Avg_Value', + + // Charger Faults + COMM_TIMEOUT_FAULT = 'Charger/Box/F_CommTimeout', + HARDWARE_FAILURE_FAULT = 'Charger/Box/F_HardwareFailure', + OVER_TEMP_FAULT = 'Charger/Box/F_OverTemp', + OVER_VOLTAGE_FAULT = 'Charger/Box/F_OverVoltage', + WRONG_BAT_CONNECT_FAULT = 'Charger/Box/F_WrongBatConnect', + + // BMS Faults + OPEN_WIRE = 'BMS/Status/F/Open_Wire', + CHARGER_LIMIT_ENFORCEMENT_FAULT = 'BMS/Status/F/CCL_Enforce', + CHARGER_CAN_FAULT = 'BMS/Status/F/Charger_Can', + BATTERY_THERMISTOR = 'BMS/Status/F/Battery_Therm', + CHARGER_SAFETY_RELAY = 'BMS/Status/F/Charger_Safety', + DISCHARGE_LIMIT_ENFORCEMENT_FAULT = 'BMS/Status/F/DCL_Enforce', + EXTERNAL_CAN_FAULT = 'BMS/Status/F/External_Can', + WEAK_PACK_FAULT = 'BMS/Status/F/Weak_Pack', + LOW_CELL_VOLTAGE = 'BMS/Status/F/Low_Cell_Volts', + CHARGE_READING_MISMATCH = 'BMS/Status/F/Charge_Reading', + CURRENT_SENSOR_FAULT = 'BMS/Status/F/Current_Sense', + INTERNAL_CELL_COMM_FAULT = 'BMS/Status/F/IC_Comm', + INTERNAL_THERMAL_ERROR = 'BMS/Status/F/Thermal_Err', + INTERNAL_SOFTWARE_FAULT = 'BMS/Status/F/Software', + PACK_OVERHEAT = 'BMS/Status/F/Pack_Overheat', + CELL_UNDERVOLTAGE = 'BMS/Status/F/Cell_Undervoltage', + CELL_OVERVOLTAGE = 'BMS/Status/F/Cell_Overvoltage', + CELLS_NOT_BALANCING = 'BMS/Status/F/Cells_Not_Balancing' } From a62d95cb63d6c969e156b5147f5dede229fc8c72 Mon Sep 17 00:00:00 2001 From: RChandler234 <29521172+RChandler234@users.noreply.github.com> Date: Fri, 20 Dec 2024 19:02:27 -0600 Subject: [PATCH 3/5] #260 - update scylla dependencies to play nice on windows --- scylla-server/Cargo.lock | 19 ------------------- scylla-server/Cargo.toml | 2 +- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/scylla-server/Cargo.lock b/scylla-server/Cargo.lock index 874a978e..98d6754b 100755 --- a/scylla-server/Cargo.lock +++ b/scylla-server/Cargo.lock @@ -1283,18 +1283,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-sys" -version = "0.9.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "overload" version = "0.1.1" @@ -1362,12 +1350,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkg-config" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1381,7 +1363,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28fbf44fbf1d3e50d0ca0c6e6253f65d1bf01bb004a6ea553efb32e7081948c7" dependencies = [ "cc", - "openssl-sys", ] [[package]] diff --git a/scylla-server/Cargo.toml b/scylla-server/Cargo.toml index 47229e1a..36076133 100644 --- a/scylla-server/Cargo.toml +++ b/scylla-server/Cargo.toml @@ -6,7 +6,7 @@ default-run = "scylla-server" [dependencies] diesel = { version = "2.2.4", features = ["postgres", "r2d2", "chrono"] } -pq-sys = { version = "0.6", features = ["bundled"] } +pq-sys = { version = "0.6.3", features = ["bundled_without_openssl"] } dotenvy = "0.15" serde = "1.0.203" protobuf-codegen = "3.5.1" 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 4/5] #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 From acfcf5fd8741492ed67fc2049c672349585c6fb0 Mon Sep 17 00:00:00 2001 From: RChandler234 <29521172+RChandler234@users.noreply.github.com> Date: Sat, 21 Dec 2024 22:01:14 -0600 Subject: [PATCH 5/5] #260 - add node TPU to Location --- angular-client/src/data-type.enum.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-client/src/data-type.enum.ts b/angular-client/src/data-type.enum.ts index bf640058..39776e23 100644 --- a/angular-client/src/data-type.enum.ts +++ b/angular-client/src/data-type.enum.ts @@ -1,7 +1,6 @@ export enum DataTypeEnum { DRIVER = 'Driver', LOCATION = 'location', - POINTS = 'GPS/Location', VIEWERS = 'Viewers', // Special Latency info sent by Scylla @@ -29,6 +28,7 @@ export enum DataTypeEnum { RAMUsage = 'TPU/OnBoard/MemAvailable', WIFIRSSI = 'TPU/HaLow/RSSI', MCS = 'TPU/HaLow/ApMCS', + POINTS = 'TPU/GPS/Location', // BMS PACK_TEMP = 'BMS/Status/Temp_Average',