|
40 | 40 | $admin_verbose_details = '<th data-column-id="verbose_details" data-sortable="false">Details</th>'; |
41 | 41 | } |
42 | 42 |
|
43 | | -$device_id ??= (int) ($vars['device'] ?? 0); |
| 43 | +$device_id = (int) (request()->get('device_id') ?: ($vars['device'] ?? 0)); |
44 | 44 |
|
45 | 45 | $common_output[] = '<div class="panel panel-default panel-condensed"> |
46 | 46 | <div class="panel-heading"> |
|
81 | 81 | templates: { |
82 | 82 | header: \'<div id="{{ctx.id}}" class="{{css.header}}"><div class="row"> \ |
83 | 83 | <div class="col-sm-8 actionBar"><span class="pull-left"> \ |
84 | | - <form method="post" action="" class="form-inline" role="form" id="alertlog-filter-form"> \ |
85 | | - ' . csrf_field() . ' \ |
| 84 | + <form method="get" action="" class="form-inline" role="form" id="alertlog-filter-form"> \ |
86 | 85 | <input type=hidden name="hostname" id="hostname"> \ |
87 | 86 | '; |
88 | 87 |
|
|
96 | 95 | $common_output[] = '<div class="form-group"> \ |
97 | 96 | <select name="state" id="state" class="form-control input-sm"> \\'; |
98 | 97 | foreach ($alert_states as $text => $value) { |
99 | | - $selected = $value == ($_POST['state'] ?? '') ? ' selected' : ''; |
| 98 | + $selected = $value == (request()->get('state', '')) ? ' selected' : ''; |
100 | 99 | $common_output[] = "<option value=\"" . htmlspecialchars((string) $value) . "\"$selected>$text</option> \\"; |
101 | 100 | } |
102 | 101 | $common_output[] = '</select> \ |
103 | 102 | </div> \ |
104 | 103 | <div class="form-group"> \ |
105 | 104 | <select name="severity[]" id="severity" class="form-control input-sm" multiple> \\'; |
| 105 | +$current_severity = request()->get('severity', []); |
106 | 106 | foreach ($alert_severities as $text => $value) { |
107 | | - $selected = in_array($value, $_POST['severity'] ?? []) == $value ? ' selected' : ''; |
| 107 | + $selected = in_array($value, (array) $current_severity) ? ' selected' : ''; |
108 | 108 | $common_output[] = "<option value=\"$value\"$selected>$text</option> \\"; |
109 | 109 | } |
110 | 110 | $common_output[] = '</select> \ |
|
123 | 123 | }).on("loaded.rs.jquery.bootgrid", function () { |
124 | 124 |
|
125 | 125 | var results = $("div.infos").text().split(" "); |
126 | | - low = results[1] - 1; |
127 | | - high = results[3]; |
128 | | - max = high - low; |
129 | | - search = $(\'.search-field\').val(); |
| 126 | + var low = results[1] - 1; |
| 127 | + var high = results[3]; |
| 128 | + var max = high - low; |
| 129 | + var search = $(\'.search-field\').val(); |
130 | 130 |
|
131 | 131 | grid.find(".incident-toggle").each(function () { |
132 | 132 | $(this).parent().addClass(\'incident-toggle-td\'); |
|
176 | 176 |
|
177 | 177 | $("#alertlog-filter-form").on("submit", function (e) { |
178 | 178 | e.preventDefault(); |
| 179 | + var formData = $(this).serializeArray().filter(function(item) { |
| 180 | + return item.value !== ""; |
| 181 | + }); |
| 182 | + var queryString = $.param(formData); |
| 183 | + var newUrl = window.location.origin + window.location.pathname + (queryString ? "?" + queryString : ""); |
| 184 | + window.history.pushState({path: newUrl}, "", newUrl); |
179 | 185 | grid.bootgrid("reload"); |
180 | 186 | }); |
181 | 187 | </script> |
|
0 commit comments