diff options
-rw-r--r-- | provisioning-controller.lua | 4 | ||||
-rw-r--r-- | provisioning-model.lua | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/provisioning-controller.lua b/provisioning-controller.lua index 70451e3..32c2da2 100644 --- a/provisioning-controller.lua +++ b/provisioning-controller.lua @@ -59,7 +59,7 @@ mymodule.listgroups = function( self ) end mymodule.editgroup = function( self ) - return self.handle_form(self, self.model.get_group, self.model.update_group, self.clientdata, "Save", "Edit Parameter Group", "Parameter Group Saved") + return self.handle_form(self, self.model.get_group, self.model.update_group, self.clientdata, "Save", "Edit Parameter Group") end mymodule.creategroup = function( self ) @@ -75,7 +75,7 @@ mymodule.listparams = function( self ) end mymodule.editparam = function( self ) - return self.handle_form(self, self.model.get_param, self.model.update_param, self.clientdata, "Save", "Edit Parameter", "Parameter Saved") + return self.handle_form(self, self.model.get_param, self.model.update_param, self.clientdata, "Save", "Edit Parameter") end mymodule.createparam = function( self ) diff --git a/provisioning-model.lua b/provisioning-model.lua index 807d08e..fd4c1e4 100644 --- a/provisioning-model.lua +++ b/provisioning-model.lua @@ -1257,11 +1257,16 @@ mymodule.update_group = function(self, group, action, create) -- Update the devices after databasedisconnect so device failure doesn't rollback the change if success then + group.descr = {"Parameter Group Saved"} -- Notify the devices that their params might have changed (this will also validate) for i,d in ipairs(devices) do local r = set_device_params(get_device_params(d.device_id, false), false) - if r.errtxt then self.logevent("ERROR: Failed to update params for device "..d.device_id.."\n"..r:print_errtxt()) end + if r.errtxt then + group.descr[#group.descr+1] = "ERROR: Failed to update params for device "..d.device_id.."\n"..r:print_errtxt() + self.logevent(group.descr[#group.descr]) + end end + group.descr = table.concat(group.descr, "\n") end end) if not res and err then @@ -1442,11 +1447,16 @@ mymodule.update_param = function(self, param, action, create) -- Update the devices after databasedisconnect so device failure doesn't rollback the change if success then + param.descr = {"Parameter Saved"} -- Notify the devices that their params might have changed (this will also validate) for i,d in ipairs(devices) do local r = set_device_params(get_device_params(d.device_id, false), false) - if r.errtxt then self.logevent("ERROR: Failed to update params for device "..d.device_id.."\n"..r:print_errtxt()) end + if r.errtxt then + param.descr[#param.descr+1] = "ERROR: Failed to update params for device "..d.device_id.."\n"..r:print_errtxt() + self.logevent(param.descr[#param.descr]) + end end + param.descr = table.concat(param.descr, "\n") end end) if not res and err then |