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:
Tony Murray
2021-05-11 08:08:59 -05:00
committed by GitHub
parent 3d62be5003
commit 2d752925b0
20 changed files with 14051 additions and 112 deletions

View File

@@ -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)