diff options
Diffstat (limited to 'interfaces-model.lua')
-rw-r--r-- | interfaces-model.lua | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/interfaces-model.lua b/interfaces-model.lua index 5d3f9fe..5514ae0 100644 --- a/interfaces-model.lua +++ b/interfaces-model.lua @@ -367,26 +367,30 @@ end get_all_interfaces = iface.unpack_interfaces -get_iface_by_name = function(clientdata) +get_iface_by_name = function(self, clientdata) return iface.read(clientdata.name or "") end -get_iface = function(clientdata) +get_iface = function(self, clientdata) return iface.iface_type(clientdata.family, clientdata.method) end -create_iface = iface.add_after +create_iface = function(self, value) + return iface.add_after(value) +end -update_iface = iface.update +update_iface = function(self, value) + return iface.update(value) +end -get_delete_iface_by_name = function(clientdata) +get_delete_iface_by_name = function(self, clientdata) local result = {} result.iface = cfe({ value=clientdata.name or "", label="Interface Name" }) return cfe({ type="group", value=result, label="Interface Name" }) end -delete_iface_by_name = function(deleterequest) +delete_iface_by_name = function(self, deleterequest) if deleterequest.value.iface.value and deleterequest.value.iface.value ~= "" then local res, err = iface.delete(deleterequest.value.iface.value) @@ -433,10 +437,10 @@ get_file = function () return modelfunctions.getfiledetails(filename) end -write_file = function (newfile) +write_file = function (self, newfile) iface.array = nil iface.file = nil - return modelfunctions.setfiledetails(newfile, {filename}) + return modelfunctions.setfiledetails(self, newfile, {filename}) end get_interfaces = function() @@ -473,14 +477,14 @@ get_addresses = function() return cfe({ type="structure", value=retval, label="Interface IP Addresses" }) end -get_ifup_by_name = function(clientdata) +get_ifup_by_name = function(self, clientdata) local result = {} result.iface = cfe({ value=clientdata.name or "", label="Interface Name" }) return cfe({ type="group", value=result, label="Interface Name" }) end -ifup_by_name = function (ifuprequest) +ifup_by_name = function (self, ifuprequest) name = ifuprequest.value.iface.value or "" local cmd = path.."ifup "..name local f = io.popen(format.escapespecialcharacters(cmd)) @@ -494,14 +498,14 @@ ifup_by_name = function (ifuprequest) return ifuprequest end -get_ifdown_by_name = function(clientdata) +get_ifdown_by_name = function(self, clientdata) local result = {} result.iface = cfe({ value=clientdata.name or "", label="Interface Name" }) return cfe({ type="group", value=result, label="Interface Name" }) end -ifdown_by_name = function (ifdownrequest) +ifdown_by_name = function (self, ifdownrequest) name = ifdownrequest.value.iface.value or "" local cmd = path.."ifdown "..name local f = io.popen(format.escapespecialcharacters(cmd)) @@ -515,16 +519,16 @@ ifdown_by_name = function (ifdownrequest) return ifdownrequest end -get_restartnetworking = function(clientdata) +get_restartnetworking = function(self, clientdata) --return modelfunctions.get_startstop(processname) local actions = {} actions[1] = "restart" local service = cfe({ type="hidden", value="networking", label="Service Name" }) - local startstop = cfe({ type="group", label="Reload Modules", value={servicename=service}, option=actions, errtxt=errtxt }) + local startstop = cfe({ type="group", label="Restart Networking", value={servicename=service}, option=actions, errtxt=errtxt }) return startstop end -restartnetworking = function(startstop) +restartnetworking = function(self, startstop) return modelfunctions.startstop_service(startstop, "restart") end |