This commit is contained in:
JuanCarlos 2019-01-29 17:10:41 +01:00
commit e82d9109da
4 changed files with 8 additions and 71 deletions

View File

@ -84,7 +84,7 @@ export class ConfigurationGroupsController {
};
this.$scope.doSaveConfig = () => {
this.$scope.editingFile = false;
this.$scope.$broadcast('saveXmlFile', { rule: this.$scope.selectedItem });
this.$scope.$broadcast('saveXmlFile', { group: this.$scope.selectedItem.name });
};
this.$scope.closeEditingFile();

View File

@ -72,13 +72,18 @@ export class ConfigurationRulesetController {
this.$scope.doSaveConfig = (isNewFile, fileName) => {
if (isNewFile && !fileName) {
this.errorHandler.handle('You need to specify a file name', 'Error creating a new file.');
return false;
} else {
this.$scope.editingFile = false;
if (isNewFile) {
const validFileName = /(.+).xml/;
const containsNumber = /.*[0-9].*/;
if (fileName && !validFileName.test(fileName)) {
fileName = fileName + '.xml'
}
if (containsNumber.test(fileName)) {
this.errorHandler.handle('The filename can not contain numbers', 'Error creating a new file.');
return false;
}
this.$scope.selectedItem = { file: fileName }
if (this.$scope.type === 'rules') {
this.$scope.$broadcast('saveXmlFile', { rule: this.$scope.selectedItem });
@ -89,6 +94,7 @@ export class ConfigurationRulesetController {
const objParam = this.$scope.selectedRulesetTab === 'rules' ? { rule: this.$scope.selectedItem } : { decoder: this.$scope.selectedItem };
this.$scope.$broadcast('saveXmlFile', objParam);
}
this.$scope.editingFile = false;
}
};

View File

@ -1,68 +0,0 @@
<div flex="auto" layout="column" ng-controller="editionController" ng-if="mctrl.tab === 'edition'" ng-show="editingFile && !load ">
<!-- Loading ring -->
<div class='uil-ring-css' ng-show="load">
<div></div>
</div>
<!-- Headline -->
<div layout="column" layout-padding>
<div layout="row">
<span class="font-size-18">
<i class="fa fa-fw fa-edit" aria-hidden="true"></i> Node configuration</span>
</div>
<div layout="row">
<span class="md-subheader">Edit master/worker node configuration</span>
</div>
<!-- List of nodes if cluster is enabled -->
<div ng-show="selectedNode && clusterStatus.data.data.enabled === 'yes'" layout="row" layout-padding style="position: absolute;right: calc(0% + 260px);">
<div layout="column" layout-align="center" class="height-40 wz-select-input">
<select class="kuiSelect wz-border-none cursor-pointer max-height-35" id="categoryBox" ng-model="selectedNode"
ng-change="changeNode(selectedNode)" aria-label="Select node">
<option ng-repeat="node in nodes" value="{{node.name}}">{{node.name}} ({{node.type}})</option>
</select>
</div>
</div>
</div>
<!-- End headline -->
<div flex="auto" class="wz-padding-top-50" layout="row">
<!-- XML editor for node configuration -->
<div flex layout="column">
<div layout="row" class="md-padding">
<button ng-disabled='xmlHasErrors' ng-click='saveConfiguration()' class='btn btn-primary pull-right wz-margin-left-8'>
<span ng-show='!xmlHasErrors'><i aria-hidden='true' class='fa fa-fw fa-save'></i>Save file</span>
<span ng-show='xmlHasErrors' class='btn-danger'><i aria-hidden='true' class='fa fa-fw fa-exclamation-triangle'></i>
XML format error</span>
</button>
</div>
<div class="md-padding md-padding-top-10" ng-if="fetchedXML">
<wz-xml-file-editor file-name='ossec.conf' data="fetchedXML" target-name="selectedNode" valid-fn='xmlIsValid(valid)'>
</wz-xml-file-editor>
</div>
</div>
<!-- This section is the right sidenav content -->
<md-sidenav class="md-sidenav-right" md-is-locked-open="true">
<md-list>
<md-subheader>More info about this section</md-subheader>
<md-list-item target="_blank" class="wz-text-link" ng-href="https://documentation.wazuh.com/current/user-manual/manager/index.html">Wazuh
administration documentation</md-list-item>
<md-list-item target="_blank" class="wz-text-link" ng-href="https://documentation.wazuh.com/current/user-manual/capabilities/index.html">Wazuh
capabilities documentation</md-list-item>
<md-list-item target="_blank" class="wz-text-link" ng-href="https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/index.html">Local
configuration reference</md-list-item>
</md-list>
</md-sidenav>
<!-- End right sidenav section -->
</div>
</div>

View File

@ -6,6 +6,5 @@ include ./monitoring/monitoring.pug
include ./logs.html
include ./reporting.html
include ./groups/groups.html
include ./edition.html
include ./ruleset/ruleset.pug
include ../footer.foot