Move AOS Starter Web Page to frc971 folder
Signed-off-by: Nikolai Sohmers <nikolai@sohmers.com>
Change-Id: I1c14eb6598a9e48e82ef6ac05fc57f094c2f3124
diff --git a/y2024/BUILD b/y2024/BUILD
index 26727a5..74ccd21 100644
--- a/y2024/BUILD
+++ b/y2024/BUILD
@@ -339,9 +339,9 @@
data = [
":aos_config",
"//aos/network:log_web_proxy_main",
+ "//frc971/www:starter_main_bundle.min.js",
"//y2024/www:field_main_bundle.min.js",
"//y2024/www:files",
- "//y2024/www:starter_main_bundle.min.js",
],
target_compatible_with = ["@platforms//os:linux"],
)
diff --git a/y2024/www/BUILD b/y2024/www/BUILD
index 6b751ed..b9bf06a 100644
--- a/y2024/www/BUILD
+++ b/y2024/www/BUILD
@@ -56,39 +56,13 @@
],
)
-ts_project(
- name = "starter_main",
- srcs = [
- "starter_handler.ts",
- "starter_main.ts",
- ],
- target_compatible_with = ["@platforms//os:linux"],
- deps = [
- "//aos/network:connect_ts_fbs",
- "//aos/network:message_bridge_client_ts_fbs",
- "//aos/network/www:proxy",
- "//aos/starter:starter_ts_fbs",
- "@com_github_google_flatbuffers//ts:flatbuffers_ts",
- ],
-)
-
-rollup_bundle(
- name = "starter_main_bundle",
- entry_point = "starter_main.ts",
- target_compatible_with = ["@platforms//os:linux"],
- visibility = ["//y2024:__subpackages__"],
- deps = [
- ":starter_main",
- ],
-)
-
aos_downloader_dir(
name = "www_files",
srcs = [
":field_main_bundle.min.js",
":files",
- ":starter_main_bundle.min.js",
"//frc971/analysis:plot_index_bundle.min.js",
+ "//frc971/www:starter_main_bundle.min.js",
],
dir = "www",
target_compatible_with = ["@platforms//os:linux"],
diff --git a/y2024/www/starter.html b/y2024/www/starter.html
deleted file mode 100644
index 9060332..0000000
--- a/y2024/www/starter.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
- <head>
- <script src="starter_main_bundle.min.js" defer></script>
- <link rel="stylesheet" href="styles.css">
- </head>
- <body>
- <div>
- <div id="status_list"></div>
- </div>
- </body>
-</html>
\ No newline at end of file
diff --git a/y2024/www/starter_handler.ts b/y2024/www/starter_handler.ts
deleted file mode 100644
index 2b953f3..0000000
--- a/y2024/www/starter_handler.ts
+++ /dev/null
@@ -1,178 +0,0 @@
-import {ByteBuffer} from 'flatbuffers'
-import {Connection} from '../../aos/network/www/proxy'
-import {Status, ApplicationStatus, State, LastStopReason, FileState} from '../../aos/starter/starter_generated'
-
-const NODES = ['/orin1', '/imu', '/roborio'];
-
-export class StarterHandler {
- private statuses = new Map<string, ApplicationStatus[]>();
-
- private statusList: HTMLElement =
- (document.getElementById('status_list') as HTMLElement);
-
- constructor(private readonly connection: Connection) {
- for (const node in NODES) {
- this.connection.addConfigHandler(() => {
- this.connection.addHandler(
- NODES[node] + '/aos', 'aos.starter.Status', (data) => {
- this.handleStatus(data, NODES[node]);
- });
- });
- }
- }
-
- private handleStatus(data: Uint8Array, node: string): void {
- const fbBuffer = new ByteBuffer(data);
- const status: Status = Status.getRootAsStatus(fbBuffer);
-
- const temp: ApplicationStatus[] = new Array(status.statusesLength());
-
- for (let i = 0; i < status.statusesLength(); i++) {
- temp[i] = status.statuses(i);
- }
-
- this.statuses.set(node, temp);
- }
-
- setStateColor(div: HTMLElement): void {
- div.className = '';
- switch (div.innerHTML) {
- case 'WAITING':
- div.classList.add('yellow');
- break;
- case 'STARTING':
- div.classList.add('yellowgreen');
- break;
- case 'RUNNING':
- div.classList.add('lightgreen');
- break;
- case 'STOPPING':
- div.classList.add('lightcoral');
- break;
- case 'STOPPED':
- div.classList.add('lightcoral');
- break;
- }
- }
-
- setFileStateColor(div: HTMLElement): void {
- div.className = '';
- switch (div.innerHTML) {
- case 'NOT_RUNNING':
- div.classList.add('lightgreen');
- break;
- case 'NO_CHANGE':
- div.classList.add('lightgreen');
- break;
- case 'CHANGED_DURING_STARTUP':
- div.classList.add('lightcoral');
- break;
- case 'CHANGED':
- div.classList.add('lightcoral');
- break;
- }
- }
-
- private populateStatusList() : void {
- this.clearStatusList();
-
- const ELEMENTS: string[] = [
- 'name',
- 'node',
- 'state',
- 'last_exit_code',
- 'pid',
- // 'id',
- 'last_start_time',
- 'last_stop_reason',
- // 'process_info',
- // 'has_active_timing_report',
- 'file_state'
- ];
-
- // This is to add the field names as the top row
- //---------------------------------------------------
- const row = document.createElement('div');
- row.className = "column_names";
-
- for (const e in ELEMENTS) {
- const element = document.createElement('div');
- element.className = ELEMENTS[e];
- element.innerHTML = ELEMENTS[e].toUpperCase();
- element.style.fontWeight = 'bold';
- row.appendChild(element);
- }
-
- this.statusList.appendChild(row);
- //---------------------------------------------------
-
- for (const node in NODES) {
- const currentStatus = this.statuses.get(NODES[node]);
-
- if (currentStatus) {
- currentStatus.forEach(status => {
- const row = document.createElement('div');
- row.className = status.name();
-
- for (const e in ELEMENTS) {
- const element = document.createElement('div');
- element.className = ELEMENTS[e];
-
- switch (element.className) {
- case 'name':
- element.innerHTML = status.name();
- break;
- case 'node':
- element.innerHTML = NODES[node];
- break;
- case 'state':
- element.innerHTML = State[status.state()];
- this.setStateColor(element);
- break;
- case 'last_exit_code':
- element.innerHTML = status.lastExitCode().toString();
- break;
- case 'pid':
- element.innerHTML = status.pid().toString();
- break;
- case 'last_start_time':
- element.innerHTML = Number(status.lastStartTime() / 1000000000n).toString() + ' sec';
- break;
- case 'last_stop_reason':
- element.innerHTML = LastStopReason[status.lastStopReason()];
- break;
- case 'file_state':
- element.innerHTML = FileState[status.fileState()];
- this.setFileStateColor(element);
- break;
- default:
- element.innerHTML = "NA";
- break;
- }
- row.appendChild(element);
- }
-
- this.statusList.appendChild(row);
- })
- }
- }
- }
-
- private clearStatusList(): void {
- if (!this.statusList) {
- return;
- }
-
- while (this.statusList.firstChild) {
- this.statusList.removeChild(this.statusList.firstChild);
- }
- }
-
- draw(): void {
- if (this.statuses) {
- this.populateStatusList();
- }
-
- window.requestAnimationFrame(() => this.draw());
- }
-}
diff --git a/y2024/www/starter_main.ts b/y2024/www/starter_main.ts
deleted file mode 100644
index e9d23fa..0000000
--- a/y2024/www/starter_main.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import {Connection} from '../../aos/network/www/proxy';
-
-import {StarterHandler} from './starter_handler';
-
-const conn = new Connection();
-
-conn.connect();
-
-const starterHandler = new StarterHandler(conn);
-
-starterHandler.draw();
diff --git a/y2024/www/styles.css b/y2024/www/styles.css
deleted file mode 100644
index c5e0409..0000000
--- a/y2024/www/styles.css
+++ /dev/null
@@ -1,175 +0,0 @@
-.channel {
- display: flex;
- border-bottom: 1px solid;
- font-size: 24px;
-}
-#field {
- display: inline-block
-}
-
-#readouts,
-#middle_readouts
-{
- display: inline-block;
- vertical-align: top;
- float: right;
-}
-
-#legend {
- display: inline-block;
-}
-
-table, th, td {
- border: 1px solid black;
- border-collapse: collapse;
- padding: 5px;
- margin: 10px;
- table-layout: fixed;
- width: 100%;
- overflow: hidden;
-}
-
-th, td {
- text-align: left;
- width: 70px;
-}
-
-table:first-child {
- text-align: center;
-}
-
-td:first-child {
- width: 150px;
-}
-
-.connected, .near {
- background-color: LightGreen;
- border-radius: 10px;
-}
-
-.zeroing {
- background-color: yellow;
- border-radius: 10px;
-}
-
-.faulted {
- background-color: red;
- border-radius: 10px;
-}
-
-#vision_readouts > div {
- display: table-row;
- padding: 5px;
-}
-
-#vision_readouts > div > div {
- display: table-cell;
- padding: 5px;
- text-align: left;
- font: small;
-}
-
-#message_bridge_status > div {
- display: table-row;
- padding: 5px;
-}
-
-#message_bridge_status > div > div {
- display: table-cell;
- padding: 5px;
- text-align: right;
-}
-
-.channel {
- display: flex;
- border-bottom: 1px solid;
- font-size: 24px;
-}
-
-.aos_plot {
- position: absolute;
- width: 100%;
- height: 100%;
- box-sizing: border-box;
-}
-
-.aos_plot_text {
- position: absolute;
- width: 100%;
- height: 100%;
- pointer-events: none;
-}
-
-.aos_legend {
- position: absolute;
- z-index: 1;
- pointer-events: none;
-}
-
-.aos_legend_line {
- background: white;
- padding: 2px;
- border-radius: 2px;
- margin-top: 3px;
- margin-bottom: 3px;
- font-size: 12;
-}
-
-.aos_legend_line>div {
- display: inline-block;
- vertical-align: middle;
- margin-left: 5px;
-}
-.aos_legend_line>canvas {
- vertical-align: middle;
- pointer-events: all;
-}
-
-.aos_legend_line_hidden {
- filter: contrast(0.75);
-}
-
-.aos_cpp_plot {
- width: 100%;
- display: flex;
- flex-direction: column;
- height: 100%;
- align-items: flex-start;
-}
-
-.aos_cpp_plot>div {
- flex: 1;
- width: 100%;
-}
-
-#status_list > div {
- display: table-row;
- padding: 3px;
-}
-
-#status_list > div > div {
- display: table-cell;
- padding: 10px;
- text-align: left;
-}
-
-
-.yellow {
- background-color: yellow;
-}
-
-.yellowgreen {
- background-color: yellowgreen;
-}
-
-.lightgreen {
- background-color: LightGreen;
-}
-
-.lightcoral {
- background-color: lightcoral;
-}
-
-.red {
- background-color: red;
-}