Fixes assets page with deletes modal and periodic assets update

This commit is contained in:
Matteo Biscosi 2025-01-22 10:20:01 +01:00
parent 3171106fb3
commit 4c05e66dea
9 changed files with 110 additions and 68 deletions

View file

@ -34,20 +34,13 @@ end
local num_hosts_deleted = 0
tprint(serial_key)
if (serial_key == "all") then
if tonumber(serial_key) then
num_hosts_deleted = asset_utils.deleteAllEntriesSince(ifid, 'host', tonumber(serial_key))
elseif (serial_key == "all") then
num_hosts_deleted = asset_utils.deleteAll(ifid, 'host')
elseif (not isEmptyString(serial_key)) then
num_hosts_deleted = asset_utils.deleteHost(ifid, serial_key)
end
--[[
if tonumber(serial_key) then
local epoch = os.time() - tonumber(serial_key)
num_hosts_deleted = asset_utils.deleteAllEntriesSince(ifid, epoch)
else
else
end
]]
rest_utils.answer(rc, {deleted_hosts = num_hosts_deleted})