From bc77c35d8440a656d4704451ce857c9e1d36a438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20=C3=81ngel?= Date: Mon, 28 Jan 2019 11:59:57 +0100 Subject: [PATCH] Emit event for success --- public/controllers/management/groups.js | 5 +++++ public/directives/wz-xml-file-editor/wz-xml-file-editor.js | 2 ++ 2 files changed, 7 insertions(+) diff --git a/public/controllers/management/groups.js b/public/controllers/management/groups.js index 93f87e8135..a8cdde8576 100644 --- a/public/controllers/management/groups.js +++ b/public/controllers/management/groups.js @@ -295,6 +295,11 @@ export function GroupsController( $scope.$broadcast('saveXmlFile', { group: $scope.currentGroup.name }); }; + $scope.$on('configurationSuccess',() => { + $scope.editingFile = false; + if(!$scope.$$phase) $scope.$digest(); + }); + $scope.reload = async (element, searchTerm, addOffset, start) => { if (element === 'left') { if (!$scope.availableAgents.loadedAll) { diff --git a/public/directives/wz-xml-file-editor/wz-xml-file-editor.js b/public/directives/wz-xml-file-editor/wz-xml-file-editor.js index 5d7d26f4ff..b4998d04ce 100644 --- a/public/directives/wz-xml-file-editor/wz-xml-file-editor.js +++ b/public/directives/wz-xml-file-editor/wz-xml-file-editor.js @@ -150,11 +150,13 @@ app.directive('wzXmlFileEditor', function() { const xml = replaceIllegalXML(text); await groupHandler.sendConfiguration(params.group, xml); errorHandler.info('Success. Group has been updated', ''); + $scope.$emit('configurationSuccess') } catch (error) { errorHandler.handle(error, 'Send file error'); } return; }; + $scope.xmlCodeBox = CodeMirror.fromTextArea( $document[0].getElementById('xml_box'), {