mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Severity Enum (#14620)
* Severity Enum Replace old Alert constants * Fix whitespace * Additional uses * style fixes * Fix test too * More missed locations * More
This commit is contained in:
@@ -29,6 +29,7 @@ use App\Models\ComponentPref;
|
||||
use App\Models\ComponentStatusLog;
|
||||
use App\Models\Eventlog;
|
||||
use Illuminate\Support\Arr;
|
||||
use LibreNMS\Enum\Severity;
|
||||
use Log;
|
||||
|
||||
class Component
|
||||
@@ -242,7 +243,7 @@ class Component
|
||||
}
|
||||
$component->save();
|
||||
|
||||
Eventlog::log($message, $component->device_id, 'component', 3, $component->id);
|
||||
Eventlog::log($message, $component->device_id, 'component', Severity::Notice, $component->id);
|
||||
}
|
||||
|
||||
// update preferences
|
||||
@@ -258,18 +259,18 @@ class Component
|
||||
$invalid->forget($existing->id);
|
||||
$existing->fill(['value' => $value]);
|
||||
if ($existing->isDirty()) {
|
||||
Eventlog::log("Component: $component->type($component->id). Attribute: $attribute, was modified from: " . $existing->getOriginal('value') . ", to: $value", $device_id, 'component', 3, $component->id);
|
||||
Eventlog::log("Component: $component->type($component->id). Attribute: $attribute, was modified from: " . $existing->getOriginal('value') . ", to: $value", $device_id, 'component', Severity::Notice, $component->id);
|
||||
$existing->save();
|
||||
}
|
||||
} else {
|
||||
$component->prefs()->save(new ComponentPref(['attribute' => $attribute, 'value' => $value]));
|
||||
Eventlog::log("Component: $component->type($component->id). Attribute: $attribute, was added with value: $value", $component->device_id, 'component', 3, $component->id);
|
||||
Eventlog::log("Component: $component->type($component->id). Attribute: $attribute, was added with value: $value", $component->device_id, 'component', Severity::Notice, $component->id);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($invalid as $pref) {
|
||||
$pref->delete();
|
||||
Eventlog::log("Component: $component->type($component->id). Attribute: $pref->attribute, was deleted.", $component->device_id, 'component', 4);
|
||||
Eventlog::log("Component: $component->type($component->id). Attribute: $pref->attribute, was deleted.", $component->device_id, 'component', Severity::Warning);
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user