diff --git a/frontend/src/assets/layout.scss b/frontend/src/assets/layout.scss new file mode 100644 index 0000000..d34dbe0 --- /dev/null +++ b/frontend/src/assets/layout.scss @@ -0,0 +1,67 @@ +.column { + display: flex; + flex-direction: column; + flex-wrap: nowrap; + justify-content: flex-start; + align-items: flex-start; + align-content: flex-start; +} + +.gap_half { + gap: 0.5em; +} + +.row { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; + align-items: flex-start; + align-content: center; + gap: 1em; +} + +.center { + justify-content: center; + align-items: center; + align-content: center; +} + +.screen { + max-height: 100vh; + width: 100%; +} + +.content { + margin: 20vh 10vw; + max-width: 1200px; +} + +.screen.content { + width: calc(100% - 20vw); + height: calc(100vh - 40vh); +} + +.stretch { + align-items: stretch; +} + +.grow { + flex-grow: 1; +} + +.grow2 { + flex-grow: 2; +} + +.no-basis { + flex-basis: 0; +} + +.no-min-height { + min-height: 0; +} + +.scroll { + overflow: auto; +} diff --git a/frontend/src/assets/main.scss b/frontend/src/assets/main.scss index 7c9aa05..f04e6ee 100644 --- a/frontend/src/assets/main.scss +++ b/frontend/src/assets/main.scss @@ -4,17 +4,32 @@ body { color: variables.$text-color; font-size: variables.$normal-text-size; + font-family: variables.$text-font; background-color: variables.$background-color; + display: flex; + flex-direction: column; + justify-content: flex-start; + align-items: center; + align-content: center; + min-height: 100vh; + margin: 0; +} + +main { + width: 100%; +} + +#app { display: flex; flex-direction: column; justify-content: center; align-items: center; align-content: center; - min-height: 100vh; } * { stroke-width: 0; + box-sizing: border-box; } polyline { @@ -26,3 +41,11 @@ polyline { #{--indexed-color}: list.nth(variables.$colors, $i); } } + +a, +a:visited, +a:hover, +a:active { + text-decoration: inherit; + color: inherit; +} diff --git a/frontend/src/assets/variables.scss b/frontend/src/assets/variables.scss index 0ccacde..af8b9ec 100644 --- a/frontend/src/assets/variables.scss +++ b/frontend/src/assets/variables.scss @@ -27,8 +27,10 @@ $magenta-2: oklch(75% 0.2 330); $text-color: $gray-1; $background-color: $gray-7; +$light2-background-color: color.adjust($background-color, $lightness: 10%); $light-background-color: color.adjust($background-color, $lightness: 5%); $dark-background-color: color.adjust($background-color, $lightness: -5%); +$dark2-background-color: color.adjust($background-color, $lightness: -10%); $cursor-tick: $gray-0; $time-tick: $gray-1; diff --git a/frontend/src/components/FlexDivider.vue b/frontend/src/components/FlexDivider.vue new file mode 100644 index 0000000..7c17af6 --- /dev/null +++ b/frontend/src/components/FlexDivider.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/frontend/src/components/PanelHeirarchy.vue b/frontend/src/components/PanelHeirarchy.vue new file mode 100644 index 0000000..c286a69 --- /dev/null +++ b/frontend/src/components/PanelHeirarchy.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/frontend/src/components/SvgGraph.vue b/frontend/src/components/SvgGraph.vue index bfdb80d..899f5c8 100644 --- a/frontend/src/components/SvgGraph.vue +++ b/frontend/src/components/SvgGraph.vue @@ -35,6 +35,7 @@ const width = ref(0); const height = ref(0); const controls_height = 32; +const min_time_label_separation = 250; const resize_observer = new ResizeObserver((elements) => { for (const element of elements) { @@ -80,6 +81,7 @@ const time_lines = [ 10000, // 10s 30000, // 30s 60000, // 1m + 150000, // 2.5m 300000, // 5m 6000000, // 10m 18000000, // 30m @@ -92,7 +94,7 @@ const time_lines = [ 1728000000, // 2d 6048000000, // 1w ]; -time_lines.reverse(); +// time_lines.reverse(); const text_offset = computed(() => 5); const legend_width = 160; @@ -192,15 +194,20 @@ const legend_y_stride = computed(() => 16); const legend_width_output = computed(() => legend_width - 8); const line_duration = computed(() => { + const width_px = width.value; const diff_x = max_x.value - min_x.value; - return time_lines.find((duration) => diff_x / duration >= 2)!; + return time_lines.find((duration) => { + const line_count = diff_x / duration; + const width_per_line = width_px / line_count; + return width_per_line >= min_time_label_separation; + })!; }); const lines = computed(() => { const result = []; for ( let i = Math.ceil(max_x.value / line_duration.value); - i >= Math.ceil(min_x.value / line_duration.value) - 5; + i >= Math.floor(min_x.value / line_duration.value); i-- ) { const x = i * line_duration.value; @@ -356,6 +363,7 @@ provide(GRAPH_DATA, { :timestamp="tick" :utc="props.utc" :show_millis="line_duration < 1000" + :key="tick" > @@ -425,8 +433,4 @@ div.controls-header { gap: 0 1em; margin: 0 1em 0 1em; } - -div.controls-header > div.grow { - flex-grow: 1; -} diff --git a/frontend/src/components/TelemetryInfo.vue b/frontend/src/components/TelemetryInfo.vue new file mode 100644 index 0000000..71191b5 --- /dev/null +++ b/frontend/src/components/TelemetryInfo.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/frontend/src/components/TelemetryLine.vue b/frontend/src/components/TelemetryLine.vue index 4a9de04..f6b65ec 100644 --- a/frontend/src/components/TelemetryLine.vue +++ b/frontend/src/components/TelemetryLine.vue @@ -525,21 +525,8 @@ rect.legend:has(~ .legend:hover) { cursor: help; } -div.column { - display: flex; - flex-flow: column nowrap; - justify-content: flex-start; - align-items: flex-start; - align-content: flex-start; - gap: 0.25em; -} - +div.column, div.row { - display: flex; - flex-flow: row nowrap; - justify-content: flex-start; - align-items: center; - align-content: center; gap: 0.25em; } diff --git a/frontend/src/components/TelemetryList.vue b/frontend/src/components/TelemetryList.vue new file mode 100644 index 0000000..7f3c918 --- /dev/null +++ b/frontend/src/components/TelemetryList.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/frontend/src/components/TextInput.vue b/frontend/src/components/TextInput.vue new file mode 100644 index 0000000..ce88350 --- /dev/null +++ b/frontend/src/components/TextInput.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/frontend/src/composables/telemetry.ts b/frontend/src/composables/telemetry.ts index 6f5e723..bc4bcef 100644 --- a/frontend/src/composables/telemetry.ts +++ b/frontend/src/composables/telemetry.ts @@ -26,7 +26,6 @@ export function useAllTelemetry() { return { data, error }; } - export function useTelemetry(name: MaybeRefOrGetter) { const data = ref(null); // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 6a6ae40..2e83312 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -1,4 +1,5 @@ import './assets/main.scss'; +import './assets/layout.scss'; import { createApp } from 'vue'; import App from './App.vue'; diff --git a/frontend/src/panels/panel.ts b/frontend/src/panels/panel.ts new file mode 100644 index 0000000..3af6267 --- /dev/null +++ b/frontend/src/panels/panel.ts @@ -0,0 +1,92 @@ +import type { RouteLocationRaw } from 'vue-router'; + +export enum PanelHeirarchyType { + LEAF, + FOLDER, +} + +export type PanelHeirarchyLeaf = { + name: string; + to: RouteLocationRaw; + type: PanelHeirarchyType.LEAF; +}; + +export type PanelHeirarchyFolder = { + name: string; + children: PanelHeirarchyChildren; + type: PanelHeirarchyType.FOLDER; +}; + +export type PanelHeirarchyChildren = ( + | PanelHeirarchyFolder + | PanelHeirarchyLeaf +)[]; + +export function getPanelHeirarchy(): PanelHeirarchyChildren { + const result: PanelHeirarchyChildren = []; + + result.push({ + name: 'Graph Test', + to: { name: 'graph' }, + type: PanelHeirarchyType.LEAF, + }); + + result.push({ + name: 'Telemetry Elements', + to: { name: 'list' }, + type: PanelHeirarchyType.LEAF, + }); + + return result; +} + +export function filterHeirarchy( + heirarchy: PanelHeirarchyChildren, + predicate: (leaf: PanelHeirarchyLeaf) => boolean, +): PanelHeirarchyChildren { + const result: PanelHeirarchyChildren = []; + + for (const element of heirarchy) { + switch (element.type) { + case PanelHeirarchyType.LEAF: + if (predicate(element)) { + result.push(element); + } + break; + case PanelHeirarchyType.FOLDER: + const folder_contents = filterHeirarchy( + element.children, + predicate, + ); + if (folder_contents.length > 0) { + result.push({ + name: element.name, + children: folder_contents, + type: PanelHeirarchyType.FOLDER, + }); + } + break; + } + } + + return result; +} + +export function getFirstLeaf( + heirarchy: PanelHeirarchyChildren, +): PanelHeirarchyLeaf | null { + for (const element of heirarchy) { + switch (element.type) { + case PanelHeirarchyType.LEAF: + return element; + case PanelHeirarchyType.FOLDER: + const leaf = getFirstLeaf(element.children); + if (leaf != null) { + return leaf; + } + break; + } + } + + return null; +} diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 370cd88..8883326 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -6,7 +6,7 @@ const router = createRouter({ { path: '/', name: 'home', - component: () => import('../views/HomeView.vue'), + component: () => import('../views/EmptyPanelView.vue'), }, { path: '/graph', diff --git a/frontend/src/views/EmptyPanelView.vue b/frontend/src/views/EmptyPanelView.vue new file mode 100644 index 0000000..2b8e01d --- /dev/null +++ b/frontend/src/views/EmptyPanelView.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue deleted file mode 100644 index 5b519e6..0000000 --- a/frontend/src/views/HomeView.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/frontend/src/views/TelemetryListView.vue b/frontend/src/views/TelemetryListView.vue index 5c9b493..1efea1b 100644 --- a/frontend/src/views/TelemetryListView.vue +++ b/frontend/src/views/TelemetryListView.vue @@ -1,25 +1,46 @@ diff --git a/server/src/http/api/mod.rs b/server/src/http/api/mod.rs index 6aca119..00d68de 100644 --- a/server/src/http/api/mod.rs +++ b/server/src/http/api/mod.rs @@ -79,8 +79,7 @@ async fn get_tlm_history( } pub fn setup_api(cfg: &mut web::ServiceConfig) { - cfg - .service(get_all_tlm_definitions) + cfg.service(get_all_tlm_definitions) .service(get_tlm_definition) .service(get_tlm_history); } diff --git a/server/src/telemetry/history.rs b/server/src/telemetry/history.rs index 683c38d..e7d7996 100644 --- a/server/src/telemetry/history.rs +++ b/server/src/telemetry/history.rs @@ -505,7 +505,7 @@ impl TelemetryHistory { service, self.data.definition.data_type, ) - .await, + .await, ); } } @@ -543,7 +543,6 @@ impl TelemetryHistory { let mut disk_result = vec![]; let mut ram_result = vec![]; - let mut from = from; let mut to = to; let initial_to = to;