-
Notifications
You must be signed in to change notification settings - Fork 6
Disabled 'Running...' button while query running #106
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
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #106 +/- ##
===========================================
+ Coverage 94.16% 94.64% +0.48%
===========================================
Files 42 43 +1
Lines 1079 1288 +209
Branches 228 274 +46
===========================================
+ Hits 1016 1219 +203
- Misses 61 67 +6
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
packages/soql-builder-ui/src/modules/querybuilder/app/app.test.ts
Outdated
Show resolved
Hide resolved
| postMessageFromVSCode({ | ||
| type: MessageType.RUN_SOQL_QUERY_DONE | ||
| }); | ||
| expect(runStateObserver.mock.calls.length).toBe(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this 2 because behavior subject gets an immediate callback with the current value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
| private localStorage = getLocalStorage(); | ||
| postMessage(messageObj) { | ||
| this.window.parent.postMessage(messageObj, '*'); | ||
| if (messageObj.type === MessageType.RUN_SOQL_QUERY) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we actually do the full round trip across an iframe using this development repo that behaves like vscode. So you can just recieve the message there and respond using a timeout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah cool. I've moved it to the tool in this https://github.com/forcedotcom/soql-tooling-standalone/pull/3 and removed from this PR with the Move standalone run query response to standalone tool commit.
dehru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This UX has bugged me since the start. Great to get this in. I had one comment about the setTimeout to mock the response. Let's move that to the standalone server repo. So you can literally just remove that whole mocking of the response from this PR.
jonnyhork
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for the most part, nice and simple. Just a few comments on the CSS and how we want to approach JS/CSS overall in the UI.
| button:disabled { | ||
| color: var(--vscode-foreground, var(--soql-foreground)); | ||
| background-color: var( | ||
| --vscode-list-inactiveSelectionBackground, | ||
| var(--soql-color-light-grey) | ||
| ); | ||
| cursor: default; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have also created a btn--disabled class for the where component which is "hidden" in the feature/where branch, hopefully we won't miss things too much when working off develop.
I would like to keep some consistency throughout the extension if we can. So I think we should have one CSS class for disabled buttons in the CSS Common here that used for both features. I'm not sure what the best way to approach that is between the branches.
I took a slightly different approach to disabling the button and did not use a pseudo class.
I also chose a darker grey for more contrast with the white text but that might be theme dependant, etc
I can't find any info on whether its better( or matters) to use the disabled attribute vs using CSS to render the button disabled. Our choice will determine the JS we use to toggle attributes/class though.
For example this method would toggle disabled instead returning the classlist.
@dehru or @jgellin-sf Do you have a preference on what approach we take? Either way I think we should be consistant with how we handle these types of behaviors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of JS ease of use, I think it's probably better to handle disabled button just using CSS as you have done rather than with the attribute. Then it's treated as just another class and not this special case.
I agree it shoud be handled consistently in the CSS common. I see in the where branch the CSS def is in where.css. Maybe you can move it to CSS common and we can merge the WHERE stuff, then I'll change to that class when I rebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, well my branch is already merged to feature/where but I can create a new PR to move the class to CSS Common, is that what you were thinking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jgellin-sf I created and merged #108 to the feature/where for your pleasure.
| <template if:false={isRunning}> | ||
| <button class="run-button" onclick={handleRunQuery}>Run Query</button> | ||
| </template> | ||
| <template if:true={isRunning}> | ||
| <button class="running-button" disabled>Running...</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to do this without two templates is by making the text of the button dynamic like we do with the fields throughout the UI.
return this.isLoading ? 'Loading...' : 'Select Field...';In this case, if we did not use the templates, the classes and the disabled would require some JS and I think would be more work without that much benefit other than consistency I guess.
I do not see the class running-button in the CSS though are you still using it?
I probably would have used a different class name than run-button if I did this again, I'm trying out this whole BEM thing for new work.
For example:
header__button--run /* or ready, enabled */
header__button--running /* disabled */
header__button-run--enabled
header__button-run--disabledI am still getting used to it but the idea is to be consistant and predictable with our class names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually for BEM naming I don't think we include the header part... but same idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out I wasn't styling run-button or running-button so I've removed those from the template in the Remove un-styled classes commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops acted too fast. run-button is used in the test code. Restored now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's relevant as we have discussed moving away ( slowly ) from using css classes as selectors in testing code, because it's often not apparent that the class is for testing vs styling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with moving that direction
* model WHERE clause (#68) * Remote SOQL Errors - Language Server Part (#93) * remove code builder (#92) * Move from antlr4JS to antlr4TS (#96) * SOQL code completion for SELECT fields (#99) * publish language server 0.2.9 (#102) * Fix LSP dependency (#104) * Disabled 'Running...' button while query running (#106) * Add basic code-completion for ORDER BY and other improvements (#107) * Dehru and JG telemetry - Send GDPR clean data to telemetry when errors/unsupported syntax present (#110) * Disable WHERE in model (#113) * Bump versions for publishing (#114) * Code-completion for WHERE clause expressions (#112) Co-authored-by: Jonathan Gellin <jgellin@salesforce.com> Co-authored-by: jgellin-sf <55159130+jgellin-sf@users.noreply.github.com> Co-authored-by: Chase McCarthy <charles.mccarthy@heroku.com> Co-authored-by: Jonny Hork <jhork@salesforce.com> Co-authored-by: Fernando Dobladez <fernandodobladez@salesforce.com> Co-authored-by: Jonathan Gellin <jgellin@salesforce.com>
What does this PR do?
This PR provides the SOQL Builder UI-side function for indication that a query is running. When the

Run Querybutton is pressed, the button is transformed into a disabledRunning...button, and remains so until VSCode sends therun_query_donemessage.What issues does this PR fix or reference?
@W-8207738@