Skip to content

feat: show access denied UI for canvas components when metrics view is inaccessible#9069

Draft
ericokuma wants to merge 1 commit intomainfrom
cursor/APP-790-canvas-metrics-access-display-2b76
Draft

feat: show access denied UI for canvas components when metrics view is inaccessible#9069
ericokuma wants to merge 1 commit intomainfrom
cursor/APP-790-canvas-metrics-access-display-2b76

Conversation

@ericokuma
Copy link
Contributor

Summary

When a user doesn't have access to metrics views referenced by canvas components (due to security policies), the backend silently removes those metrics views from the referencedMetricsViews response. Previously, this caused all affected components to show alarming red "Metrics view X not found" error messages, which was confusing and looked broken.

This PR introduces a cleaner, muted "access denied" UI that correctly differentiates between true configuration errors and access restrictions.

Changes

CanvasEntity (canvas-entity.ts)

  • Added _accessDeniedMetricsViews store to track metrics views that are referenced by components but not present in the referencedMetricsViews response (indicating the backend filtered them due to access policies)
  • Added isMetricsViewAccessDenied(name) method returning a reactive boolean store
  • Added computeAccessDeniedMetricsViews() to compute the denied set during spec processing

ComponentAccessDenied.svelte (new)

  • A muted, non-alarming component showing a lock icon and "You don't have access to this component" message
  • Uses neutral bg-surface-secondary/50 background instead of destructive red

Canvas display components updated:

  • CanvasChart.svelte - shows access denied UI for both schema and data errors
  • LeaderboardDisplay.svelte - shows access denied UI when schema validation fails
  • CanvasPivotDisplay.svelte + CanvasPivotRenderer.svelte - passes access denied state to renderer
  • KPIGrid.svelte - imported ComponentAccessDenied (KPI items handled by provider)
  • KPIProvider.svelte - shows access denied UI instead of rendering disabled KPI

CanvasComponent.svelte

  • Added neutral border style for access-denied cards (vs destructive red for true errors)

How it works

The backend's ResolveCanvas API applies security policies and removes inaccessible metrics views from referencedMetricsViews, but still returns all components in the canvas spec. By comparing component metrics_view references against the available referencedMetricsViews, we can determine which views were filtered due to access restrictions and show an appropriate UI.

Closes APP-790

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Linear Issue: APP-790

Open in Web Open in Cursor 

…s inaccessible in canvas

When a user doesn't have access to metrics views referenced by canvas
components, the backend removes those views from referencedMetricsViews.
Previously this caused all affected components to show alarming red
'Metrics view X not found' errors.

Changes:
- Track access-denied metrics views in CanvasEntity by comparing
  component references against available metricsViews
- Add ComponentAccessDenied.svelte with muted lock icon UI
- Update Chart, Leaderboard, Pivot, KPI Grid, and KPI components
  to show the access denied component instead of the red error
- Style access-denied cards with neutral border instead of destructive

Resolves APP-790

Co-authored-by: ericokuma <ericokuma@users.noreply.github.com>
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.

2 participants