From 303266d5fc5c1463a2aeecb2b4cc801b81ddfb06 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 13 Oct 2008 14:57:17 +0000 Subject: Added Restart Networking function to interfaces. Redirect to read after update. git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@1553 ab2d0c66-481e-0410-8bed-d214d4d58bed --- alpine-baselayout.roles | 2 +- interfaces-controller.lua | 6 +++++- interfaces-model.lua | 5 +++++ interfaces-read-html.lsp | 16 +++++++--------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/alpine-baselayout.roles b/alpine-baselayout.roles index 24d0207..0c25ac9 100644 --- a/alpine-baselayout.roles +++ b/alpine-baselayout.roles @@ -1,5 +1,5 @@ CREATE=interfaces:create,interfaces:editintfile READ=health:storage,health:proc,health:network,health:modules,health:networkstats,interfaces:status,interfaces:read,logfiles:status,logfiles:view,logfiles:download,logfiles:tail,syslog:status,syslog:loginfo,rc:status -UPDATE=interfaces:update,interfaces:ifup,interfaces:ifdown,skins:update,skins:read,syslog:startstop,syslog:config,syslog:expert,rc:edit +UPDATE=interfaces:update,interfaces:ifup,interfaces:ifdown,interfaces:restart,skins:update,skins:read,syslog:startstop,syslog:config,syslog:expert,rc:edit DELETE=interfaces:delete,logfiles:delete ALL=health:system,hostname:read diff --git a/interfaces-controller.lua b/interfaces-controller.lua index cc3de23..03c072f 100644 --- a/interfaces-controller.lua +++ b/interfaces-controller.lua @@ -14,7 +14,7 @@ read = function (self) end update = function(self) - return controllerfunctions.handle_form(self, function() return self.model.get_iface_by_name(self.clientdata.name or "") end, self.model.update_iface, self.clientdata, "Save", "Update Interface", "Interface updated") + return controllerfunctions.handle_form(self, function() return self.model.get_iface_by_name(self.clientdata.name or "") end, self.model.update_iface, self.clientdata, "Save", "Update Interface", "Interface updated", "read") end delete = function(self) @@ -36,3 +36,7 @@ end editintfile = function(self) return controllerfunctions.handle_form(self, self.model.get_file, self.model.write_file, self.clientdata, "Save", "Edit Interfaces file", "File saved") end + +restart = function(self) + return self:redirect_to_referrer(self.model.restartnetworking()) +end diff --git a/interfaces-model.lua b/interfaces-model.lua index 2617eee..8d4a32b 100644 --- a/interfaces-model.lua +++ b/interfaces-model.lua @@ -2,6 +2,7 @@ -- Copyright(c) 2007 N. Angelacos - Licensed under terms of GPL2 module (..., package.seeall) +require("modelfunctions") require("fs") -- iface is a local (private) table with private methods for managing @@ -491,3 +492,7 @@ get_addresses = function() end return cfe({ type="structure", value=retval, label="Interface IP Addresses" }) end + +restartnetworking = function() + return modelfunctions.startstop_service("networking", "restart") +end diff --git a/interfaces-read-html.lsp b/interfaces-read-html.lsp index ac910a9..f3279a2 100644 --- a/interfaces-read-html.lsp +++ b/interfaces-read-html.lsp @@ -1,4 +1,4 @@ -<% local view, viewlibrary, pageinfo, session = ... +<% local view, viewlibrary, page_info, session = ... require("viewfunctions") %> <% @@ -19,7 +19,7 @@ io.write("") <% end %> <% end %> -<% displaycommandresults({"delete", "ifup", "ifdown"}, session) %> +<% displaycommandresults({"delete", "ifup", "ifdown", "restart"}, session) %> <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("status") @@ -59,10 +59,8 @@ end %> -<% ---[[ DEBUG INFORMATION -io.write("

DEBUGGING

DEBUG INFO: CFE

") -io.write(html.cfe_unpack(form)) -io.write("
") ---]] -%> +

Restart Networking

+
+
Restart Networking
+
">
+
-- cgit v1.2.3