Skip to content

Conversation

@EnxDev
Copy link
Contributor

@EnxDev EnxDev commented Feb 28, 2025

SUMMARY

Migrate List Roles FAB view to React

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE
before
AFTER
Screenshot 2025-03-26 at 19 51 47

TESTING INSTRUCTIONS

  1. Add in your superset_config.py the following lines:
FAB_ADD_SECURITY_API = True
  1. Run superset init
  2. Go to settings on the frontend and click on List Roles

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

@korbit-ai
Copy link

korbit-ai bot commented Feb 28, 2025

Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment /korbit-review.

Your admin can change your review schedule in the Korbit Console

@EnxDev EnxDev added the frontend:refactor Related to refactoring the frontend label Feb 28, 2025
@rusackas
Copy link
Member

rusackas commented Mar 3, 2025

Thank you! I can't wait to see the last of these disappear :D

@michael-s-molina
Copy link
Member

Hi @EnxDev. Thanks for working on this! Let me know when it's ready for review as it's still in draft. Regarding this:

FAB_ADD_SECURITY_API = True
FAB_API_MAX_PAGE_SIZE = -1
Run superset init

It would probably require instructions on UPDATING.md.

@github-actions github-actions bot added the api Related to the REST API label Mar 6, 2025
@geido geido marked this pull request as ready for review March 26, 2025 17:52
@dosubot dosubot bot added the change:frontend Requires changing the frontend label Mar 26, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Readability Unclear Empty Object Initialization ▹ view 🧠 Not in standard
Files scanned
File Path Reviewed
superset/views/roles.py
superset-frontend/src/features/roles/types.ts
superset-frontend/src/features/roles/utils.ts
superset-frontend/src/components/ListView/types.ts
superset-frontend/src/dashboard/components/menu/BackgroundStyleDropdown.tsx
superset-frontend/src/components/ListView/Filters/Select.tsx
superset-frontend/src/features/roles/RoleFormItems.tsx
superset-frontend/src/features/roles/RoleListDuplicateModal.tsx
superset-frontend/src/features/roles/RoleListAddModal.tsx
superset-frontend/src/components/ListView/Filters/index.tsx
superset-frontend/src/views/routes.tsx
superset-frontend/src/features/roles/RoleListEditModal.tsx
superset-frontend/src/features/home/SubMenu.tsx
superset/security/api.py
superset/initialization/init.py
superset-frontend/src/pages/RolesList/index.tsx
superset/config.py
superset/security/manager.py

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Feedback and Support

onSave={onSave}
formSubmitHandler={handleFormSubmit}
requiredFields={['roleName']}
initialValues={{}}

This comment was marked as resolved.

@mistercrunch
Copy link
Member

Highly recommend setting up pre-commit -> https://superset.apache.org/docs/contributing/development/#git-hooks

@geido geido force-pushed the enxdev/feat/fab-list-roles-migration branch from c8aa718 to 840562a Compare April 2, 2025 10:22
@geido geido force-pushed the enxdev/feat/fab-list-roles-migration branch from 840562a to 07d5a77 Compare April 2, 2025 10:36
@geido geido merged commit 4f0020d into master Apr 2, 2025
48 checks passed
@geido geido deleted the enxdev/feat/fab-list-roles-migration branch April 2, 2025 11:06
@landryb
Copy link
Contributor

landryb commented Apr 9, 2025

fwiw, i've found a small regression from this PR, some of the requests done are invalid URLs according to RFCs, and when superset is behind a java proxy, those trigger 400 codes.

i've locally fixed them this way:

--- i/superset-frontend/src/pages/RolesList/index.tsx
+++ w/superset-frontend/src/pages/RolesList/index.tsx
@@ -114,7 +114,7 @@ function RolesList({ addDangerToast, addSuccessToast, user }: RolesListProps) {
 
       const fetchPage = async (pageIndex: number) => {
         const response = await SupersetClient.get({
-          endpoint: `api/v1/security/permissions-resources/?q={"page_size":${pageSize}, "page":${pageIndex}}`,
+          endpoint: `api/v1/security/permissions-resources/?q=(page_size:${pageSize},page:${pageIndex})`,
         });
 
         return {
@@ -163,7 +163,7 @@ function RolesList({ addDangerToast, addSuccessToast, user }: RolesListProps) {
 
       const fetchPage = async (pageIndex: number) => {
         const response = await SupersetClient.get({
-          endpoint: `api/v1/security/users/?q={"page_size":${pageSize},"page":${pageIndex}}`,
+          endpoint: `api/v1/security/users/?q=(page_size:${pageSize},page:${pageIndex})`,
         });
         return response.json;
       };

can do a PR with that if that is deemed reasonable/acceptable.

with this fixed, the new roles page works fine.

@geido
Copy link
Member

geido commented Apr 9, 2025

fwiw, i've found a small regression from this PR, some of the requests done are invalid URLs according to RFCs, and when superset is behind a java proxy, those trigger 400 codes.

i've locally fixed them this way:

--- i/superset-frontend/src/pages/RolesList/index.tsx
+++ w/superset-frontend/src/pages/RolesList/index.tsx
@@ -114,7 +114,7 @@ function RolesList({ addDangerToast, addSuccessToast, user }: RolesListProps) {
 
       const fetchPage = async (pageIndex: number) => {
         const response = await SupersetClient.get({
-          endpoint: `api/v1/security/permissions-resources/?q={"page_size":${pageSize}, "page":${pageIndex}}`,
+          endpoint: `api/v1/security/permissions-resources/?q=(page_size:${pageSize},page:${pageIndex})`,
         });
 
         return {
@@ -163,7 +163,7 @@ function RolesList({ addDangerToast, addSuccessToast, user }: RolesListProps) {
 
       const fetchPage = async (pageIndex: number) => {
         const response = await SupersetClient.get({
-          endpoint: `api/v1/security/users/?q={"page_size":${pageSize},"page":${pageIndex}}`,
+          endpoint: `api/v1/security/users/?q=(page_size:${pageSize},page:${pageIndex})`,
         });
         return response.json;
       };

can do a PR with that if that is deemed reasonable/acceptable.

with this fixed, the new roles page works fine.

@landryb a PR would be awesome! Please, feel free to ping me when you have it.

@landryb
Copy link
Contributor

landryb commented Apr 9, 2025

can do a PR with that if that is deemed reasonable/acceptable.
with this fixed, the new roles page works fine.

@landryb a PR would be awesome! Please, feel free to ping me when you have it.

that's #33060

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

Labels

api Related to the REST API change:frontend Requires changing the frontend frontend:refactor Related to refactoring the frontend size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants