mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 18:05:20 +00:00
MErge
This commit is contained in:
commit
45cc5fb745
@ -51,17 +51,16 @@ export class EditionController {
|
||||
if (this.$scope.clusterStatus.data.data.enabled === 'yes') {
|
||||
data = await this.apiReq.request(
|
||||
'GET',
|
||||
`/cluster/${this.$scope.selectedNode}/configuration`,
|
||||
{}
|
||||
`/cluster/${this.$scope.selectedNode}/files`,
|
||||
{ path: 'etc/ossec.conf'}
|
||||
);
|
||||
const json = ((data || {}).data || {}).data || false;
|
||||
xml = this.configurationHandler.json2xml(json);
|
||||
} else {
|
||||
data = await this.apiReq.request('GET', `/manager/files`, {
|
||||
path: 'etc/ossec.conf'
|
||||
});
|
||||
xml = ((data || {}).data || {}).data || false;
|
||||
}
|
||||
|
||||
xml = ((data || {}).data || {}).data || false;
|
||||
if (!xml) {
|
||||
throw new Error('Could not fetch configuration file');
|
||||
}
|
||||
@ -114,6 +113,10 @@ export class EditionController {
|
||||
return this.$scope.editConf();
|
||||
};
|
||||
|
||||
this.$scope.changeNode = () => {
|
||||
this.$scope.editConf();
|
||||
};
|
||||
|
||||
this.$scope.closeEditingFile = () => {};
|
||||
|
||||
//listeners
|
||||
|
@ -188,7 +188,7 @@ app.directive('wzXmlFileEditor', function () {
|
||||
params.showRestartManager ? showRestartDialog(msg) : errorHandler.info(msg, '');
|
||||
} else if (params.node) {
|
||||
await saveConfig.saveNodeConfiguration(params.node, xml);
|
||||
const msg = 'Success. Node configuration has been updated';
|
||||
const msg = `Success. Node (${params.node}) configuration has been updated`;
|
||||
params.showRestartManager ? showRestartDialog(msg) : errorHandler.info(msg, '');
|
||||
} else if (params.manager) {
|
||||
await saveConfig.saveManagerConfiguration(xml);
|
||||
|
@ -38,7 +38,12 @@ export class SaveConfig {
|
||||
*/
|
||||
async saveNodeConfiguration(node, content) {
|
||||
try {
|
||||
//
|
||||
const result = await this.apiReq.request(
|
||||
'POST',
|
||||
`/cluster/${node}/files?path=etc/ossec.conf`,
|
||||
{ content, origin: 'xmleditor' }
|
||||
);
|
||||
return result;
|
||||
} catch (error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
@ -16,16 +16,6 @@
|
||||
<div layout="row">
|
||||
<span class="md-subheader">Edit master/worker 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>
|
||||
|
||||
<!-- Headline (manager) -->
|
||||
@ -49,6 +39,16 @@
|
||||
<span ng-show='xmlHasErrors' class='btn-danger'><i aria-hidden='true' class='fa fa-fw fa-exclamation-triangle'></i>
|
||||
XML format error</span>
|
||||
</button>
|
||||
<!-- List of nodes if cluster is enabled -->
|
||||
<div ng-show="selectedNode && clusterStatus.data.data.enabled === 'yes'" layout="row" class="wz-margin-left-8"
|
||||
layout-padding style="padding: 0;height: 32px;">
|
||||
<div layout="column" layout-align="center" class="height-35 wz-select-input">
|
||||
<select class="kuiSelect wz-border-none cursor-pointer max-height-35" id="categoryBox"
|
||||
ng-model="selectedNode" ng-change="changeNode()" aria-label="Select node">
|
||||
<option ng-repeat="node in nodes" value="{{node.name}}">{{node.name}} ({{node.type}})</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-padding md-padding-top-10" style="height: calc(100vh - 280px);" ng-if="fetchedXML">
|
||||
<wz-xml-file-editor file-name='ossec.conf' data="fetchedXML" target-name="selectedNode" valid-fn='xmlIsValid(valid)'
|
||||
|
Loading…
Reference in New Issue
Block a user