Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: database extension registry #23174

Merged
merged 9 commits into from
May 19, 2023

Conversation

betodealmeida
Copy link
Member

SUMMARY

Allow the implementation of custom extensions to customize databases via setupExtensions.ts.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

WIP

TESTING INSTRUCTIONS

Writing tests.

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

@codecov
Copy link

codecov bot commented Feb 24, 2023

Codecov Report

Merging #23174 (825467a) into master (f0a26fd) will decrease coverage by 0.02%.
The diff coverage is 23.68%.

❗ Current head 825467a differs from pull request most recent head 710185c. Consider uploading reports for the commit 710185c to get more accurate results

@@            Coverage Diff             @@
##           master   #23174      +/-   ##
==========================================
- Coverage   56.98%   56.97%   -0.02%     
==========================================
  Files        1951     1951              
  Lines       75412    75448      +36     
  Branches     8185     8196      +11     
==========================================
+ Hits        42976    42984       +8     
- Misses      30333    30358      +25     
- Partials     2103     2106       +3     
Flag Coverage Δ
javascript 54.67% <23.68%> (-0.04%) ⬇️

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

Impacted Files Coverage Δ
...set-ui-core/src/ui-overrides/ExtensionsRegistry.ts 100.00% <ø> (ø)
...end/src/features/databases/DatabaseModal/styles.ts 77.66% <ø> (ø)
superset-frontend/src/pages/DatabaseList/index.tsx 66.03% <0.00%> (ø)
...end/src/features/databases/DatabaseModal/index.tsx 43.63% <11.53%> (-1.73%) ⬇️
.../features/databases/DatabaseModal/ExtraOptions.tsx 64.70% <42.85%> (-5.67%) ⬇️
superset-frontend/src/pages/DatasetList/index.tsx 57.76% <66.66%> (+0.16%) ⬆️
.../src/explore/components/controls/SelectControl.jsx 64.28% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -566,6 +602,93 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({

const [useSSHTunneling, setUseSSHTunneling] = useState<boolean>(false);

const createPostProcessingCallbacks = useRef<any>({});
const updatePostProcessingCallbacks = useRef<any>({});
Copy link
Member

Choose a reason for hiding this comment

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

If I understand this correctly, it looks like the child is sending a function from a lower level component up to the a higher component by attaching it to a ref, is that right? Would it be easier to import the extension into this parent index component, and then you can call the create and update callbacks later in the parent and then pass down just the visual components to the ExtraOptions? That way you don't have to pass the callbacks up to the parent. I'm not sure if that's necessarily the solution, but I know that these extension points are complicated, so trying to help suggest a simpler solution if there is one.

@betodealmeida betodealmeida force-pushed the database-registry branch 2 times, most recently from 00d00af to c09c4a9 Compare March 23, 2023 19:25
@eschutho eschutho force-pushed the database-registry branch 2 times, most recently from cafea86 to 5f839a8 Compare March 29, 2023 23:04
@pull-request-size pull-request-size bot added size/M and removed size/L labels Mar 29, 2023
Copy link
Member Author

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

Nice! I like the simplified approach. I can work on the onsave method in shell, if you haven't started it.

@@ -16,9 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
import React, { ChangeEvent, EventHandler } from 'react';
import React, { ChangeEvent, EventHandler, FunctionComponent } from 'react';
Copy link
Member Author

Choose a reason for hiding this comment

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

This is no longer needed and is causing tests to fail.

@@ -573,6 +573,7 @@ export const StyledStickyHeader = styled.div`
top: 0;
z-index: ${({ theme }) => theme.zIndex.max};
background: ${({ theme }) => theme.colors.grayscale.light5};
height: ${({ theme }) => theme.gridUnit * 16}px;
Copy link
Member

Choose a reason for hiding this comment

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

fixing this height so that it doesn't jump when loading.

@@ -715,6 +734,8 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
};

const onSave = async () => {
// TODO: Elizabeth - add some error handling or promise/callback here
dbConfigExtraExtension?.onSave(extraExtensionComponentState, db);
Copy link
Member

Choose a reason for hiding this comment

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

we can remove this

@betodealmeida betodealmeida merged commit 6b54591 into apache:master May 19, 2023
@betodealmeida betodealmeida deleted the database-registry branch May 19, 2023 00:00
betodealmeida added a commit to preset-io/superset that referenced this pull request May 19, 2023
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
Co-authored-by: Lily Kuang <lily@preset.io>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants