Added code to retain filter status when re-visiting the dashboard
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2024-05-25 11:36:12 -04:00
parent 2c0520ff4b
commit 94c1c26e94
3 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,18 @@
$(document).ready(function() { $(document).ready(function() {
// check state of limit filter
var cookie_limit = $.cookie('filter_limit');
// if limit is different than what's selected
var active_limit = $('#filter-limit').val();
if ((cookie_limit) && (cookie_limit != active_limit)) {
console.log('cookie is different from whats active.');
$('#filter-limit').val(cookie_limit).change();
} else {
console.log('cookie is not set or is the same.');
}
$('#filter-limit').on('change', () => { $('#filter-limit').on('change', () => {
$.cookie('filter_limit', $('#filter-limit').val());
console.log($('#filter-limit').val());
$('#filter-form').submit(); $('#filter-form').submit();
}); });
}); });

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "overseer", "name": "overseer",
"version": "0.2.2", "version": "0.3.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "overseer", "name": "overseer",
"version": "0.2.2", "version": "0.3.0",
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"dependencies": { "dependencies": {
"config": "^3.3.8", "config": "^3.3.8",

View File

@ -8,7 +8,8 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
<link rel="stylesheet" href="/css/gargoyle.css"> <link rel="stylesheet" href="/css/gargoyle.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js" charset="utf-8"></script>
<script src="/js/nechryael.min.js"></script> <script src="/js/nechryael.min.js"></script>
</head> </head>
<body> <body>