mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Oxidized improvements (#12773)
* Oxidized API cleanup Import more settings to the UI use lnms config:set * validate os and type exist * map settings WIP * oops * editing working. Needed to add new property to pass update state to child * implement deleting and handle text overflow a little better. * Update app/Models/Device.php Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com> * Update app/Models/Device.php Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com> * revert change * fix style * add return Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
This commit is contained in:
@@ -464,6 +464,17 @@ class Device extends BaseModel
|
||||
]);
|
||||
}
|
||||
|
||||
public function scopeWhereAttributeDisabled(Builder $query, string $attribute): Builder
|
||||
{
|
||||
return $query->leftJoin('devices_attribs', function (JoinClause $query) use ($attribute) {
|
||||
$query->on('devices.device_id', 'devices_attribs.device_id')
|
||||
->where('devices_attribs.attrib_type', $attribute);
|
||||
})->where(function (Builder $query) {
|
||||
$query->whereNull('devices_attribs.attrib_value')
|
||||
->orWhere('devices_attribs.attrib_value', '!=', 'true');
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeWhereUptime($query, $uptime, $modifier = '<')
|
||||
{
|
||||
return $query->where([
|
||||
@@ -472,17 +483,9 @@ class Device extends BaseModel
|
||||
]);
|
||||
}
|
||||
|
||||
public function scopeCanPing(Builder $query)
|
||||
public function scopeCanPing(Builder $query): Builder
|
||||
{
|
||||
return $query->where('disabled', 0)
|
||||
->leftJoin('devices_attribs', function (JoinClause $query) {
|
||||
$query->on('devices.device_id', 'devices_attribs.device_id')
|
||||
->where('devices_attribs.attrib_type', 'override_icmp_disable');
|
||||
})
|
||||
->where(function (Builder $query) {
|
||||
$query->whereNull('devices_attribs.attrib_value')
|
||||
->orWhere('devices_attribs.attrib_value', '!=', 'true');
|
||||
});
|
||||
return $this->scopeWhereAttributeDisabled($query->where('disabled', 0), 'override_icmp_disable');
|
||||
}
|
||||
|
||||
public function scopeHasAccess($query, User $user)
|
||||
|
Reference in New Issue
Block a user