Skip to content

fix(dashboard): distinguish disabled observability from no traffic - #203

Open
sunny-kavixo wants to merge 1 commit into
contextforge-org:mainfrom
sunny-kavixo:fix/7312-sparklines-empty-states
Open

sunny-kavixo wants to merge 1 commit into
contextforge-org:mainfrom
sunny-kavixo:fix/7312-sparklines-empty-states

Conversation

@sunny-kavixo

Copy link
Copy Markdown

Summary

  • Distinguish disabled observability from enabled observability with no traffic on Home sparklines.
  • Add English, Spanish, and Portuguese empty-state translations.
  • Replace handwritten metrics types with Orval-generated types and update OpenAPI schema.
  • Add regression tests for both empty states.

Verification

  • Full Vitest suite: 3,793 passed, 1 skipped (227 files passed).
  • TypeScript, ESLint, and production build passed.

Related issue: IBM/mcp-context-forge#7312
Backend dependency: IBM/mcp-context-forge#7326

Signed-off-by: Sunny <sandeepkisan1432@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused changes align with the backend contract, cover both empty states, and have no unresolved blocking findings.

No open issues 🎉

What changed in this PR

This PR updates the Home dashboard sparklines to distinguish disabled observability from an enabled system with no traffic, using the backend’s enabled flag.

Changes:

  • Add distinct empty-state messages in English, Spanish, and Portuguese.
  • Replace handwritten metrics types with generated types and update the OpenAPI schema.
  • Add regression coverage for both empty states and align test fixtures with generated types.
File Description
src/​types/​metrics.ts Remove handwritten metrics response types.
src/​i18n/​locales/​pt-BR/​dashboard.json Add Portuguese empty-state messages.
src/​i18n/​locales/​es-ES/​dashboard.json Add Spanish empty-state messages.
src/​i18n/​locales/​en-US/​dashboard.json Add English empty-state messages.
src/​hooks/​useMetrics.ts Import generated response types.
src/​hooks/​useMetrics.test.ts Align fixtures with generated response types.
src/​components/​dashboard/​SystemSparklinesCardConnected.test.tsx Update connected-card metrics fixtures.
src/​components/​dashboard/​SystemSparklinesCard.tsx Select the empty-state message using observability status.
src/​components/​dashboard/​SystemSparklinesCard.test.tsx Cover disabled observability and enabled-with-no-traffic states.
src/​api/​metrics.ts Use generated metrics response types.
openapi.json Add enabled to both metrics response schemas.

Review effort: Balanced

@a-effort a-effort 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.

timeseries?.enabled === false || percentiles?.enabled === false is only true when the response includes enabled. An API without [IBM/mcp-context-forge#7326](IBM/mcp-context-forge#7326) leaves the field out, so the card shows empty.noTraffic and tells users with tracing turned off that they have no traffic. The UI is released under its own tags, so the problem remains after #7326 merges. Showing dashboard.home.sparklines.empty when the state is unknown fixes it:

// An API older than #7326 reports neither state.
const tracingEnabled = timeseries?.enabled ?? percentiles?.enabled;

const emptyMessageId =
  tracingEnabled === undefined
    ? "dashboard.home.sparklines.empty"
    : tracingEnabled
      ? "dashboard.home.sparklines.empty.noTraffic"
      : "dashboard.home.sparklines.empty.disabled";

This keeps the existing key in each locale file, so #200 only needs to merge the content changes. A test that leaves out enabled and checks for the OBSERVABILITY_ENABLED message would cover it.

scripts/refresh-openapi.sh generates openapi.json and sets info.version, currently 1.1.0+42a06c. A manual edit breaks that version match, and the next refresh removes enabled, so timeseries?.enabled no longer compiles. Merge #7326, regenerate the spec with the script, then rebase.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants