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(schema): add schema export modal, feature flag gated COMPASS-8703 #6668

Merged
merged 7 commits into from
Feb 12, 2025

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Jan 30, 2025

COMPASS-8703

This needs some of the schema formatting work to be in first before we can open the pr. Keeping it in draft with a few TODOs until then. Once that's in I'll open it for reviews.

Screenshots Screenshot 2025-01-30 at 2 30 39 PM Screenshot 2025-01-30 at 12 42 25 PM Screenshot 2025-01-30 at 2 17 24 PM Screenshot 2025-01-30 at 2 32 12 PM Screenshot 2025-01-30 at 2 31 00 PM

@Anemy Anemy added feature flagged PRs labeled with this label will not be included in the release notes of the next release no release notes Fix or feature not for release notes labels Jan 30, 2025
@github-actions github-actions bot added the feat label Jan 30, 2025
@paula-stacho
Copy link
Contributor

This will probably become obvious once you format the json with spaces, but we'll need to add some styles so that scrolling is limited to the block and header + buttons stay fixed.

@Anemy Anemy marked this pull request as ready for review February 11, 2025 01:38
schemaAccessor: SchemaAccessor;
signal: AbortSignal;
}): Promise<string> {
// TODO: Use the signal once we pull in the schema accessor type changes.
Copy link
Member Author

Choose a reason for hiding this comment

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

| 'legacyJSON';
export type ExportStatus = 'inprogress' | 'complete' | 'error';
export type SchemaExportState = {
abortController?: AbortController;
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: we have the abortController for schema analysis on the store level, this might get confusing

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice callout! Why do we have it on the store level? I'm thinking we update them to be aligned as both on the store or both in their reducer's states. Maybe not something that has to block this pr so we can unblock other things.

Copy link
Contributor

@paula-stacho paula-stacho Feb 11, 2025

Choose a reason for hiding this comment

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

I have a memory that this was asked by @gribnoysup and that it was how we dealt with abort controllers elsewhere, but a quick look supports neither of those, so I must've dreamt it 🙈

Copy link
Collaborator

Choose a reason for hiding this comment

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

You haven't dreamt it, this is not state, non-serializeable things shouldn't be in the store. In this store we pass abort controller for schema analysis through thunk already, in indexes we pass similarly non-state interval ids through thunk if you need some references in other plugins:

Copy link
Member Author

Choose a reason for hiding this comment

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

Good callout, thanks y'all. Updated in #6717

@Anemy Anemy requested a review from paula-stacho February 11, 2025 16:34
describe('with the enableExportSchema feature flag enabled', function () {
beforeEach(async function () {
// TODO(COMPASS-8819): remove web skip when defaulted true.
skipForWeb(this, "can't toggle features in compass-web");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmmm, I think you added support for this in #6547 already so you should be able to toggle it

) => {
const queryBarProps = {};
render(
<PreferencesProvider value={preferences}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

render method accepts default preferences and returns preferences with the rendering result, you don't need that extra setup here: https://github.com/mongodb-js/compass/blob/main/configs/testing-library-compass/README.md#render--renderwithconnections

analysisState: AnalysisState;
errorMessage: string;
schema: Schema | null;
schemaAccessor: SchemaAccessor | null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not state either, this is really way closer to service that should be passed through thunk argument. I linked one example for this in another place, for this one I guess it would be closer to PipelineBuilder in compass-aggregations plugin, it's just a service thats' relevant only for this plugin and we want to use in various actions

@paula-stacho paula-stacho merged commit 8764cd8 into main Feb 12, 2025
34 checks passed
@paula-stacho paula-stacho deleted the COMPASS-8703 branch February 12, 2025 10:06
@gribnoysup
Copy link
Collaborator

Are we going to follow up with store clean-up for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat feature flagged PRs labeled with this label will not be included in the release notes of the next release no release notes Fix or feature not for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants