Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/extensions/agentic-workflows-dashboard/extension.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ function paginate(items, page = 1, pageSize = 20) {
const totalPages = Math.max(1, Math.ceil(totalItems / pageSize));
const safePage = Math.min(Math.max(1, page), totalPages);
const start = (safePage - 1) * pageSize;
const end = start + pageSize;
return {
items: items.slice(start, start + pageSize),
items: items.slice(start, end),
page: safePage,
pageSize,
totalItems,
Expand Down
35 changes: 13 additions & 22 deletions .github/extensions/agentic-workflows-dashboard/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ function formatDate(iso: string): string {
return new Date(iso).toLocaleString();
}

const LABEL_CLASS: Record<WorkflowRunStatus | WorkflowStepStatus, string> = {
queued: "Label Label--secondary",
pending: "Label Label--secondary",
running: "Label Label--attention",
completed: "Label Label--success",
done: "Label Label--success",
failed: "Label Label--danger",
};

function runGhCommand(command: string, runs: WorkflowRun[]): CommandResult {
const normalized = command.trim();

Expand Down Expand Up @@ -258,29 +267,11 @@ function runGhCommand(command: string, runs: WorkflowRun[]): CommandResult {
}

function statusClass(status: WorkflowRunStatus): string {
switch (status) {
case "completed":
return "Label Label--success";
case "failed":
return "Label Label--danger";
case "running":
return "Label Label--attention";
default:
return "Label Label--secondary";
}
return LABEL_CLASS[status];
}

function stepStatusClass(status: WorkflowStepStatus): string {
switch (status) {
case "done":
return "Label Label--success";
case "failed":
return "Label Label--danger";
case "running":
return "Label Label--attention";
default:
return "Label Label--secondary";
}
return LABEL_CLASS[status];
}

const definitions = buildDefinitions(definitionCount);
Expand All @@ -307,7 +298,7 @@ document.addEventListener("alpine:init", () => {
init() {
this.loadDefinitionPage(1);
this.loadRunPage(1);
if (this.commandOutput.length === 0) {
if (!this.commandOutput) {
this.runCommand();
}
},
Expand Down Expand Up @@ -370,7 +361,7 @@ document.addEventListener("alpine:init", () => {
status: "queued",
createdAt: now,
updatedAt: now,
steps: [buildStep(sequence, 1, "pending"), buildStep(sequence, 2, "pending"), buildStep(sequence, 3, "pending"), buildStep(sequence, 4, "pending")],
steps: [1, 2, 3, 4].map(step => buildStep(sequence, step, "pending")),
};

this.runs = [newRun, ...this.runs];
Expand Down