Skip to content

feat(semantic layers): form for SL with a single SV#40280

Merged
betodealmeida merged 1 commit into
masterfrom
single-sv
May 22, 2026
Merged

feat(semantic layers): form for SL with a single SV#40280
betodealmeida merged 1 commit into
masterfrom
single-sv

Conversation

@betodealmeida
Copy link
Copy Markdown
Member

SUMMARY

Adds two pieces of UX plumbing so semantic-layer extensions can ship a runtime form that fully describes a single view (think MetricFlow cubes), and so any runtime form that exposes a "pick several from a fixed list" field renders the right control.

Changes

superset-frontend/src/features/semanticLayers/jsonFormsHelpers.tsx

New JSON Forms renderer MultiEnumControl for schemas of the shape:

{ "type": "array", "items": { "enum": [...], "x-enumNames": [...] } }
  • Rendered as a single Antd <Select mode="multiple"> (tag-style multi-pick).
  • Uses items.x-enumNames for display labels, falling back to the raw enum value.
  • Honors the host form's config.refreshingSchema flag: the control shows a loading indicator while the schema is being re-fetched (e.g. dependent options narrowing as the user picks), without becoming disabled.
  • Registered at rank 35 so it beats upstream PrimitiveArrayControl (rank 30), which previously rendered a misleading "Add …" repeater of single selects that couldn't surface x-enumNames.
  • The existing enumNamesEntry (scalar x-enumNames renderer) is narrowed to only fire when schema.type !== 'array', so the new array entry owns the multi-select case.
superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx

Adds support for a top-level x-singleView: true flag on a layer's runtime schema. When set, the layer is treated as describing exactly one semantic view:

  • The "Semantic Views" multi-select picker is hidden.
  • Once get_semantic_views returns, the first not-yet-added view is auto-selected so the Add button can fire without an extra click.
  • The selection effect is idempotent (compares previous and next arrays before calling setSelectedViewNames), so it doesn't re-render the modal in a loop.

Also fixes a small bug in the "no runtime config" path of the layer-selection effect: previously, when a layer's runtime schema had no properties we skipped applyRuntimeSchema(schema) and went straight to fetchViews, which threw away top-level metadata like x-singleView. We now call applyRuntimeSchema(schema) first, then fetch views.

Why this matters

Extensions like MetricFlow expose layers that are a single cube — there is no list of views to pick from. Before this branch, the modal forced the user through an empty-but-required picker. With x-singleView, the runtime form fully drives the Add flow.

MultiEnumControl is a generic prerequisite: those same single-view runtime schemas commonly include "select N tags / N dimensions" array-of-enum fields, and the upstream PrimitiveArray renderer wasn't usable for them.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

  • Open Add Semantic View against a layer without x-singleView: behavior unchanged — picker is shown, manual selection required.
  • Open Add Semantic View against a layer with x-singleView: true and a non-empty runtime form: picker is hidden; once get_semantic_views resolves, the first available view is preselected and Add is enabled.
  • Same as above but the runtime form has no properties: x-singleView is still honored (picker hidden, view auto-selected).
  • A runtime form with an array/items.enum field renders an Antd tag-style multi-select using x-enumNames for labels; the control shows a loading spinner during schema refresh without disabling editing.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@betodealmeida betodealmeida marked this pull request as ready for review May 20, 2026 00:46
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 20, 2026

Code Review Agent Run #b75eb4

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/features/semanticLayers/jsonFormsHelpers.tsx - 1
    • Missing translation wrapper · Line 324-326
      The `placeholderText` fallback in `MultiEnumControl` lacks a translation-wrapped default. Line 194 uses `t('Loading...')` for consistency; apply the same pattern here for i18n compliance.
Review Details
  • Files reviewed - 2 · Commit Range: 671eed7..137c9fc
    • superset-frontend/src/features/semanticLayers/jsonFormsHelpers.tsx
    • superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added the change:frontend Requires changing the frontend label May 20, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 8bab4a6
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a0de1a7f645e2000843bfee
😎 Deploy Preview https://deploy-preview-40280--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 75.60976% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.19%. Comparing base (ea1ce71) to head (0028cd1).
⚠️ Report is 41 commits behind head on master.

Files with missing lines Patch % Lines
...rc/features/semanticViews/AddSemanticViewModal.tsx 35.71% 9 Missing ⚠️
...d/src/features/semanticLayers/jsonFormsHelpers.tsx 96.29% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #40280   +/-   ##
=======================================
  Coverage   64.19%   64.19%           
=======================================
  Files        2591     2591           
  Lines      138392   138429   +37     
  Branches    32109    32125   +16     
=======================================
+ Hits        88837    88871   +34     
- Misses      48025    48028    +3     
  Partials     1530     1530           
Flag Coverage Δ
javascript 67.15% <75.60%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx Outdated
Copy link
Copy Markdown
Contributor

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #9c60cb

Actionable Suggestions - 1
  • superset-frontend/src/features/semanticLayers/jsonFormsHelpers.tsx - 1
Review Details
  • Files reviewed - 2 · Commit Range: 137c9fc..3ce15e0
    • superset-frontend/src/features/semanticLayers/jsonFormsHelpers.tsx
    • superset-frontend/src/features/semanticViews/AddSemanticViewModal.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset-frontend/src/features/semanticLayers/jsonFormsHelpers.tsx
@betodealmeida betodealmeida requested a review from kgabryje May 21, 2026 15:23
@betodealmeida betodealmeida changed the title feat(semantic layers): form for SL with a single semantic feat(semantic layers): form for SL with a single semantic view May 21, 2026
@betodealmeida betodealmeida changed the title feat(semantic layers): form for SL with a single semantic view feat(semantic layers): form for SL with a single SV May 21, 2026
Copy link
Copy Markdown
Contributor

@rebenitez1802 rebenitez1802 left a comment

Choose a reason for hiding this comment

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

LGTM

@betodealmeida betodealmeida merged commit 21059b5 into master May 22, 2026
72 checks passed
@betodealmeida betodealmeida deleted the single-sv branch May 22, 2026 16:04
@bito-code-review
Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

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

Labels

change:frontend Requires changing the frontend preset-io size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants