-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allowed user to select amount of logs per page
- Loading branch information
1 parent
2cc3f1d
commit ba3440f
Showing
5 changed files
with
115 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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,40 @@ | ||
/** | ||
* @license | ||
* Copyright CERN and copyright holders of ALICE O2. This software is | ||
* distributed under the terms of the GNU General Public License v3 (GPL | ||
* Version 3), copied verbatim in the file "COPYING". | ||
* | ||
* See http://alice-o2.web.cern.ch/license for full licensing information. | ||
* | ||
* 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 { h } from '/js/src/index.js'; | ||
import { iconCaretBottom } from '/js/src/icons.js'; | ||
|
||
/** | ||
* Returns a collection of buttons for the available amounts within the dropdown | ||
* @param {Function} onclick The method to be triggered when an item is clicked | ||
* @param {Array} amounts The numerical options available | ||
* @return {vnode} The individual items in the dropdown | ||
*/ | ||
const mapAmounts = (onclick, amounts) => | ||
amounts.map((amount) => h('.menu-item', { onclick: () => onclick(amount) }, amount)); | ||
|
||
/** | ||
* Returns the amount selector dropdown | ||
* @param {Function} onclickDropdown The method to be triggered when the dropdown is clicked | ||
* @param {Function} onclickAmount The method to be triggered when an item in the dropdown is clicked | ||
* @param {Boolean} dropdownVisible Whether the dropdown menu is expanded or not | ||
* @param {Array} amounts The numerical options available in the dropdown menu | ||
* @param {Number} itemsPerPage The currently set amount of items per page for pagination | ||
* @return {vnode} The full dropdown including all options and a display of currently set amount | ||
*/ | ||
const amountSelector = (onclickDropdown, onclickAmount, dropdownVisible, amounts, itemsPerPage) => | ||
h(`.dropdown${dropdownVisible ? '.dropdown-open' : ''}#amountSelector`, [ | ||
h('button.btn', { onclick: onclickDropdown }, `Amount per page: ${itemsPerPage} `, iconCaretBottom()), | ||
h('.dropdown-menu', mapAmounts(onclickAmount, amounts)), | ||
]); | ||
|
||
export default amountSelector; |
This file contains 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,17 @@ | ||
/** | ||
* @license | ||
* Copyright CERN and copyright holders of ALICE O2. This software is | ||
* distributed under the terms of the GNU General Public License v3 (GPL | ||
* Version 3), copied verbatim in the file "COPYING". | ||
* | ||
* See http://alice-o2.web.cern.ch/license for full licensing information. | ||
* | ||
* 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 pageSelector from './pageSelector.js'; | ||
import amountSelector from './amountSelector.js'; | ||
|
||
export { pageSelector, amountSelector }; |
This file contains 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 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 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