Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysutils/pfSense-Status_Monitoring: add toggle for sorting views. Implement #13160 #1167

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ function createSlug($string) {
}
}

if($_POST['enable_tab_sorting']) {
if ($read_only) {
$savemsg = "Insufficient privileges to make the requested change (read only).";
$saveclass = 'danger';
} else {
if(($_POST['enable_tab_sorting'] === 'false')) {
unset($config['rrd']['enable_tab_sorting']);
$savemsg = gettext("Graph view sorting has been disabled.");
$changedesc .= gettext("Monitoring graph view sorting has been disabled.");
} else {
$config['rrd']['enable_tab_sorting'] = true;
$savemsg = gettext("Graph view sorting has been enabled.");
$changedesc .= gettext("Monitoring graph view sorting has been enabled.");
}
write_config($changedesc);
}
}

if ($_POST['ResetRRD']) {
if ($read_only) {
$savemsg = "Insufficient privileges to make the requested change (read only).";
Expand Down Expand Up @@ -197,6 +215,7 @@ function createSlug($string) {
}

$pconfig['enable'] = isset($config['rrd']['enable']);
$pconfig['enable_tab_sorting'] = isset($config['rrd']['enable_tab_sorting']);

//grab settings for the active view
init_config_arr(array('rrd', 'savedviews'));
Expand Down Expand Up @@ -412,6 +431,9 @@ function createSlug($string) {
$tab_array[] = array(htmlspecialchars($view['title']), $active_tab, $view_slug);
}

if ($pconfig['enable_tab_sorting']) {
asort($tab_array);
}
display_top_tabs($tab_array);

?>
Expand Down Expand Up @@ -632,6 +654,11 @@ function createSlug($string) {
</div>
<div class="col-sm-4">
<?php
if ($pconfig['enable_tab_sorting']) {
echo '<button class="btn btn-sm btn-primary" type="submit" value="false" name="enable_tab_sorting" id="enable_tab_sorting" style="display:none;"><i class="fa fa-ban fa-lg"></i> Disable Sorting</button>';
} else {
echo '<button class="btn btn-sm btn-primary" type="submit" value="true" name="enable_tab_sorting" id="enable_tab_sorting" style="display:none;"><i class="fa fa-sort-alpha-down fa-lg"></i> Enable Sorting</button>';
}
if ($pconfig['enable']) {
echo '<button class="btn btn-sm btn-danger" type="submit" value="false" name="enable" id="enable" style="display:none;"><i class="fa fa-ban fa-lg"></i> Disable Graphing</button>';
} else {
Expand Down Expand Up @@ -1176,6 +1203,7 @@ function applySettings(defaults) {
$("#save-view").toggle();
$("#add-view").toggle();
$("#remove-view").toggle();
$("#enable_tab_sorting").toggle();
$("#enable").toggle();
$("#ResetRRD").toggle();
});
Expand Down