Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b9a9a33
WIP version 1
jmaralo Jun 24, 2024
13fc583
First version!
jmaralo Jun 25, 2024
f30db12
Fix workflow file
jmaralo Jun 25, 2024
963d4c4
Make first version buildable
jmaralo Jun 25, 2024
fffab01
Improve sidebar HTML and CSS
jmaralo Jun 26, 2024
97ea1d9
Improve PageWrapper CSS
jmaralo Jun 26, 2024
10b7f87
useLoadBackend in ControlStation
jmaralo Jun 26, 2024
0fdf56e
Add splash screen component to common front
jmaralo Jun 26, 2024
6037c7d
Remove unwanted svgs
jmaralo Jun 26, 2024
85a4802
Styling and TODO comment for Ethernet View Splash Screen
jmaralo Jun 26, 2024
8f9c6eb
Change pagination position and remove unnecessary pages
jmaralo Jun 26, 2024
3c19abd
Update Data1Page css
jmaralo Jun 26, 2024
cbf4095
update Data2Page CSS
jmaralo Jun 26, 2024
7222b14
Improved BatteryPack CSS and HTML
jmaralo Jun 26, 2024
afc3681
Add hook to update pod data
jmaralo Jun 27, 2024
21eb048
Remove old assets and update new ones to reflect color
jmaralo Jun 27, 2024
c47a1f8
Use official typografy in vesper icon
jmaralo Jun 27, 2024
198eefd
Remove unused components
jmaralo Jun 27, 2024
ab0ab97
Fix Gauge arc id collision
jmaralo Jun 27, 2024
8ff51d0
Fix backend not sending all Unit information
jmaralo Jun 27, 2024
5bd5900
Small improvements to BarIndicator CSS & HTML
jmaralo Jun 27, 2024
5ff375f
Make StateIndicator reflect enum state
jmaralo Jun 27, 2024
c75eb36
Fix brake visualizer doing small changes in width when changing image
jmaralo Jun 27, 2024
ed55e46
Fix frontend not fetching orders
jmaralo Jun 28, 2024
0d7f8a6
Add TODO to orders form
jmaralo Jun 28, 2024
0647e71
Move controls tab information to data 2 page
jmaralo Jun 28, 2024
ecd1bb6
Remove default emergency orders
jmaralo Jun 28, 2024
f8aa379
Fix control station not building
jmaralo Jun 28, 2024
8c280a6
BCU and BMSL windows
jmaralo Jun 29, 2024
3e2c4f4
Add general state info
jmaralo Jun 29, 2024
12199ad
Sync form components with ethernet view
jmaralo Jun 30, 2024
336c709
Merge Orders component from ethernet view
jmaralo Jun 30, 2024
6fe5a95
Update orders component style
jmaralo Jun 30, 2024
126dd98
Update logger styles
jmaralo Jun 30, 2024
6ce266d
Set messages column max width
jmaralo Jun 30, 2024
d542709
Update icons
jmaralo Jun 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/build-control-station.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build control station

on:
workflow_call:
workflow_dispatch:
pull_request:
paths:
- control-station/**
- common-front/**

jobs:
build-control-station:
name: 'Build control station'
runs-on: ubuntu-latest

env:
FRONTEND_DIR: ./control-station
COMMON_DIR: ./common-front

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
control-station
common-front

- name: 'Install common front dependencies'
working-directory: '${{env.COMMON_DIR}}'
run: npm install

- name: 'Build common front'
working-directory: '${{env.COMMON_DIR}}'
run: npm run build

- name: 'Install control station dependencies'
working-directory: '${{env.FRONTEND_DIR}}'
run: npm install

- name: 'Build control station'
working-directory: '${{env.FRONTEND_DIR}}'
run: npm run build

- name: 'Upload build'
uses: actions/upload-artifact@v4
with:
name: control-station
path: '${{env.FRONTEND_DIR}}/static/*'
retention-days: 3
compression-level: 9
2 changes: 1 addition & 1 deletion backend/cmd/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ files = "/"
boards = ["VCU"]

[excel.download]
id="1NyNaAOw_6iWtnCpEg73AtSSFx1fMdhPRmmdOhjgjCZI"
id = "1NyNaAOw_6iWtnCpEg73AtSSFx1fMdhPRmmdOhjgjCZI"
name = "ade.xlsx"
path = "."

Expand Down
6 changes: 3 additions & 3 deletions backend/internal/excel/utils/units.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func ParseUnits(literal string, globalUnits map[string]Operations) (Units, error
ops, ok := globalUnits[parts[0]]

if !ok {
return Units{}, fmt.Errorf("units \"%s\" not found in global", parts[0])
return Units{Name: parts[0], Operations: make(Operations, 0)}, fmt.Errorf("units \"%s\" not found in global", parts[0])
}

return Units{
Expand All @@ -44,13 +44,13 @@ func ParseUnits(literal string, globalUnits map[string]Operations) (Units, error
}

if len(parts) != 2 {
return Units{}, fmt.Errorf("units %v can only have 2 parts", parts)
return Units{Name: parts[0], Operations: make(Operations, 0)}, fmt.Errorf("units %v can only have 2 parts", parts)
}

operations, err := NewOperations(parts[1])

if err != nil {
return Units{}, err
return Units{Name: parts[0], Operations: make(Operations, 0)}, err
}

return Units{
Expand Down
7 changes: 1 addition & 6 deletions backend/internal/pod_data/measurement.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ func getMeasurements(adeMeasurements []ade.Measurement, globalUnits map[string]u

func getMeasurement(adeMeas ade.Measurement, globalUnits map[string]utils.Operations) (Measurement, error) {
if isNumeric(adeMeas.Type) {
m, err := getNumericMeasurement(adeMeas, globalUnits)

if err != nil {
return nil, err
}
return m, nil
return getNumericMeasurement(adeMeas, globalUnits)
} else if adeMeas.Type == "bool" {
return getBooleanMeasurement(adeMeas), nil
} else if strings.HasPrefix(adeMeas.Type, "enum") {
Expand Down
5 changes: 5 additions & 0 deletions backend/pkg/http/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ import (
"encoding/json"
"io"
"net/http"
"sync"
"time"
)

type handleData struct {
name string
modTime time.Time
data io.ReadSeeker
dataMx *sync.Mutex
}

func HandleData(name string, data io.ReadSeeker) *handleData {
return &handleData{
name: name,
modTime: time.Now(),
data: data,
dataMx: new(sync.Mutex),
}
}

Expand All @@ -39,6 +42,8 @@ func (handle *handleData) ServeHTTP(writer http.ResponseWriter, request *http.Re
writer.Header().Set("Cache-Control", "no-cache")
writer.Header().Set("Pragma", "no-cache")
writer.Header().Set("Access-Control-Allow-Origin", "*")
handle.dataMx.Lock()
defer handle.dataMx.Unlock()
http.ServeContent(writer, request, handle.name, handle.modTime, handle.data)
}

Expand Down
7 changes: 5 additions & 2 deletions common-front/lib/adapters/PodData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export type MeasurementAdapter =

export type NumericMeasurementAdapter = Omit<NumericMeasurement, 'value'>;
export type BooleanMeasurementAdapter = Omit<BooleanMeasurement, 'value'>;
export type EnumMeasurementAdapter = Omit<EnumMeasurement, 'value'>;
export type EnumMeasurementAdapter = { options: string[] } & Omit<
EnumMeasurement,
'value'
>;

export function createPodDataFromAdapter(adapter: PodDataAdapter): PodData {
const boards: Board[] = Object.values(adapter.boards).map(
Expand Down Expand Up @@ -117,7 +120,7 @@ export function getEnumMeasurement(
id: id,
name: adapter.name,
type: 'enum',
value: 'Default',
value: adapter.options[0],
};
}

Expand Down
2 changes: 0 additions & 2 deletions common-front/lib/components/Caret/Caret.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.caretWrapper {
width: min-content;
height: min-content;
display: flex;
justify-content: center;
align-items: center;
Expand Down
10 changes: 5 additions & 5 deletions common-front/lib/components/Caret/Caret.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import styles from "./Caret.module.scss";
import { BsFillCaretRightFill } from "react-icons/bs";
import styles from './Caret.module.scss';
import { BsFillCaretRightFill } from 'react-icons/bs';
type Props = {
isOpen: boolean;
onClick?: () => void;
className?: string;
};

export const Caret = ({ isOpen, onClick, className = "" }: Props) => {
export const Caret = ({ isOpen, onClick, className = '' }: Props) => {
return (
<div
className={`${styles.caretWrapper} ${className}`}
className={`${className} ${styles.caretWrapper}`}
onClick={onClick}
style={{ transform: isOpen ? "rotate(90deg)" : "" }}
style={{ transform: isOpen ? 'rotate(90deg)' : '' }}
>
{<BsFillCaretRightFill />}
</div>
Expand Down
30 changes: 17 additions & 13 deletions common-front/lib/components/ColorfulChart/ColorfulChart.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
import styles from "./ColorfulChart.module.scss";
import { Legend } from "./Legend/Legend";
import { Title } from "./Title/Title";
import { LinesChart } from "../LinesChart/LinesChart";
import { LineDescription } from "../LinesChart/types";
import { useMemo } from "react";
import styles from './ColorfulChart.module.scss';
import { Legend } from './Legend/Legend';
import { Title } from './Title/Title';
import { LinesChart } from '../LinesChart/LinesChart';
import { LineDescription } from '../LinesChart/types';
import { useMemo } from 'react';

const palette = ["#EE8735", "#51C6EB", "#7BEE35", "#e469ca"];
const palette = ['#EE8735', '#51C6EB', '#7BEE35', '#e469ca'];

type Props = {
className?: string;
title: string;
title?: string;
items: LineDescription[];
length: number;
height?: string;
showLegend?: boolean;
showTitle?: boolean;
};

export const ColorfulChart = ({
className = "",
title,
className = '',
title = '',
items,
length,
height = "8rem",
height = '8rem',
showLegend = false,
showTitle = false,
}: Props) => {
const itemsWithPalette = useMemo(
() =>
Expand All @@ -33,7 +37,7 @@ export const ColorfulChart = ({

return (
<div className={`${styles.colorfulChart} ${className}`}>
<Title title={title} />
{showTitle && <Title title={title} />}
<div className={styles.body}>
<LinesChart
height={height}
Expand All @@ -42,7 +46,7 @@ export const ColorfulChart = ({
items={itemsWithPalette}
length={length}
/>
<Legend items={itemsWithPalette} />
{showLegend && <Legend items={itemsWithPalette} />}
</div>
</div>
);
Expand Down
10 changes: 5 additions & 5 deletions common-front/lib/components/ColorfulChart/Legend/Legend.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styles from "./Legend.module.scss";
import { LegendItem } from "./LegendItem/LegendItem";
import { LineDescription } from "../../LinesChart/types";
import styles from './Legend.module.scss';
import { LegendItem } from './LegendItem/LegendItem';
import { LineDescription } from '../../LinesChart/types';

type Props = {
items: LineDescription[];
Expand All @@ -14,8 +14,8 @@ export const Legend = ({ items }: Props) => {
<LegendItem
key={item.id}
name={item.name}
units={"A"}
value={item.getUpdate()}
units={'A'}
getValue={item.getUpdate}
color={item.color}
/>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import styles from "./LegendItem.module.scss";
import { useState } from 'react';
import { useGlobalTicker } from '../../../../services';
import styles from './LegendItem.module.scss';

type Props = {
name: string;
value: number;
getValue: () => number;
units: string;
color: string;
};

export const LegendItem = ({ name, units, value, color }: Props) => {
export const LegendItem = ({ name, units, getValue, color }: Props) => {
const [value, setValue] = useState(getValue());

useGlobalTicker(() => setValue(getValue()));

return (
<div className={styles.legendItem}>
<div
className={styles.name}
style={{ backgroundColor: color }}
>
<div className={styles.name} style={{ backgroundColor: color }}>
{name}
</div>
<div className={styles.value}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '../../../styles/styles.scss';

.buttonWrapper {
flex: 1 1 0;
display: flex;
Expand All @@ -6,12 +8,12 @@

padding: 0.5rem;
text-align: center;
border-radius: 0.5rem;
background-color: var(--tertiary-60);
border-radius: styles.$normal-border-radius;
background-color: styles.$orange;
color: white;
user-select: none;

filter: var(--shadow);
@include styles.shadow;

&.enabled {
cursor: pointer;
Expand All @@ -26,4 +28,9 @@
.label {
overflow: hidden;
text-overflow: ellipsis;
font-size: 1rem;
}

.icon {
width: 75%;
}
23 changes: 13 additions & 10 deletions common-front/lib/components/FormComponents/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import styles from "./Button.module.scss";
import { animated, useSpring } from "@react-spring/web";
import { lightenHSL } from "../../../color";
import styles from './Button.module.scss';
import { animated, useSpring } from '@react-spring/web';
import { lightenHSL } from '../../..';

type Props = {
label: string;
onClick: (ev: React.MouseEvent) => void;
label?: string;
icon?: string;
onClick?: (ev: React.MouseEvent) => void;
disabled?: boolean;
color?: string;
className?: string;
};

export const Button = ({
label,
color = "hsl(29, 88%, 57%)",
onClick,
disabled,
className = "",
label = undefined,
icon = undefined,
color = 'hsl(29, 88%, 57%)',
onClick = () => {},
disabled = false,
className = '',
}: Props) => {
const [springs, api] = useSpring(() => ({
from: { backgroundColor: color },
Expand Down Expand Up @@ -55,6 +57,7 @@ export const Button = ({
})
}
>
{icon && <img src={icon} alt="icon" className={styles.icon} />}
<span className={styles.label}>{label}</span>
</animated.div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.checkbox {
@use '../../../styles/styles.scss';

#checkBox {
width: 1rem;
height: 1rem;
border: 1px solid styles.$alternate-text-color;
}
Loading