Added ability to limit dashboard results
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
93afda6d10
commit
d95be2e185
@ -1,3 +1,7 @@
|
||||
$(document).ready(function() {
|
||||
console.log('Document is ready!');
|
||||
|
||||
$('#filter-limiter').on('change', () => {
|
||||
$('#filter-form').submit();
|
||||
});
|
||||
});
|
||||
|
@ -4,9 +4,16 @@ const License = db.licenses;
|
||||
|
||||
// GET - /
|
||||
exports.getIndex = async function(req, res) {
|
||||
// check if there's a limit set
|
||||
if (isset(req.body['limit'])) {
|
||||
const limit = req.body.limit;
|
||||
} else {
|
||||
const limit = 10;
|
||||
}
|
||||
|
||||
// fetch inventory items from database
|
||||
const items = await Item.findAll({
|
||||
limit: 10,
|
||||
limit: limit,
|
||||
order: [
|
||||
['updatedAt', 'DESC'],
|
||||
],
|
||||
@ -14,7 +21,7 @@ exports.getIndex = async function(req, res) {
|
||||
|
||||
// fetch licenses from database
|
||||
const licenses = await License.findAll({
|
||||
limit: 10,
|
||||
limit: limit,
|
||||
order: [
|
||||
['updatedAt', 'DESC'],
|
||||
],
|
||||
|
@ -83,4 +83,18 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="row">
|
||||
<div class="columns twelve">
|
||||
<form id="filter-form" class="u-full-width" action="/" method="post">
|
||||
<select id="filter-limit" name="limit">
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="20">20</option>
|
||||
<option value="35">35</option>
|
||||
<option value="50">50</option>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user