Skip to content

[code-simplifier] Consolidate dashboard status label mapping and align pagination slice style#42180

Merged
pelikhan merged 2 commits into
mainfrom
copilot/code-simplifier-simplify-merge-status-switch
Jun 29, 2026
Merged

[code-simplifier] Consolidate dashboard status label mapping and align pagination slice style#42180
pelikhan merged 2 commits into
mainfrom
copilot/code-simplifier-simplify-merge-status-switch

Conversation

Copilot AI commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

This updates the recently added Agentic Workflows dashboard extension with targeted simplifications in protected files. It removes duplicated status-to-label logic in the canvas app and makes pagination slicing in the extension implementation consistent with existing patterns.

  • Status label mapping consolidation (src/app.ts)

    • Replaced parallel switch blocks in statusClass and stepStatusClass with a single typed lookup table covering both WorkflowRunStatus and WorkflowStepStatus.
    • Preserves existing label outputs for all supported statuses while removing duplicated branching logic.
  • Queued step creation simplification (src/app.ts)

    • Replaced repeated buildStep(sequence, n, "pending") calls with a mapped sequence ([1,2,3,4].map(...)) in dispatchSelectedWorkflow().
  • Minor idiomatic cleanup (src/app.ts)

    • Simplified the initial command-output check from this.commandOutput.length === 0 to !this.commandOutput.
  • Pagination consistency update (extension.mjs)

    • Introduced an explicit end variable in paginate() and used slice(start, end) for parity with the dashboard pagination style.
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 statusClass(status: WorkflowRunStatus): string {
  return LABEL_CLASS[status];
}

function stepStatusClass(status: WorkflowStepStatus): string {
  return LABEL_CLASS[status];
}

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Simplify merging parallel status switch statements into lookup table [code-simplifier] Consolidate dashboard status label mapping and align pagination slice style Jun 29, 2026
Copilot AI requested a review from pelikhan June 29, 2026 06:12
@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage — §28357644191

Field Value
Category refactor
Risk 🟢 Low
Score 18/100 (Impact 8 · Urgency 5 · Quality 5)
Action defer
Batch pr-batch:quality-sweep-drafts (with #42178, #42179, #42181)

Consolidates duplicate status→label logic in canvas app and normalises pagination slice style (+15/-23, 2 files). Code-simplifier output. Draft — no CI yet. Defer until promoted to ready.

Generated by 🔧 PR Triage Agent · 89.9 AIC · ⌖ 12 AIC · ⊞ 5.4K ·

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request simplifies the Agentic Workflows dashboard extension by consolidating status-to-label class mapping in the canvas app and making pagination slicing style consistent across the extension.

Changes:

  • Consolidated run/step status label CSS class mapping into a single typed lookup table (LABEL_CLASS) in src/app.ts.
  • Simplified queued step creation in dispatchSelectedWorkflow() by generating steps via a mapped sequence.
  • Updated paginate() in extension.mjs to use an explicit end variable and slice(start, end) for consistency.
Show a summary per file
File Description
.github/extensions/agentic-workflows-dashboard/src/app.ts Removes duplicated status-to-label branching and applies small idiomatic cleanups in the dashboard app logic.
.github/extensions/agentic-workflows-dashboard/extension.mjs Aligns pagination slicing style by introducing an end variable and using slice(start, end).

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Low

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[code-simplifier] simplify: merge parallel status switch statements into lookup table in dashboard app.ts

3 participants