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

Add public toggle to permissions modal #144

Merged
merged 8 commits into from
Nov 6, 2023

Conversation

norrisng-bc
Copy link
Contributor

@norrisng-bc norrisng-bc commented Nov 3, 2023

Description

This PR makes the following UX improvements to the object permissions modal, as originally identified in SHOWCASE-3331:

  • New public toggle, in addition to the existing (identical) toggle in the object table
  • New "user permissions" heading above the "add user" button
  • Rewording of text hint for the user search box, to avoid confusion between the username and user's name

A bugfix on /app/.gitignore incorrectly ignoring package-lock.json (unrelated to the Jira ticket) has also been slipstreamed in.

https://apps.nrs.gov.bc.ca/int/jira/browse/SHOWCASE-3366

Types of changes

Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING doc
  • I have checked that unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Screenshots

  • Object permissions modal:

    object-permissions
  • Object permissions modal, after clicking "Add user":

    object-permissions-add-user

Copy link

github-actions bot commented Nov 3, 2023

Coverage Report (Application)

Totals Coverage
Statements: 70.67% ( 53 / 75 )
Methods: 62.5% ( 5 / 8 )
Lines: 81.63% ( 40 / 49 )
Branches: 44.44% ( 8 / 18 )

Copy link

github-actions bot commented Nov 3, 2023

Coverage Report (Frontend)

Totals Coverage
Statements: 35.98% ( 625 / 1737 )
Methods: 34.64% ( 133 / 384 )
Lines: 43.25% ( 439 / 1015 )
Branches: 15.68% ( 53 / 338 )

<h3 class="pb-1">Public</h3>
<ul>
<li>This option toggles the file to be publicly available and accessible to anyone</li>
<li>To instead set explicit permissions, add users and use the options below</li>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this?

To set explicit permission instead, add users and use the options below

Or this for a more active tone

Add users and use the options below to set explicit permissions instead

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 went with the wording in the screenshots in the original user research ticket (SHOWCASE-3331). Might want to check in with Tyler on that one.

Comment on lines 92 to 94
<div class="ml-4">
<ObjectPublicToggle
v-if="object && getUserId"
Copy link
Member

Choose a reason for hiding this comment

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

Do we need the extra div levels or can this still work with the class applied to the ObjectPublicToggle component directly?

Comment on lines 103 to 105
<div class="mt-1 mb-2">
<h3>User Permissions</h3>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

Might be able to get away with just an h3 with class attribute and not require the div wrapper?

Comment on lines 77 to 79
.p-dropdown.usersearch {
width: 100% !important
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary. You can use locally scoped css in SearchUsers.vue.

@@ -208,6 +208,8 @@ export const useObjectStore = defineStore('object', () => {
try {
appStore.beginIndeterminateLoading();
await objectService.togglePublic(objectId, isPublic);
const obj = findObjectById(objectId);
if (obj) obj.public = isPublic;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these two new lines doing anything?
was the intention to update the store. eg: if (obj) state.objects.value.find((x) => x.id === objectId).public = isPublic

Copy link
Contributor

@kyle1morel kyle1morel Nov 6, 2023

Choose a reason for hiding this comment

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

Yes we need to update the store here so the new value is reflected elsewhere. Would prefer to leave this using findObjectById() in the event we change up how we are looking up objects. Less things to track down and update.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh ok. i didnt know you could update the store like this

norrisng-bc and others added 8 commits November 6, 2023 14:44
The updated dropdown hint is longer than before, so it doesn't fully display. The dropdown was therefore widened so that it shows the entire hint, filling the whitespace between it and the "Add" button.
Added "User Permissions" heading in the permissions modal, right above the "Add user" button.
Also: tweak spacing for "Public" heading and corresponding toggle
In 60c2bad, the user search dropdown was widened to fill the width of the modal - this was achieved using !important in the Primevue stylesheet.
This has been moved to a locally scoped style inside SearchUsers.vue instead, eliminating the need for !important.
@norrisng-bc norrisng-bc force-pushed the public-toggle-inside-permissions branch from 643fc3d to f692250 Compare November 6, 2023 22:44
@TimCsaky TimCsaky merged commit 45a0aa0 into master Nov 6, 2023
@TimCsaky TimCsaky deleted the public-toggle-inside-permissions branch November 6, 2023 23:04
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.

4 participants