Skip to content

Commit

Permalink
QA: Enhance the jQuery multi-select filter
Browse files Browse the repository at this point in the history
* Have it follow the Cacti Theme, and keep the 'Search Width' sufficient
  • Loading branch information
TheWitness committed Dec 24, 2024
1 parent c4e5388 commit 0c200e8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/js/jquery.multiselect.filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
var optgroupClass = 'ui-multiselect-optgroup';
var groupLabelClass = 'ui-multiselect-grouplabel';
var hiddenClass = 'ui-multiselect-excluded';
var searchClass = 'ui-state-default ui-corner-all';

/**
* This comes courtesy of underscore.js
Expand Down Expand Up @@ -62,7 +63,6 @@
}

$.widget('ech.multiselectfilter', {

options: {
label: 'Filter:', // (string) The label to show with the input
placeholder: 'Enter keywords', // (string) The placeholder text to show in the input
Expand Down Expand Up @@ -102,7 +102,8 @@
.css({width: (typeof opts.width === 'string')
? this.instance._parse2px(opts.width, this.$header).px + 'px'
: (/\d/.test(opts.width) ? opts.width + 'px' : null),
});
})
.addClass(searchClass);
this._bindInputEvents();
// automatically reset the widget on close?
if (this.options.autoReset) {
Expand Down
9 changes: 9 additions & 0 deletions include/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3539,6 +3539,15 @@ function setSelectMenus() {

var msWidth = 200;

$('#graph_template_id option').each(function() {
var curWidth = $(this).textWidth();
if (curWidth > msWidth) {
msWidth = curWidth;
}
});

msWidth -= 20;

$('#graph_template_id.graph-multiselect').hide().multiselect({
menuHeight: $(window).height()*.7,
menuWidth: 'auto',
Expand Down
5 changes: 5 additions & 0 deletions include/themes/dark/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2517,6 +2517,11 @@ tr#realtime td:first-child {
font-size: unset;
}

.ui-widget-header {
background: transparent;
background-color: #161616;
}

.ui-checkboxradio-icon {
display: none;
}
Expand Down

0 comments on commit 0c200e8

Please sign in to comment.