-
Notifications
You must be signed in to change notification settings - Fork 14
[OGUI-1853] Move actionables of objectTree in the table header #3247
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
Open
AlexJanson
wants to merge
24
commits into
dev
Choose a base branch
from
improv/QCG/OGUI-1853/move-tree-actionables-to-table-header
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
73e2d60
feat: add search bar to the table header of the object tree page
AlexJanson c4b9b58
feat: add the collapse all button to the table header
AlexJanson 1b8eeab
feat: add reusable component for adding table sort buttons
AlexJanson 4273674
feat: add more margin on the sort direction icon
AlexJanson fc4452f
feat: add sortable column to virtual table
AlexJanson 4b06d78
style: fix linting errors
AlexJanson 5078fd9
feat: add hover title text to sort button
AlexJanson 8c9450f
test: fix object tree tests
AlexJanson 9c4bf1a
fix: dom node errors when rerendering
AlexJanson b43ad11
test: fix failing tests due to changes
AlexJanson ee02932
style: fix linting errors
AlexJanson dc87639
wip: trying to get the table actions inside the table header
AlexJanson 4677c41
feat: add table actions inside a fake table header
AlexJanson cbcb41e
Merge remote-tracking branch 'origin/dev' into improv/QCG/OGUI-1853/m…
AlexJanson 2dc0c40
test: fix failing tests due to markup change
AlexJanson 073514e
style: fix linting errors
AlexJanson b4542d0
fix: virtual table not working anymore
AlexJanson 1c64d62
Merge remote-tracking branch 'origin/dev' into improv/QCG/OGUI-1853/m…
AlexJanson baf33e0
chore: remove unused none sorting option
AlexJanson 076e2f9
feat: add label name to title on sortable buttons
AlexJanson aaef6fc
feat: add better function names, remove redudant class, simplify func…
AlexJanson e1b7515
style: fix linting errors
AlexJanson 196a51e
Merge remote-tracking branch 'origin/dev' into improv/QCG/OGUI-1853/m…
AlexJanson 3485848
test: update the selector to select the right element
AlexJanson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
| * See http://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| * All rights not expressly granted are reserved. | ||
| * | ||
| * This software is distributed under the terms of the GNU General Public | ||
| * License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| /** | ||
| * Enumeration for sort directions | ||
| * @enum {number} | ||
| * @readonly | ||
| */ | ||
| export const SortDirectionsEnum = Object.freeze({ | ||
| ASC: 1, | ||
| DESC: -1, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
| * See http://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| * All rights not expressly granted are reserved. | ||
| * | ||
| * This software is distributed under the terms of the GNU General Public | ||
| * License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| import { SortDirectionsEnum } from '../common/enums/columnSort.enum.js'; | ||
| import { h, iconCircleX, iconCaretBottom, iconCaretTop } from '/js/src/index.js'; | ||
|
|
||
| /** | ||
| * Get the icon for the sort direction. | ||
| * @param {SortDirectionsEnum} direction - direction of the sort. | ||
| * @returns {vnode} the correct icon related to the direction. | ||
| */ | ||
| const getSortIcon = (direction) => { | ||
| if (direction === SortDirectionsEnum.ASC) { | ||
| return iconCaretTop(); | ||
| } | ||
| if (direction === SortDirectionsEnum.DESC) { | ||
| return iconCaretBottom(); | ||
| } | ||
| return iconCircleX(); | ||
| }; | ||
|
|
||
| /** | ||
| * @callback SortClickCallback | ||
| * @param {string} label - The label of the column being sorted. | ||
| * @param {number} order - The next sort direction in the cycle. | ||
| * @param {vnode} icon - The VNode for the icon representing the next sort state. | ||
| * @returns {void} | ||
| */ | ||
|
|
||
| /** | ||
| * Renders a sortable table header button that cycles through sort states. | ||
| * Displays the current sort icon and a preview icon of the next state on hover. | ||
| * @param {object} props - The component properties. | ||
| * @param {number} props.order - The current sort direction value from SortDirectionsEnum. | ||
| * @param {object|undefined} props.icon - The VNode/element for the current active sort icon. | ||
| * @param {string} props.label - The display text for the column header. | ||
| * @param {SortClickCallback} props.onclick - Callback triggered on click. | ||
| * @param {Array<number>} [props.sortOptions] - Array of SortDirectionsEnum values defining the | ||
| * order of the sort cycle. Defaults to all enum values. | ||
| * @returns {object} A HyperScript VNode representing the sortable button. | ||
| */ | ||
| export const sortableTableHead = ({ | ||
| order, | ||
| icon, | ||
| label, | ||
| onclick, | ||
| sortOptions = [...Object.values(SortDirectionsEnum)], | ||
| }) => { | ||
| const currentIndex = sortOptions.indexOf(order); | ||
| const nextIndex = (currentIndex + 1) % sortOptions.length; | ||
| const nextSortOrder = sortOptions[nextIndex]; | ||
| const hoverIcon = getSortIcon(nextSortOrder); | ||
|
|
||
| const directionLabel = Object.keys(SortDirectionsEnum).find((key) => SortDirectionsEnum[key] === nextSortOrder); | ||
|
|
||
| return h( | ||
| '.sort-button.cursor-pointer', | ||
| { | ||
| onclick: () => onclick(label, nextSortOrder, hoverIcon), | ||
| title: `Sort ${directionLabel} by ${label}`, | ||
| }, | ||
| [ | ||
| label, | ||
| h('span.icon-container.mh1', [ | ||
| h('span.current-icon', [order != SortDirectionsEnum.NONE ? icon : undefined]), | ||
| h('span.hover-icon', [getSortIcon(nextSortOrder)]), | ||
| ]), | ||
| ], | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the newly added methods in this file are missing documentation. Please make sure to add |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think it would be good to keep the same UX/UI for the users as for other applications that we develop.
Please have a look at Bookkeeping on what design they use and try to implement a similar one: attaching here a screenshot but perhaps running BKP locally would be more helpful