From c4f46c51b28356598b89b94af7015c4fe9286a24 Mon Sep 17 00:00:00 2001 From: AngusBell97 <124716116+AngusBell97@users.noreply.github.com> Date: Fri, 11 Sep 2026 14:36:56 +0100 Subject: [PATCH] Add branch and historical version selection to Galaxy --- .../the_galaxy/assets/mobile/css/material.css | 21 + .../system/the_galaxy/assets/mobile/js/api.js | 6 + .../mobile/js/components/GalaxyModal.js | 2 +- .../mobile/js/components/GalaxySelect.js | 141 ++++ .../js/components/VersionHistoryPicker.js | 205 +++++ .../assets/mobile/js/views/SystemTools.js | 212 ++++- .../the_galaxy/tests/test_branch_selector.mjs | 267 ++++++ .../the_galaxy/tests/test_version_history.py | 794 ++++++++++++++++++ .../tests/test_version_history_picker.mjs | 71 ++ .../the_galaxy/tests/test_version_install.py | 363 ++++++++ .../tests/test_version_install_index.py | 189 +++++ .../tests/test_version_install_rehearsal.py | 257 ++++++ .../the_galaxy/tests/test_version_routes.py | 125 +++ starpilot/system/the_galaxy/the_galaxy.py | 113 +++ .../system/the_galaxy/version_history.py | 483 +++++++++++ .../system/the_galaxy/version_install.py | 466 ++++++++++ 16 files changed, 3697 insertions(+), 18 deletions(-) create mode 100644 starpilot/system/the_galaxy/assets/mobile/js/components/GalaxySelect.js create mode 100644 starpilot/system/the_galaxy/assets/mobile/js/components/VersionHistoryPicker.js create mode 100644 starpilot/system/the_galaxy/tests/test_branch_selector.mjs create mode 100644 starpilot/system/the_galaxy/tests/test_version_history.py create mode 100644 starpilot/system/the_galaxy/tests/test_version_history_picker.mjs create mode 100644 starpilot/system/the_galaxy/tests/test_version_install.py create mode 100644 starpilot/system/the_galaxy/tests/test_version_install_index.py create mode 100644 starpilot/system/the_galaxy/tests/test_version_install_rehearsal.py create mode 100644 starpilot/system/the_galaxy/tests/test_version_routes.py create mode 100644 starpilot/system/the_galaxy/version_history.py create mode 100644 starpilot/system/the_galaxy/version_install.py diff --git a/starpilot/system/the_galaxy/assets/mobile/css/material.css b/starpilot/system/the_galaxy/assets/mobile/css/material.css index 8d1347661e..46b9799de9 100644 --- a/starpilot/system/the_galaxy/assets/mobile/css/material.css +++ b/starpilot/system/the_galaxy/assets/mobile/css/material.css @@ -1899,3 +1899,24 @@ button.gx-chip:hover { .gx-monitor td:first-child { min-width:180px; max-width:350px; white-space:normal; overflow-wrap:anywhere; } .gx-monitor tbody tr:hover { background:var(--surface); } @media(max-width:600px) { .gx-monitor__summary { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; } .gx-monitor__metric { padding:12px; } .gx-monitor__metric strong { font-size:22px; } } + +/* Version and branch selector menus. */ +.gx-select { display: inline-flex; position: relative; vertical-align: middle; min-width: 0; max-width: 100%; } +.gx-select.gx-field { padding: 0; background: var(--surface-container-high); } +.gx-select.gx-field--full { display: flex; width: 100%; } +.gx-select__button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-width: 0; min-height: 44px; padding: 10px var(--sp-3); border: 0; border-radius: inherit; color: inherit; background: transparent; font: inherit; text-align: left; cursor: pointer; } +.gx-select__button > span { min-width: 0; overflow-wrap: anywhere; white-space: normal; } +.gx-select__button > i { flex-shrink: 0; } +.gx-select:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; } +.gx-select__button:disabled { opacity: .5; cursor: default; } +.gx-select-menu { position: fixed; inset: auto; margin: 0; padding: 6px; box-sizing: border-box; max-width: none; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--outline-variant, var(--glass-border)); border-radius: var(--radius-md); color: var(--on-surface); background: var(--surface-container-high, #252033); box-shadow: 0 12px 36px #0006; font: var(--fs-base) var(--font-body); } +.gx-select-menu::backdrop { background: transparent; } +.gx-select-menu [role="option"] { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: inherit; text-align: left; font: inherit; white-space: normal; overflow-wrap: anywhere; cursor: pointer; } +.gx-select-menu [role="option"][aria-selected="true"] { background: var(--primary-container); color: var(--on-primary-container); } +.gx-select-menu [role="option"]:hover:not(:disabled), .gx-select-menu [role="option"]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--primary-container); color: var(--on-primary-container); } +.gx-select-menu [role="option"]:disabled { opacity: .45; cursor: default; } +.gx-select-menu__group { padding: 10px 12px 4px; color: var(--on-surface-variant); font-size: .85em; } + +.gx-select-menu { background: linear-gradient(var(--surface-container-high), var(--surface-container-high)), #141020; } +[data-theme="light"] .gx-select-menu { background: linear-gradient(var(--surface-container-high), var(--surface-container-high)), #fff; } +.gx-select-menu:not([open]) { display: none; } diff --git a/starpilot/system/the_galaxy/assets/mobile/js/api.js b/starpilot/system/the_galaxy/assets/mobile/js/api.js index b1835cb6ef..871e243086 100644 --- a/starpilot/system/the_galaxy/assets/mobile/js/api.js +++ b/starpilot/system/the_galaxy/assets/mobile/js/api.js @@ -228,6 +228,12 @@ export const api = { getUpdateBranches() { return request("/api/update/branches") }, getUpdateBranch() { return request("/api/update/branch") }, setUpdateBranch(branch) { return request("/api/update/branch", { method: "POST", data: { branch } }) }, + getUpdateVersions(branch, { page = 1, head = "", signal } = {}) { + const query = new URLSearchParams({ branch, page: String(page) }) + if (head) query.set("head", head) + return request(`/api/update/versions?${query}`, { cache: "no-store", signal }) + }, + installUpdateVersion(branch, commit) { return request("/api/update/version", { method: "POST", data: { branch, commit, confirmed: true } }) }, updateFast() { return request("/api/update/fast", { method: "POST" }) }, getUpdateFastStatus() { return request("/api/update/fast/status") }, updateRecover() { return request("/api/update/recover", { method: "POST" }) }, diff --git a/starpilot/system/the_galaxy/assets/mobile/js/components/GalaxyModal.js b/starpilot/system/the_galaxy/assets/mobile/js/components/GalaxyModal.js index 81687dac96..a734ad96f1 100644 --- a/starpilot/system/the_galaxy/assets/mobile/js/components/GalaxyModal.js +++ b/starpilot/system/the_galaxy/assets/mobile/js/components/GalaxyModal.js @@ -34,7 +34,7 @@ export const GalaxyModal = {