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

[Browser] Reorder the buttons position in the Browser SQL editor and only execute the selected SQL text #57211

Merged

Conversation

agiudiceandrea
Copy link
Contributor

@agiudiceandrea agiudiceandrea commented Apr 21, 2024

Description

This PR:

  • reorders the buttons position in the Browser SQL editor dialog window
  • allows to only execute the selected SQL text as using the DB Manger

Video_2024-04-24_072947


Old description
This PR:

  • swaps the "Execute" and "Clear" buttons position in the Browser SQL editor dialog window in order to make it more similar to the DB Manger SQL editor dialog window
    before
    image
    after
    image
    @gioman, is it OK for you?

  • allows to only execute the selected SQL text as using the DB Manger

Not sure if this should be considered a bug fix (and thus be backported) or a feature.

Fixes #57202.

PS: @DelazJ, it looks like a description of the Browser SQL editor dialog window is missing in the docs. Doesn't it?

@github-actions github-actions bot added this to the 3.38.0 milestone Apr 21, 2024
@agiudiceandrea agiudiceandrea changed the title [Browser] [Browser] Swap the "Execute" and "Clear" buttons position in the Browser SQL editor and only execute the selected SQL text Apr 21, 2024
@@ -172,7 +172,7 @@ void QgsQueryResultWidget::executeQuery()
cancelRunningQuery();
if ( mConnection )
{
const QString sql { mSqlEditor->text( ) };
const QString sql = mSqlEditor->selectedText().length() > 0 ? mSqlEditor->selectedText() : mSqlEditor->text();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've used selectedText().length() > 0 instead of hasSelectedText() after looking at c3d9f10 and https://issues.qgis.org/issues/12193. Maybe it is no longer needed now or not needed here...

@nyalldawson
Copy link
Collaborator

I can't find the discussion now, but I vaguely recall some past conversation where the "run only selected text" change was controversial. @elpaso does this ring any bells?

@elpaso
Copy link
Contributor

elpaso commented Apr 22, 2024

@agiudiceandrea for what it worth I think it is more intuitive having the execution related buttons grouped together (execute and stop) while the clear button is editing related, having the stop button right aside the execute button may also help in case a user wanted to quickly halt the execution right after pushing execute. But I have no strong opinions (in other words: I don't care).

@nyalldawson it does but I can't find the old discussion now.
About the "execute selected" IIRC the proposal was to make it explicit by adding an "Execute selected" button which is disabled if there is no selection. It would be even better if the SQL parser could detect a valid query before enabling the button (see: QgsSQLStatement).

@gioman
Copy link
Contributor

gioman commented Apr 22, 2024

@agiudiceandrea much better thanks! I don't have a string opinion in general too, but to stay consistent with DB manager is very important: I lost a complex query that took hours to refine because I hit "clear" instead of "execute" just because I'm used (we are) to how buttons are ordered in DB manager, and to find also that "undo" is not supported (I apologized for my harsh comment here #57202 (comment) but as you can imagine that was very very annoying to say the least).

@elpaso
Copy link
Contributor

elpaso commented Apr 22, 2024

@agiudiceandrea much better thanks! I don't have a string opinion in general too, but to stay consistent with DB manager is very important: I lost a complex query that took hours to refine because I hit "clear" instead of "execute" just because I'm used (we are) to how buttons are ordered in DB manager, and to find also that "undo" is not supported (I apologized for my harsh comment here #57202 (comment) but as you can imagine that was very very annoying to say the least).

While I can sympathize with you for your difficulties to adapt to a different interface, I don't think that copying the DB manager interface is a good enough strategy.
The question here is what makes more sense from a UX point of view (which may well be the DB-manager solution).

About the attitude, I strongly advice you to soften your tones: it is usually much more effective to use a gentle and polite approach when asking people to volunteer their time to do something for you.

@gioman
Copy link
Contributor

gioman commented Apr 22, 2024

I can't find the discussion now, but I vaguely recall some past conversation where the "run only selected text" change was controversial. @elpaso does this ring any bells?

I found strange to be controversial: I think is pretty common for final users (at least for me) to use the SQL console (any SQL console) as a place where to build by steps queries (plural) and not only where to run a final one written elsewhere. This makes really necessary the possibility to run just selected rows (as seen also in any other SQL console I have used like pgadmin4). A "execute only selected" would clearly address this but also maybe not necessary if we assume that running only selected rows is what anyone expects anyway.

@gioman
Copy link
Contributor

gioman commented Apr 22, 2024

About the attitude, I strongly advice you to soften your tones: it is usually much more effective to use a gentle and polite approach when asking people to volunteer their time to do something for you.

@elpaso I apologized before this reply from you, This was unnecessary as it was my comment. I know well how things work and you know I know. I was just irritated and I know you understand what I mean.

@DelazJ
Copy link
Contributor

DelazJ commented Apr 22, 2024

PS: @DelazJ, it looks like a description of the Browser SQL editor dialog window is missing in the docs. Doesn't it?

Indeed!

swaps the "Execute" and "Clear" buttons position in the Browser SQL editor dialog window in order to make it more similar to the DB Manger SQL editor dialog window

from developer guides

Keep harmful actions away from harmless ones: If you have actions for ‘delete’, ‘remove’ etc, try to impose adequate space between the harmful action and innocuous actions so that the users is less likely to inadvertently click on the harmful action.

and in this case I would consider "clear" button as a harmful button, compared to the others.

@gioman
Copy link
Contributor

gioman commented Apr 22, 2024

While I can sympathize with you for your difficulties to adapt to a different interface,

As a long time and heavy db manager user I have the execute button on the left imprinted in my brain, and probably I'm not alone.

I don't think that copying the DB manager interface is a good enough strategy.
The question here is what makes more sense from a UX point of view (which may well be the DB-manager solution).

Fair enough.

@agiudiceandrea
Copy link
Contributor Author

agiudiceandrea commented Apr 24, 2024

Thanks for all your comments and suggestions!
I've found the previous discussion at #55200.

I agree with @elpaso #57211 (comment) about the position of the "Stop" button and with @nyalldawson #55200 (comment) about the "Execute" / "Execute Selection" button.

Please see a PoC with the new behaviour and buttons design:
Video_2024-04-24_072947

I also agree with @Gustry suggestions in comment #55200 (comment).

@elpaso
Copy link
Contributor

elpaso commented Apr 26, 2024

Please see a PoC with the new behaviour and buttons design:

Looks good to me.

@Gustry
Copy link
Contributor

Gustry commented Apr 26, 2024

Thanks for check @agiudiceandrea

This POC looks good as well. It makes it clear.

Copy link

The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check

  • that all unit tests are passing

  • that all comments by reviewers have been addressed

  • that there is enough information for reviewers, in particular

    • link to any issues which this pull request fixes

    • add a description of workflows which this pull request fixes

    • add screenshots if applicable

  • that you have written unit tests where possible
    In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request.
    If there is no further activity on this pull request, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label May 11, 2024
@nyalldawson
Copy link
Collaborator

@agiudiceandrea the proof of concept looks good to me! Will you update this pr to match?

@github-actions github-actions bot removed the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label May 15, 2024
@agiudiceandrea agiudiceandrea force-pushed the fix-57202-browser-selected-sql branch from 114b496 to 89e89de Compare May 16, 2024 07:06
Copy link

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit 89e89de)

@agiudiceandrea agiudiceandrea changed the title [Browser] Swap the "Execute" and "Clear" buttons position in the Browser SQL editor and only execute the selected SQL text [Browser] Reorder the buttons position in the Browser SQL editor and only execute the selected SQL text May 16, 2024
@agiudiceandrea
Copy link
Contributor Author

@agiudiceandrea the proof of concept looks good to me! Will you update this pr to match?

I apologize for the delay. I've force-pushed the updates as in the PoC and I've also updated the PR title and description accordingly.

I've not implemented the suggestions made by @Gustry in comment #55200 (comment), since I've not found a not ugly way to make such behaviour clear in the GUI and I'm also not completely convinced it should be the correct behaviour (nor I'm convinced the current behaviour is totally correct).

@nyalldawson nyalldawson added the Freeze Exempt Feature Freeze exemption granted label May 17, 2024
@nyalldawson nyalldawson merged commit bde598a into qgis:master May 22, 2024
31 checks passed
@agiudiceandrea agiudiceandrea deleted the fix-57202-browser-selected-sql branch May 22, 2024 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Freeze Exempt Feature Freeze exemption granted
Projects
None yet
6 participants