From 2a44c7a791bcae358879ae1a179dcf01052bdd3f Mon Sep 17 00:00:00 2001 From: TheWitness Date: Tue, 6 Oct 2026 11:35:13 -0400 Subject: [PATCH] feature: modern filter bar polish (Rows/Refresh on bar, dialog button labels, separators) (#8191) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: label modern dialog apply/clear with the page button text; show Rows on the bar The dialog apply button was hardcoded 'Search', which mismatched the page's submit label (e.g. 'Go') and collided with pages that have a filter field named Search (clog). It now uses the configured go/clear button display text. Also route the 'rows' field to the modern bar alongside timespan/refresh so the per-page Rows selector stays visible. * feature: always label the row-count selector 'Rows' emit_field() forces the 'rows' field friendly_name to Rows regardless of page-specific naming (Devices, Trees, ...), in both legacy and modern filters. Refresh already renders on the modern bar via field_is_bar. * feature: order modern bar selectors (Rows, Refresh) and separate them from the buttons Rows renders first and Refresh second on the modern filter bar, and a vertical separator now divides the selectors (Layouts, Rows, Refresh) from the layout action buttons. * changelog: 8191.feature fragment for modern filter bar polish * jQuery 4: replace removed $.isFunction in bundled plugins jQuery 4.0 removed $.isFunction. contextMenu, colorpicker and timepicker are hand-vendored orphans fixed in place; tablesorter is npm-managed, so it is also rewritten at sync time in build/sync-js.mjs so a rebuild reproduces the fix (no-ops once the upstream fix is released and the pin is bumped). * Render the Thumbnails and Business Hours graph filter checkboxes as Cacti toggles * fix: address review — update modern JS docblock and strengthen bar/label tests Rewrite the create_modern_javascript docblock to describe the page-configured apply/clear labels (and document the change/clear callback params). Extend FilterLayoutsTest to assert the selector|button separator, the applied Rows-then-Refresh ordering, and both go/clear label lookups, and that the hardcoded Search dialog label is gone. * Filter bar polish: toggle-style filter checkboxes and flicker-free layout buttons Render the shared filter_checkbox field as a Cacti toggle switch (.checkboxSwitch/.checkboxSlider) so every page's filter checkboxes match the rest of the UI, and start the layout Rename/Delete/Save As buttons hidden so layoutUpdateButtons() reveals them only when applicable instead of flashing visible on load. * Modern filter: move the timespan selector onto its own second filter line Timespan controls were rendered inline on the single modern filter bar. Route method=timespan fields into a separate group and emit them as a second filterTable row so the bar isn't overcrowded, matching the legacy multi-row layout. Applies to every modern filter with a timespan (the graph view pages). * Modern filter: keep toggle checkboxes on the bar with a visible label and tooltip filter_checkbox fields now count as bar fields so the Thumbnails/Business Hours toggles sit on the single bar instead of the Edit dialog. Their label used .checkboxLabel (display:none by design for forms), which hid the text; switch to .checkboxLabelWanted and always set a title tooltip from the field's title/friendly_name so each toggle is self-describing. * Modern filter: toggles back in the dialog, restrict auto-apply to bar fields, drop dialog Clear - Move filter_checkbox toggles back into the Edit dialog (field_is_bar no longer claims them) and render them as a form row: friendly name in the label column, toggle in the value column. - In modern mode only bar selectors (Rows, Refresh) and the Layout selector auto-trigger a filter change; dialog field changes/clicks no longer call applyFilter (gate changeChain/clickChain on !use_modern_filter() || field_is_bar). Legacy keeps auto-applying on change (text inputs still excluded). - Remove the Clear button from the modern Edit dialog and the now-unused clearLabel; update the dialog-labels test accordingly. * Fix filter toggle vertical alignment across themes The generic .filterTable .filterColumn label { vertical-align: -10% } nudge (meant for text labels) out-specified .checkboxSwitch and dragged the toggle switch down, which also pulled the adjacent label baseline low in the Edit dialog and misaligned the toggle on the legacy filter bar. Add a higher-specificity label.checkboxSwitch { vertical-align: middle } in every theme carrying the rule (midwinter has no such rule). * Hide the filter search glyph in the modern Edit dialog Theme main.js appends a ti-search glyph after #rfilter, positioned for a table cell; in the modern Edit dialog #rfilter sits in a wide div (no td), so the glyph wraps below the field. Skip the injection when #rfilter is inside .cactiFilterEditTable (modern dialog); legacy, which has no such ancestor, keeps the glyph. * jQuery 4: full removed-API sweep of bundled plugins Replace every jQuery-4-removed helper across the vendored plugins: \$.trim -> String.prototype.trim, \$.isArray -> Array.isArray, \$.proxy -> Function.prototype.bind, \$.parseJSON -> JSON.parse, \$.type -> typeof/\$.isPlainObject, \$.isWindow -> native window check (plus the earlier \$.isFunction). Orphans (colorpicker, timepicker, multiselect, multiselect.filter, tableDnD) are fixed in place; the npm-managed tablesorter core+widgets are rewritten at sync time in build/sync-js.mjs so a rebuild reproduces the fix. * Modern filter dialog: non-modal, Apply gated on save, Save keeps dialog open - Rename the dialog apply action to Apply and disable it until the (new or changed) filter is saved (layoutDirty tracking); Close just closes without applying. - Save no longer reloads the page: it reflects the saved layout in the selector and re-enables Apply, keeping the dialog open. - Dialogs are now modal: false. - Switch the layout selector change from a full document.location reload to an AJAX loadUrl(). - Vertically center the modern bar cells so the barSep separator lines up between the buttons. * Modern filter: add layout to the filter's session variable structure Register layout (FILTER_VALIDATE_INT, default 0) in sanitize_filter_variables() alongside page so the selected layout is validated and stored in the filter's session object and persists across page views. * Modern filter: Graph Template amalgam on line 2, timespan on line 3 Tag the Graph Template + Source/Order/CF/Measure group ('bar' => true on graph_template_id and the html_graph_order_filter_array() metrics) so create_modern_filter renders it as its own second filter line on Graph View and Tree View, pushing the timespan to the third line. These bar fields also auto-trigger the filter so the Template->Source->Order callback chain works on the main bar. * Fix graph_template_id multi-select: allow comma lists, type get_host_graph_list correctly get_host_graph_list() immediately transforms graph_template_id via html_transform_graph_template_ids() (handles cg_/dq_ prefixes and comma lists), so its parameter is a string, not an int -- correct the type hint and docblock. Also widen the preview and listview graph_template_id validation regexp to accept a comma-separated list like 'cg_118,cg_106,cg_119', matching the tree filter. * Modern filter: hide the whole cell for hidden layout buttons to even out bar separator spacing The Rename/Delete/Save As buttons hid only the