From d88db90ce9f28331fbaf3db8d627f76d955ffdf6 Mon Sep 17 00:00:00 2001 From: lrnselfreliance <33263708+lrnselfreliance@users.noreply.github.com> Date: Sun, 8 Nov 2026 08:48:58 -0700 Subject: [PATCH] The Settings upgrade can switch to a chosen branch (#954) * The Settings upgrade can switch to a chosen branch The Upgrade panel gains a Branch input: a dropdown listing the current branch, master, and release that also takes a typed branch name. /api/upgrade/start accepts an optional {"branch": ...}; without it the current branch is upgraded as before. A branch is written into the systemd env file and passed to `upgrade.sh -b`, so only plain git branch names are accepted. Co-Authored-By: Claude Opus 5.5 * The Controller upgrade refuses a branch that is not a plain branch name The Controller's upgrade script wrote its branch straight into the systemd env file, so a newline in it added a variable, and a leading dash became an upgrade.sh option. It now accepts the same branch names as the API, and no script parameter may span lines. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- app/src/api.js | 6 +- app/src/components/ThemeSamplePage.js | 7 +- app/src/components/admin/Settings.js | 68 ++++++++++++--- .../components/admin/UpgradeSegment.test.js | 63 ++++++++++++++ app/src/components/ui/Inputs.tsx | 2 + controller/lib/scripts.py | 26 ++++++ controller/test/test_scripts.py | 22 +++++ wrolpi/root_api.py | 8 +- wrolpi/test/test_upgrade.py | 83 +++++++++++++++++++ wrolpi/upgrade.py | 47 ++++++++--- 10 files changed, 304 insertions(+), 28 deletions(-) create mode 100644 app/src/components/admin/UpgradeSegment.test.js diff --git a/app/src/api.js b/app/src/api.js index 1ccf5275..e46553da 100644 --- a/app/src/api.js +++ b/app/src/api.js @@ -2226,8 +2226,10 @@ export async function checkUpgrade(force = false) { return null; } -export async function triggerUpgrade() { - const response = await apiPost(`${API_URI}/upgrade/start`); +// `branch` upgrades from that branch; without it the current branch is upgraded. +export async function triggerUpgrade(branch = null) { + const body = branch ? {branch} : undefined; + const response = await apiPost(`${API_URI}/upgrade/start`, body); if (!response.ok) { const message = await getErrorMessage(response, 'Failed to start upgrade. See server logs.'); toast({ diff --git a/app/src/components/ThemeSamplePage.js b/app/src/components/ThemeSamplePage.js index eb820788..4ff54967 100644 --- a/app/src/components/ThemeSamplePage.js +++ b/app/src/components/ThemeSamplePage.js @@ -2,6 +2,7 @@ import React, {useContext, useState} from 'react'; import {ThemeContext} from '../contexts/contexts'; import { ActionInput, + Autocomplete, Button, Card, CardGroup, @@ -789,7 +790,11 @@ export function ThemeSamplePage() { -
+
+ {/* A dropdown that also takes a typed value; open it to check the dropdown. */} + options}/>