feat(web): manage independent schedules and restore recorded stage navigation

This commit is contained in:
2026-10-21 02:06:15 +01:00
parent 4ab49a2749
commit 1e4654381e
31 changed files with 843 additions and 52 deletions
+31
View File
@@ -104,6 +104,37 @@ export class PipelinesRepository {
return { runs: response.runs ?? [], usage: response.usage ?? null };
}
async listSchedules(pipelineId = null) {
const request = { type: Protocol.LIST_SCHEDULES };
if (pipelineId != null) {
if (!Number.isSafeInteger(pipelineId) || pipelineId < 1) throw new ProtocolError("A positive pipeline ID is required.");
request.pipeline_id = pipelineId;
}
const response = await this.#client.call(request);
if (response.type !== Protocol.SCHEDULES || (response.schedules != null && !Array.isArray(response.schedules))) {
throw new ProtocolError("The server returned no schedules response.");
}
return response.schedules ?? [];
}
async saveSchedule(schedule, { requestKey } = {}) {
if (!schedule || typeof schedule !== "object" || Array.isArray(schedule)) throw new ProtocolError("A saved schedule is required.");
if (requestKey != null && (typeof requestKey !== "string" || requestKey.length > 128)) throw new ProtocolError("Schedule request keys must be strings of at most 128 characters.");
const request = { type: Protocol.SAVE_SCHEDULE, schedule };
if (requestKey) request.request_key = requestKey;
const response = await this.#client.call(request);
if (!response.schedule) throw new ProtocolError("The server returned no saved schedule.");
return response.schedule;
}
async deleteSchedule(id, revision) {
if (!Number.isSafeInteger(id) || id < 1 || !Number.isSafeInteger(revision) || revision < 1) {
throw new ProtocolError("An exact schedule ID and revision are required.");
}
const response = await this.#client.call({type:Protocol.DELETE_SCHEDULE,schedule_id:id,expected_revision:revision});
if (response.type !== Protocol.SCHEDULE_DELETED || response.schedule_id !== id) throw new ProtocolError("The server did not confirm deletion of this schedule.");
}
async getRun(id) {
const response = await this.#client.call({
type: Protocol.GET_RUN,