Skip to content

Warn users that they lose their query changes when exiting query builder #1278

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

Merged
merged 3 commits into from
Jul 21, 2022

Conversation

irisyngao
Copy link
Contributor

@irisyngao irisyngao commented Jul 8, 2022

Summary

Fixes #1274

  • Do not alert when exiting query builder opened by right-clicking a class
  • only alert users when there are changes in query builder opened from a mapping-test or service

How did you test this change?

  • Test(s) added
  • Manual testing (please provide screenshots/recordings)
  • No testing (please provide an explanation)
Screen.Recording.2022-07-12.at.9.47.36.AM.mov

@changeset-bot
Copy link

changeset-bot bot commented Jul 8, 2022

🦋 Changeset detected

Latest commit: d8fe08e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages
Name Type
@finos/legend-query Patch
@finos/legend-studio-extension-query-builder Patch
@finos/legend-graph Patch
@finos/legend-extension-dsl-data-space Patch
@finos/legend-query-app Patch
@finos/legend-studio-app Patch
@finos/legend-application Patch
@finos/legend-extension-dsl-diagram Patch
@finos/legend-extension-dsl-persistence Patch
@finos/legend-extension-dsl-text Patch
@finos/legend-extension-external-format-json-schema Patch
@finos/legend-extension-external-language-morphir Patch
@finos/legend-extension-external-store-service Patch
@finos/legend-extension-mapping-generation Patch
@finos/legend-graph-extension-collection Patch
@finos/legend-manual-tests Patch
@finos/legend-studio Patch
@finos/legend-taxonomy Patch
@finos/legend-query-deployment Patch
@finos/legend-studio-deployment Patch
@finos/legend-studio-extension-management-toolkit Patch
@finos/legend-taxonomy-app Patch
@finos/legend-taxonomy-deployment Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@irisyngao irisyngao force-pushed the warningPopup branch 3 times, most recently from d6fad7c to 9d78797 Compare July 11, 2022 20:22
@irisyngao irisyngao force-pushed the warningPopup branch 3 times, most recently from 0154381 to 1ed14c5 Compare July 12, 2022 13:53
Copy link
Member

@MauricioUyaguari MauricioUyaguari left a comment

Choose a reason for hiding this comment

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

seems like we have not thought about a couple of things:

Do we want to initialize every query with change detection? Should it be part of the options when you initiate query builder (enableSoftChangeDetection)?

Additionally, I don't think you handle when the user saves the query and then clicks exist. Are you updating the hashLambda when a user has hit save?

@irisyngao
Copy link
Contributor Author

irisyngao commented Jul 12, 2022

  1. Do we want to initialize every query with change detection? Should it be part of the options when you initiate query builder (enableSoftChangeDetection)?

    For the query builder opened by right-clicking a class, there is no alert anyhow. To achieve this, I default values of QueryBuilderChangeDetectionState.
    
  2. Additionally, I don't think you handle when the user saves the query and then clicks exist. Are you updating the hashLambda when a user has hit save?

    hashLambda is not updated when a user hits save but it will be updated every time they reopen the query builder.
    

@MauricioUyaguari
Copy link
Member

  1. Do we want to initialize every query with change detection? Should it be part of the options when you initiate query builder (enableSoftChangeDetection)?
    For the query builder opened by right-clicking a class, there is no alert anyhow. To achieve this, I default values of QueryBuilderChangeDetectionState.
    
  2. Additionally, I don't think you handle when the user saves the query and then clicks exist. Are you updating the hashLambda when a user has hit save?
    hashLambda is not updated when a user hits save but it will be updated every time they reopen the query builder.
    
  1. makes sense.
  2. I think we need this, couldnt we add this in the save actions the user does? @akphi what do you think

@irisyngao irisyngao force-pushed the warningPopup branch 3 times, most recently from a761daa to b6e1ec9 Compare July 13, 2022 20:20
@akphi
Copy link
Contributor

akphi commented Jul 17, 2022

I think we need this, couldnt we add this in the save actions the user does? @akphi what do you think

Yes, this makes sense, and I totally missed this case. Thanks @MauricioUyaguari

@irisyngao
Copy link
Contributor Author

I think we need this, couldnt we add this in the save actions the user does? @akphi what do you think

Yes, this makes sense, and I totally missed this case. Thanks @MauricioUyaguari

I don't think it bothers us because queryBuilder will be reset(queryBuilderExtension.reset()) every time we click the edit icon. It means even though I save the latest lambda, it will be reset to initial value first then be updated based on latest query when we reopen the query builder.

@MauricioUyaguari
Copy link
Member

MauricioUyaguari commented Jul 18, 2022

I think we need this, couldnt we add this in the save actions the user does? @akphi what do you think

Yes, this makes sense, and I totally missed this case. Thanks @MauricioUyaguari

I don't think it bothers us because queryBuilder will be reset(queryBuilderExtension.reset()) every time we click the edit icon. It means even though I save the latest lambda, it will be reset to initial value first then be updated based on latest query when we reopen the query builder.

Yes, the case I'm talking about is when you hit save and the user hits exit, won't we still show this warning? I would expect that during saving we update the lambdaHash

@akphi
Copy link
Contributor

akphi commented Jul 18, 2022

@YannanGao-gs you are relying on the implementation of the save action here, and now since this is a state in QueryBuilderState, it should be considered in a more generic fashion. For example, we need to think how this can work with standalone query builder. But I think for now, this will do, we can leave this be the way you have it

@akphi
Copy link
Contributor

akphi commented Jul 18, 2022

Yes, the case I'm talking about is when you hit save and the user hits exit, won't we still show this warning? I would expect that during saving we update the lambdaHash

Hm, I think right now, when we hit Save Query or so, we also close the embedded query builder modal

@irisyngao
Copy link
Contributor Author

I think we need this, couldnt we add this in the save actions the user does? @akphi what do you think

Yes, this makes sense, and I totally missed this case. Thanks @MauricioUyaguari

I don't think it bothers us because queryBuilder will be reset(queryBuilderExtension.reset()) every time we click the edit icon. It means even though I save the latest lambda, it will be reset to initial value first then be updated based on latest query when we reopen the query builder.

Yes, the case I'm talking about is when you hit save and the user hits exit, won't we still show this warning? I would expect that during saving we update the lambdaHash

The behaviors are

  • Do not alert any when exiting query builder opened by right-clicking a class
  • No alerts when clicking save(no difference from the original behavior)
  • only alert users when there are changes in query builder opened from a mapping-test or service and they hit exit button

@irisyngao irisyngao force-pushed the warningPopup branch 2 times, most recently from c88e8ab to e737562 Compare July 19, 2022 21:55
@codecov
Copy link

codecov bot commented Jul 19, 2022

Codecov Report

Merging #1278 (d8fe08e) into master (9c55014) will increase coverage by 0.14%.
The diff coverage is 37.03%.

@@            Coverage Diff             @@
##           master    #1278      +/-   ##
==========================================
+ Coverage   41.56%   41.70%   +0.14%     
==========================================
  Files        1157     1181      +24     
  Lines       52533    52507      -26     
  Branches    11971    11890      -81     
==========================================
+ Hits        21836    21900      +64     
+ Misses      30630    30539      -91     
- Partials       67       68       +1     
Impacted Files Coverage Δ
...graph/src/graphManager/AbstractPureGraphManager.ts 40.00% <ø> (-20.00%) ⬇️
...rc/models/protocols/pure/v1/V1_PureGraphManager.ts 53.58% <0.00%> (-0.20%) ⬇️
...h/src/models/protocols/pure/v1/engine/V1_Engine.ts 14.35% <0.00%> (ø)
...es/legend-query/src/stores/QueryTextEditorState.ts 25.00% <ø> (ø)
...ry-builder/src/components/EmbeddedQueryBuilder.tsx 67.85% <28.57%> (-13.10%) ⬇️
...kages/legend-query/src/stores/QueryBuilderState.ts 61.03% <33.33%> (-0.90%) ⬇️
...er/src/components/MappingExecutionQueryBuilder.tsx 68.57% <66.66%> (-0.18%) ⬇️
...builder/src/components/MappingTestQueryBuilder.tsx 70.96% <66.66%> (-0.47%) ⬇️
...ery-builder/src/components/ServiceQueryBuilder.tsx 72.50% <66.66%> (-0.48%) ⬇️
...engine/service/V1_DEPRECATED__ServiceTestResult.ts 0.00% <0.00%> (-100.00%) ⬇️
... and 249 more

@irisyngao irisyngao marked this pull request as draft July 20, 2022 15:36
@irisyngao irisyngao force-pushed the warningPopup branch 2 times, most recently from abc0b6e to 0b7d879 Compare July 20, 2022 18:50
@irisyngao irisyngao force-pushed the warningPopup branch 2 times, most recently from 2e3f07c to aabba13 Compare July 20, 2022 21:34
@akphi akphi marked this pull request as ready for review July 20, 2022 21:57
akphi
akphi previously approved these changes Jul 20, 2022
@akphi akphi merged commit 8d17d39 into finos:master Jul 21, 2022
@akphi akphi deleted the warningPopup branch July 21, 2022 01:56
jinanisha pushed a commit to jinanisha/legend-studio that referenced this pull request Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-present CLA Signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Warn users that they lose their query changes when exiting query builder
3 participants