Merge branch 'main' into web-modal-focus
This commit is contained in:
+32
-6
@@ -79,6 +79,29 @@ const repo = new PipelinesRepository(client);
|
||||
// configured value and the draft start from storage.
|
||||
const initialWorkspace = readWorkspace(localStorage);
|
||||
|
||||
/** The three detail section choices are sticky and survive a reload. */
|
||||
const SECTION_STORAGE_KEYS = {
|
||||
pipelines: "pipelines.web.pipelineTab.v1",
|
||||
runs: "pipelines.web.runTab.v1",
|
||||
templates: "pipelines.web.templateTab.v1",
|
||||
};
|
||||
|
||||
function readSection(key, fallback) {
|
||||
try {
|
||||
return localStorage.getItem(SECTION_STORAGE_KEYS[key]) || fallback;
|
||||
} catch {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
function writeSection(key, value) {
|
||||
try {
|
||||
localStorage.setItem(SECTION_STORAGE_KEYS[key], value);
|
||||
} catch {
|
||||
// Storage may be unavailable; the in-memory choice still applies.
|
||||
}
|
||||
}
|
||||
|
||||
const state = {
|
||||
view: "pipelines",
|
||||
url: readServerUrl(localStorage) || defaultServerUrl(),
|
||||
@@ -128,7 +151,7 @@ const state = {
|
||||
pipelineFilters: { ...EMPTY_PIPELINE_FILTERS },
|
||||
pipelineSort: "server_order",
|
||||
pipelineMenu: null,
|
||||
pipelineTab: "summary",
|
||||
pipelineTab: readSection("pipelines", "summary"),
|
||||
// The mounted workflow graph (P6) and whether its panel is expanded. The
|
||||
// handle is dropped on every re-render so its listeners can never leak.
|
||||
pipelineGraph: null,
|
||||
@@ -146,7 +169,7 @@ const state = {
|
||||
// failed/absent validate stores null so the card/detail say "unavailable".
|
||||
templateGraphs: new Map(),
|
||||
selectedTemplateKey: null,
|
||||
templateTab: "summary",
|
||||
templateTab: readSection("templates", "summary"),
|
||||
// The create-from-template dialog (P5): whether it is open, the name being
|
||||
// typed, whether a validate+submit is in flight, the server's refusal text and
|
||||
// the created pipeline's name (null until a success, which is also what makes
|
||||
@@ -166,7 +189,7 @@ const state = {
|
||||
// expand/collapse choices for the input/output field sections and the summary
|
||||
// artifacts section. The stage pane is the timeline's per-visit panel; its
|
||||
// section expansion is reseeded each time a pane is opened.
|
||||
runTab: "summary",
|
||||
runTab: readSection("runs", "summary"),
|
||||
runSections: new Set(),
|
||||
runStagePane: null,
|
||||
runStageSections: new Set(),
|
||||
@@ -186,6 +209,8 @@ const state = {
|
||||
// changes, plus the pure debounce/stale-token sequencer. Opening or closing the
|
||||
// search leaves state.view, the selection and the loaded data untouched.
|
||||
searchOpen: false,
|
||||
// The keyboard-selected result (ArrowUp/Down) and the row Enter opens.
|
||||
searchActiveIndex: 0,
|
||||
searchQuery: "",
|
||||
searchKind: DEFAULT_SEARCH_KIND,
|
||||
searchSort: DEFAULT_SEARCH_SORT,
|
||||
@@ -699,6 +724,7 @@ function selectSection(key) {
|
||||
if (state.view === "pipelines") state.pipelineTab = key;
|
||||
else if (state.view === "runs") state.runTab = key;
|
||||
else if (state.view === "templates") state.templateTab = key;
|
||||
writeSection(state.view, key);
|
||||
renderContent();
|
||||
focusSectionTab(key);
|
||||
}
|
||||
@@ -1334,7 +1360,7 @@ async function applyRoute(route) {
|
||||
state.selectedPipelineId = r.id;
|
||||
state.pipelineRequestedVersion = version;
|
||||
state.pipelineDetail = null;
|
||||
state.pipelineTab = r.kind === "pipelineStage" ? "graph" : "summary";
|
||||
if (r.kind === "pipelineStage") state.pipelineTab = "graph";
|
||||
state.pipelineGraphSelection = r.kind === "pipelineStage" ? r.stageKey : null;
|
||||
renderContent();
|
||||
if (!connected()) return;
|
||||
@@ -1817,7 +1843,7 @@ function resetRunDetailState() {
|
||||
state.runGraph?.unmount();
|
||||
state.runGraph = null;
|
||||
state.runDetail = null;
|
||||
state.runTab = "summary";
|
||||
// The section stays put when the operator opens another run (sticky, persisted).
|
||||
state.runSections = new Set();
|
||||
state.runStagePane = null;
|
||||
state.runStageSections = new Set();
|
||||
@@ -1865,7 +1891,7 @@ async function missingRunFallback(err) {
|
||||
*/
|
||||
function resetPipelineDetailState() {
|
||||
state.pipelineDetail = null;
|
||||
state.pipelineTab = "summary";
|
||||
// The section stays put when the operator opens another pipeline.
|
||||
state.pipelineGraphSelection = null;
|
||||
state.versionsExpanded = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user