Migrates datasource datamodel to new class implementation

This commit is contained in:
Simone Mainardi 2021-01-06 11:54:45 +01:00
parent 75b66d82b9
commit 37c58f56de
10 changed files with 30 additions and 30 deletions

View file

@ -7,7 +7,7 @@ package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require("lua_utils")
local datasources_utils = require("datasources_utils")
local datamodel = require("datamodel_utils")
local datamodel = require("datamodel")
local function reportError(msg)
print(json.encode({ error = msg, success = false, csrf = ntop.getRandomCSRFValue() }))
@ -21,6 +21,6 @@ interface.select(ifname)
local ifstats = interface.getStats()
local m = nil
local m = datamodel:create({"IPv4", "IPv6"})
local m = datamodel:new({"IPv4", "IPv6"})
m:appendRow(when, "IP Version Distribution", { ifstats.eth.IPv4_packets, ifstats.eth.IPv6_packets })
return(m)