-
Notifications
You must be signed in to change notification settings - Fork 814
Prototyping User Table Design Updates #13808
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
base: develop
Are you sure you want to change the base?
Prototyping User Table Design Updates #13808
Conversation
Build Artifacts
|
3b76d19
to
df13990
Compare
67a40dc
to
35548a5
Compare
</KGrid> | ||
|
||
<div class="flex-column"> | ||
<div class="flex-column table-content"> |
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 whole component may no longer be necessary as the business logic has been extracted to just be a kind of widget in PaginationActions.vue
that can be slapped anywhere with the given props and will handle the pagination buttons/messaging w/out the opinionated layout enforced.
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.
Seems like with the new changes this component is no longer necessary yes, or at least it should be renamed in the scope of this PR so we can avoid future confusions.
bb6e723
to
082c044
Compare
- Created useUsersTableSearch composable for search/query handling - Created usePagination composable for pagination state management - Refactored UsersTableToolbar to be a pure layout component - Updated UsersRootPage to use new composables - Integrated PaginationActions component for consistent pagination UI - Cleaned up UsersTable component to remove duplicated logic This refactoring improves maintainability by: - Encapsulating search and pagination logic in reusable composables - Following Vue 2 Composition API patterns used in the codebase - Creating clear separation of concerns between components - Providing flexible two-row layout structure for toolbar actions Initial Claude Prompt: 1) Get a sense of the files I've been working on based on my last git commit and current unstaged changes. 2) Review those changes to get a sense of how the code is structured. 3) The kolibri/plugins/facility/assets/src/views/users/common/UsersTableToolbar.vue and the packages/kolibri-common/components/PaginatedListContainer.vue components have some logic too tightly couple to their scope and aren't used in a way that makes it easy to, for example, know what page we're on. Also, the "query/search" handling in the overall changes I've made reflects to me something that would be easier to use if it were encapsulated somehow, such as into its own composable module. (NOTE: look at files use*.js in the codebase for an example of how we use the Composition API modules in Vue 2). In any case - the changes I'm working on are to rearrange some of the actions that we've put onto the screen. The #topRow and #bottomRow slots in packages/kolibri-common/components/PaginatedListContainerWithBackend.vue demonstrate at least the overall layout I want - basically I need two rows in a flex container (column dir) which each can then have their own flexbox divs w/ their own layout of actions within them and I need to be able to put the Options dropdown, New User button, FilterTextbox (and friends), the "7 users selected" message w/ appropriate count variable passed for the number, and the pagination buttons & messaging all in the same place. 4) Please proceed to make changes to the code base updating it per what I've said here. Ask any questions you have as you proceed. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…tContainerWithbackend
082c044
to
4503c23
Compare
<PaginationActions | ||
v-model="currentPage" | ||
class="top-pagination-actions" | ||
:itemsPerPage="itemsPerPage" | ||
:totalPageNumber="totalPageNumber" | ||
:numFilteredItems="downloadItemListLength" | ||
> | ||
/> |
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.
Are we sure we want to change the pagination layout for all pages? 👀 (Seems like a non-trivial design change so just flagging it for all relevant people to aggree/be informed)
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.
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.
Having it top & bottom made more sense when I had a full page of downloads and had to scroll 30 of them to the bottom but when it's empty like that it looks goofy 😅 - I've reverted it to the original.
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.
Thanks @nucleogenesis! Just a few comments I noticed in a first read through
const getEmptyMessageForItems = items => { | ||
const search = route.query.search || ''; | ||
const roleType = route.query.user_type; |
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.
Just noting that the user_type
query does not exists, it is called user_types
and is a list: https://github.com/nucleogenesis/kolibri/blob/5c5cc1e962c53b701c5c6eea68cc188de034a0f5/kolibri/plugins/facility/assets/src/composables/useUsersFilters.js#L146
} | ||
/deep/ .pagination-nav { | ||
/deep/ .pagination-nav { |
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.
Are these styles being applied somewhere? Im not finding annidated pagination-nav classes.
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.
Nope - removed.
/deep/ .k-table-wrapper { | ||
// Applying the padding here avoids the scrollbar having padding | ||
// between itself and the window's edge and floating. This way | ||
// it looks like a root-level scrollbar (even though there isn't one) | ||
padding: 0 1em; | ||
} |
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.
Does this still applies? I see the k-table-wrapper
node is the root node of KTable
so any overrides to it we can just pass them as style prop.
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 updated this a bit - give it a look. I think we may need a follow-up issue for reviewing how/where we're putting the scrollbar because that's the main cause for the styles put here. I did it /deep/ instead of inline for the room for comments to explain why it's like this.
.top-row { | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 1em; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
.bottom-row { | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 1em; | ||
align-items: center; | ||
justify-content: space-between; |
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.
Seems like both of them have the same styles. We can probably do something like .top-row, .bottom-row { ...
margin: '0 auto', | ||
padding: '2em', | ||
width: '100%', | ||
height: '100vh', |
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.
Just noting that vh
is not a reliable metric for mobile devices https://stackoverflow.com/questions/37112218/css3-100vh-not-constant-in-mobile-browser
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.
Thank you! Using % works just as well here - I just like the mental idea of vh more than thinking about what the % is possibly relative to 😅
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.
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.
Fixed, thanks!
.top-pagination-actions { | ||
margin-top: 1em; | ||
margin-bottom: -2em; |
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 is usually a code smell to set a negative margin, just flagging it in case there is other way to achieve the behaviour we want to achieve with this negative marging?
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 almost left a comment admitting this was smelly above the line 😆
Basically the issue is that there is more space in the headings of the table than I'd like so rather than going through the trouble of tweaking the table itself I used the neg margin.
I'll came back w/ a comment added here explaining why it's like this.
</KGrid> | ||
|
||
<div class="flex-column"> | ||
<div class="flex-column table-content"> |
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.
Seems like with the new changes this component is no longer necessary yes, or at least it should be renamed in the scope of this PR so we can avoid future confusions.
methods: { | ||
changePage(change) { | ||
// Clamp the newPage number between the bounds if browser doesn't correctly | ||
// disable buttons (see #6454 issue with old versions of MS Edge) | ||
this.$emit('input', clamp(this.value + change, 1, this.totalPageNumber)); | ||
}, | ||
}, | ||
methods: { | ||
changePage(change) { | ||
// Clamp the newPage number between the bounds if browser doesn't correctly | ||
// disable buttons (see #6454 issue with old versions of MS Edge) | ||
this.$emit('input', clamp(this.value + change, 1, this.totalPageNumber)); | ||
}, | ||
}, |
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.
There is a duplicated methods object here.
computed: { | ||
startRange() { | ||
return (this.value - 1) * this.itemsPerPage; | ||
}, | ||
visibleStartRange() { | ||
return Math.min(this.startRange + 1, this.numFilteredItems); | ||
}, | ||
endRange() { | ||
return this.value * this.itemsPerPage; | ||
}, | ||
visibleEndRange() { | ||
return Math.min(this.endRange, this.numFilteredItems); | ||
}, | ||
previousButtonDisabled() { | ||
return this.value === 1 || this.numFilteredItems === 0; | ||
}, | ||
nextButtonDisabled() { | ||
return ( | ||
this.totalPageNumber === 1 || | ||
this.value === this.totalPageNumber || | ||
this.numFilteredItems === 0 | ||
); | ||
}, | ||
}, | ||
methods: { | ||
changePage(change) { | ||
// Clamp the newPage number between the bounds if browser doesn't correctly | ||
// disable buttons (see #6454 issue with old versions of MS Edge) | ||
this.$emit('input', clamp(this.value + change, 1, this.totalPageNumber)); | ||
}, | ||
}, | ||
methods: { | ||
changePage(change) { | ||
// Clamp the newPage number between the bounds if browser doesn't correctly | ||
// disable buttons (see #6454 issue with old versions of MS Edge) | ||
this.$emit('input', clamp(this.value + change, 1, this.totalPageNumber)); | ||
}, | ||
}, |
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.
Seems like all of these properties/methods are duplicated from the new usePagination
is this intentional?
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.
Thanks for catching this <3
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 - it's that the usePagination
is in the scope of Facility and I didn't feel confident yet putting it into the kolibri-common
package yet. The usePagination
module's return values are then passed into PaginationActions
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.
Maybe we should make an issue re: following-up on possibly generalizing the usePagination.js though
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.
Sounds good! 😃
NOTE: This will likely all be overwritten in a future issue once the text is discussed in more detail
llm disclosure: portions of these changes made w/ help of Claude code
5c5cc1e
to
6767f8e
Compare
disclosure: this commit was made with assistance from Claude code
81606c6
to
7c4a3fa
Compare
…n padding calculations; also set max-height for table to pageContentHeight to accommodate appContext
Hi @nucleogenesis as always here is a list with testing notes and observations for the issues I was able to identify today, and the testing will continue tomorrow as well:
![]()
small.screens.mp4
![]()
removed.users.resp.design.mp4
overlap.mp4
horizontal.scroll.mp4
|
@pcenov I've updated the PR to address the following:
The following we'll address separately:
|
Hi @nucleogenesis, Testing notes on the fixed items:
New issues:
tooltips.mp4
search.field.disappears.mp4
search.field.size.mp4
![]()
small.devices.mp4 |
Summary
Major Changes
References
Touches #13782 , follows up from #13743
Reviewer guidance
QA
There are no specific Figma references for these updates to reference.
Users Root Table, New Users Table, Deleted Users Table
All of these pages have had similar changes performed on them and there is significant change for regression - so please check the following:
Root Table Specific
Android & App mode
Test that all content and data is visible when in app mode (where there is a bottom actions bar).
My Downloads
Check this page for regressions, particularly around pagination.
Classes -> Class Details -> Enroll learners
This page also has had some updates to the pagination and should be tested for regressions with a focus on pagination