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

CodeQL model editor: support saving single/selected models #3156

Merged
merged 8 commits into from
Jan 15, 2024

Conversation

shati-patel
Copy link
Contributor

@shati-patel shati-patel commented Dec 19, 2023

Adds the ability to click specific rows in the model editor, and just save those instead of the entire library/model. See internal linked issue for more details. (Paired with @robertbrignull 🍐)

Probably easiest to review commit-by-commit, since there's quite a bit of boilerplate.

📹 Demo

save-selected-methods.mp4

📝 Notes

I'm opening the PR now to get some general feedback on the approach, since we can change the styling more easily. I already have a few concerns/questions:

  • The "focused" property (from clicking "Review in editor") also temporarily highlights a row (until you click away). I've changed the "focused" background colour to an orange-y thing, but it might still be confusing:

    focus-on-method-row.mp4
  • I wonder if changing the background colour is obvious enough as a way to select a row. Perhaps an icon or text is more intuitive? 🤔

  • When you click anywhere in the method row (including on "View" or any of the dropdowns), it also selects/deselects the method row. Perhaps we can make just the method name clickable? 🤔 (How would that work?)

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.
    • A docs update will probably be helpful. I'll hold off until we confirm the exact behaviour! Not needed for now

@shati-patel shati-patel marked this pull request as ready for review December 19, 2023 13:41
@shati-patel shati-patel requested review from a team as code owners December 19, 2023 13:41
Copy link
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

The code changes all look fine to me. When trying it out I did find it a little confusing to use, so I wonder if we should spend more time thinking about UX and get input from Asier before merging 🤔. I'm definitely feeling underqualified to say yes this is good to ship.

I wonder if changing the background colour is obvious enough as a way to select a row. Perhaps an icon or text is more intuitive? 🤔

I agree I'm not sure if it's obvious enough right now. But maybe it'll become more obvious if other bits of the UI mentioning selections are changing when you click on rows.

When you click anywhere in the method row (including on "View" or any of the dropdowns), it also selects/deselects the method row. Perhaps we can make just the method name clickable? 🤔 (How would that work?)

I also found this annoying. Particularly when using the dropdowns to edit a modeling it counts as "clicking on the row" and makes it selected or unselected. We can fix this particular behaviour with the dropdowns by calling event.preventDefault() in the on-click handlers of the dropdowns.

The "focused" property (from clicking "Review in editor") also temporarily highlights a row (until you click away). I've changed the "focused" background colour to an orange-y thing, but it might still be confusing:

Another data point is, because both "focussed" and "selected" work by changing the background colour, you can't tell if both are active. So after focussing a row it's unclear what would be saved at that moment.


Another thought I had was when using I wanted a way to "deselect all". Would it be helpful to add a button for this, maybe in the top-bar or in each section?
Also what do you think about deselecting everything after saving?

extensions/ql-vscode/CHANGELOG.md Outdated Show resolved Hide resolved
@shati-patel
Copy link
Contributor Author

The code changes all look fine to me. When trying it out I did find it a little confusing to use, so I wonder if we should spend more time thinking about UX and get input from Asier before merging 🤔. I'm definitely feeling underqualified to say yes this is good to ship.

Thanks for the review! And yes, don't worry, I don't intend to merge this until the UI is sorted out 😅 I've asked internally for design improvements 🎨

I also found this annoying. Particularly when using the dropdowns to edit a modeling it counts as "clicking on the row" and makes it selected or unselected. We can fix this particular behaviour with the dropdowns by calling event.preventDefault() in the on-click handlers of the dropdowns.

I haven't been able to do this yet 🤔 I'll poke around a bit, but might need some more help 🙇🏽‍♀️

Another thought I had was when using I wanted a way to "deselect all". Would it be helpful to add a button for this, maybe in the top-bar or in each section?
Also what do you think about deselecting everything after saving?

Both seem reasonable! I'll have a go at this too 🙌🏽

@shati-patel shati-patel marked this pull request as draft January 4, 2024 16:49
@shati-patel
Copy link
Contributor Author

  • Fixed the bug where clicking on a button or dropdown (de)selected a row

  • Added a button to deselect all rows:

    F564A787-8462-42EE-8E44-38A3BAA9A2B8.MP4

@shati-patel shati-patel marked this pull request as ready for review January 15, 2024 10:44
@shati-patel
Copy link
Contributor Author

Having discussed with @jf205, this is good to ship from a product point of view (and we can improve on the design over time). See internal linked issue.

Could I get a final review? 🙏🏽

Copy link
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

One observation that we can leave for a followup. Otherwise everything looks great.

inProgressMethods={inProgressMethods}
viewState={viewState}
hideModeledMethods={hideModeledMethods}
revealedMethodSignature={revealedMethodSignature}
onChange={onChange}
onMethodClick={onMethodClick}
/>
<SectionDivider />
<ButtonsContainer>
<VSCodeButton onClick={handleSave} disabled={!hasUnsavedChanges}>
Copy link
Contributor

Choose a reason for hiding this comment

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

I spotted one odd piece of UI behaviour. If you have unsaved changes then the button will be enabled, but it could be that you haven't selected methods with unsaved changes, so pressing the button does nothing. It could be better if the button only became enabled when there were unsaved changes in the selected methods.

However I suggest we can leave this as a followup, since I believe we're expecting to do a design pass on this at some point anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review! That's a good point 🦅 👀

But I also agree that it can be a follow-up change instead, along with any other design/user feedback!

@shati-patel shati-patel merged commit 281f8ee into main Jan 15, 2024
25 checks passed
@shati-patel shati-patel deleted the shati-patel/select-methods branch January 15, 2024 16:51
@github github deleted a comment Feb 13, 2024
@github github deleted a comment Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants