michael-s-molina opened a new pull request, #37856:
URL: https://github.com/apache/superset/pull/37856

   ### SUMMARY
   
   Refactors the extension contribution schema to use a consistent nested 
structure for views and menus.
   
   **Problem:**
   The contribution schema had an inconsistency where `views` and `menus` used 
dot-notation string keys like `"sqllab.panels"` or `"sqllab.editor"` instead of 
a properly nested object structure.
   
   **Solution:**
   Changed to a fully nested structure where scope and location are separate 
object levels:
   
   ```json
   // Before (dot-notation keys)
   {
     "views": {
       "sqllab.panels": [...]
     },
     "menus": {
       "sqllab.editor": {...}
     }
   }
   
   // After (nested structure)
   {
     "views": {
       "sqllab": {
         "panels": [...]
       }
     },
     "menus": {
       "sqllab": {
         "editor": {...}
       }
     }
   }
   ```
   
   **Changes:**
   
   1. **TypeScript Types** (`contributions.ts`):
      - Added `SqlLabLocation` type with valid locations
      - Updated `ViewContributions` and `MenuContributions` to use nested 
structure
      - Type-safe: only valid scopes (`sqllab`) and locations (`leftSidebar`, 
`rightSidebar`, `panels`, `editor`, `statusBar`, `results`, `queryHistory`) are 
allowed
   
   2. **View Locations** (`SqlLab/contributions.ts`):
      - Renamed `ViewContribution` enum to `ViewLocations` const object
      - Nested structure: `ViewLocations.sqllab.panels` instead of 
`ViewContribution.Panels`
   
   3. **ExtensionsManager**:
      - Updated `getViewContributions()` and `getMenuContributions()` to handle 
nested lookup
      - Splits key on `.` to access `scope[location]`
   
   4. **Pydantic Schema** (`types.py`):
      - Updated `ContributionConfig` to use nested dict structure
   
   5. **Component Updates** (8 files):
      - Updated all SQL Lab components to use new `ViewLocations.sqllab.*` 
pattern
   
   6. **Documentation** (4 files):
      - Updated all extension.json examples in developer portal docs
   
   ### TESTING INSTRUCTIONS
   
   Test with an extension that uses the new schema:
      - Update an extension's `extension.json` to use nested structure
      - Build and load the extension
      - Verify views and menus appear correctly in SQL Lab
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] 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
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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]

Reply via email to