Repository navigation
fix(dashboard): distinguish disabled observability from no traffic - #203
sunny-kavixo wants to merge 1 commit into
Conversation
Signed-off-by: Sunny <sandeepkisan1432@gmail.com>
There was a problem hiding this comment.
🟢 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
There was a problem hiding this comment.
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.
Summary
Verification
Related issue: IBM/mcp-context-forge#7312
Backend dependency: IBM/mcp-context-forge#7326