Skip to content

Commit

Permalink
refactor: Allow _perc and _current columns to be string for alert rul…
Browse files Browse the repository at this point in the history
…es (librenms#8532)

* refactor: Allow _perc and _current columns to be string for alert rules

* Moved the check for column type
  • Loading branch information
laf authored Apr 14, 2018
1 parent d08e1e6 commit 3db26c1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions LibreNMS/Alerting/QueryBuilderFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@ private function generateTableFilter()

$field = "$table.$column";

// format enums as radios
if ($type == 'enum') {
if (ends_with($column, ['_perc', '_current'])) {
$this->filter[$field] = [
'id' => $field,
'type' => 'string',
];
} elseif ($type == 'enum') {// format enums as radios
$values = explode(',', substr($column_type, 4));
$values = array_map(function ($val) {
return trim($val, "()' ");
Expand Down

0 comments on commit 3db26c1

Please sign in to comment.