mikebridge opened a new pull request, #43629: URL: https://github.com/apache/superset/pull/43629
### SUMMARY With the `SEMANTIC_LAYERS` feature flag enabled, the datasource list, the Explore datasource switcher and the native-filter configuration all offer semantic views alongside datasets, but the **Create Chart** page still queried the dataset-only endpoint. A user who had connected a semantic layer could see their semantic views everywhere except the one place a new chart starts from; the picker even said "Choose a datasource" while listing only datasets. This PR makes the Create Chart datasource picker load from the combined `/api/v1/datasource/` listing when the flag is on, and keeps the dataset-only behaviour byte-for-byte when it is off. **What changes** - `ChartCreation` loads options through a new shared `fetchDatasourceList` helper (`src/features/datasets/fetchDatasourceList.ts`), which the native-filter `DatasetSelect` now uses too, so both pickers follow one flag-switched contract instead of two diverging copies. Datasets and semantic views are numbered independently, so each option's value carries the Explore identity (`<id>__table` / `<id>__semantic_view`) and a same-numbered pair never collapses into one entry. - In the mixed list every option carries a text-only **Dataset** / **Semantic View** tag (no colour-only distinction). The `?dataset=` preload after saving a dataset still resolves against datasets only, and its selection is tagged the same way. - `AsyncSelect` now clears a previous fetch error when a new fetch starts. Before this, any `AsyncSelect` that hit one failed page stayed on the error banner for good: later searches fired requests but never rendered their results. This was pre-existing and affects every `AsyncSelect` consumer; the regression test lives with the component. - The combined datasource listing orders by `source_type, item_id` after the requested sort column. None of the sortable columns is unique across the union (a dataset and a semantic view can share a name), so offset pagination could repeat or drop rows at page boundaries. - Integration coverage for the combined list's authorization branches as a Gamma user: layer-level grant, view-level grant, and no `can_read` on `SemanticView`. The "Add a dataset" link keeps its wording and destination on purpose: it is an action-specific link to the dataset form, and semantic views are created from the datasource list page. Known cosmetic follow-up: the type tags sit next to each label rather than in a right-aligned column, because antd renders option labels in a shrink-to-fit wrapper. Left as is rather than styling the dropdown from outside the component. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Flag on, searching for "sales" on a stack with a `Sales` semantic view. **Before** — the semantic view is missing; only datasets are listed:  **After** — datasets and the semantic view in one list, each tagged:   **After** — a semantic view selected (closed picker), light and dark:   ### TESTING INSTRUCTIONS 1. Enable `SEMANTIC_LAYERS`, connect a semantic layer and add at least one semantic view (Datasets → **+** → Semantic view). 2. Open **Charts → + Chart**. The first step reads "Choose a datasource". Open the picker and search for part of the semantic view's name: it appears alongside matching datasets, each row tagged **Dataset** or **Semantic View**. 3. Pick the semantic view and a chart type, then **Create new chart**: Explore opens at `/explore/?viz_type=…&datasource=<id>__semantic_view` with the view's metrics and columns. 4. Pick a dataset that shares its numeric id with a semantic view (or vice versa): Explore opens the one you chose. 5. Failure recovery: with the picker open, make the listing fail once (for example block `/api/v1/datasource/` in devtools, then search). The dropdown shows the error rather than "No data"; unblock and search again: results render and the earlier selection is untouched. 6. Save a new dataset and land on Create Chart via `?dataset=<name>`: the dataset is preselected and tagged **Dataset**. 7. Disable `SEMANTIC_LAYERS`: the page reads "Choose a dataset", lists datasets only, and never calls `/api/v1/datasource/`. Automated: `ChartCreation.test.tsx` (flag on and off, mixed labels, ordering request, search, Explore identity, error state and recovery, preload, no-options state), `AsyncSelect.test.tsx` (error cleared on a later fetch), `DatasetSelect.test.tsx` (unchanged behaviour through the shared loader), `tests/unit_tests/datasource/dao_tests.py` (deterministic ordering across a page boundary), `tests/integration_tests/datasource/api_tests.py` (three Gamma authorization branches). ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [x] Required feature flags: `SEMANTIC_LAYERS` - [x] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [x] Introduces new feature or API - [ ] Removes existing feature or API _This description was drafted with Claude (AI) assistance on behalf of @mikebridge._ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
