Add go to edit file in rules and decoders, when it has been created correctly (#1943)

This commit is contained in:
Alberto Andújar 2019-12-13 15:00:24 +01:00 committed by Juanca Rodríguez
parent 00fb130c5e
commit 4686f5dd9d
2 changed files with 28 additions and 0 deletions

View File

@ -57,6 +57,12 @@ export class FilesController {
this.$scope.$applyAsync();
});
this.$scope.$on('showSaveAndOverwrite', () => {
this.$scope.newFile = true;
this.$scope.editorReadOnly = false;
this.$scope.$applyAsync();
});
this.$scope.$on('viewFileOnly', (ev, params) => {
this.$scope.editorReadOnly = true;
this.editFile(params, true);

View File

@ -263,6 +263,17 @@ app.directive('wzXmlFileEditor', function() {
? showRestartMessage(msg, params.showRestartManager)
: errorHandler.handle(warnMsg, '', true)
: errorHandler.info(msg);
if(params.isNewFile) {
$scope.$emit('editFile', {
file: {
file: params.rule.file,
path: 'etc/rules',
status: 'enabled',
type: 'rule',
},
path: 'etc/rules',
});
}
} else if (params.decoder) {
close = false;
await rulesetHandler.sendDecoderConfiguration(
@ -281,6 +292,17 @@ app.directive('wzXmlFileEditor', function() {
? showRestartMessage(msg, params.showRestartManager)
: errorHandler.handle(warnMsg, '', true)
: errorHandler.info(msg);
if(params.isNewFile) {
$scope.$emit('editFile', {
file: {
file: params.decoder.file,
path: '/decoders/files',
status: 'enabled',
type: 'decoder',
},
path: '/decoders/files',
});
}
} else if (params.node) {
close = false;
await configHandler.saveNodeConfiguration(params.node, xml);