mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 18:05:20 +00:00
Some fixes and replacing watchers by events
This commit is contained in:
parent
0da0498f03
commit
2e9faaa7d3
@ -23,46 +23,42 @@ app.directive('wzConfigViewer', function () {
|
||||
scope: {
|
||||
getjson: '&',
|
||||
getxml: '&',
|
||||
jsoncontent: '=jsoncontent',
|
||||
xmlcontent: '=xmlcontent'
|
||||
jsoncontent: '=',
|
||||
xmlcontent: '='
|
||||
},
|
||||
|
||||
controller($scope, $document) {
|
||||
this.replace = true;
|
||||
|
||||
$scope.callgetjson = () => {
|
||||
$scope.getjson();
|
||||
$scope.refreshJsonBox();
|
||||
};
|
||||
$scope.callgetxml = () => {
|
||||
$scope.getxml();
|
||||
$scope.refreshXmlBox();
|
||||
};
|
||||
|
||||
|
||||
$scope.$watch('jsoncontent', function() {
|
||||
$scope.refreshJsonBox();
|
||||
});
|
||||
$scope.$watch('xmlcontent', function() {
|
||||
$scope.refreshXmlBox();
|
||||
$scope.$on('JSONContentReady', (ev, params) => {
|
||||
$scope.refreshJsonBox(params.data);
|
||||
});
|
||||
|
||||
$scope.$on('XMLContentReady', (ev, params) => {
|
||||
$scope.refreshXmlBox(params.data);
|
||||
});
|
||||
|
||||
|
||||
$scope.refreshJsonCodeBox = () => {
|
||||
if($scope.jsoncontent != false){
|
||||
$scope.refreshJsonBox = (json) => {
|
||||
$scope.jsoncontent = json;
|
||||
if ($scope.jsoncontent != false) {
|
||||
$scope.jsonCodeBox.setValue($scope.jsoncontent);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
$scope.jsonCodeBox.refresh();
|
||||
},1);
|
||||
}, 1);
|
||||
}
|
||||
};
|
||||
$scope.refreshXmlCodeBox = () => {
|
||||
if($scope.xmlcontent != false){
|
||||
$scope.refreshXmlBox = (xml) => {
|
||||
$scope.xmlcontent = xml;
|
||||
if ($scope.xmlcontent != false) {
|
||||
$scope.xmlCodeBox.setValue($scope.xmlcontent);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
$scope.xmlCodeBox.refresh();
|
||||
},1);
|
||||
}, 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -210,6 +210,7 @@ export class ConfigurationHandler {
|
||||
$scope.XMLContent = XMLBeautifier(
|
||||
js2xmlparser.parse('configuration', cleaned)
|
||||
);
|
||||
$scope.$broadcast('XMLContentReady', { data: $scope.XMLContent });
|
||||
} catch (error) {
|
||||
$scope.XMLContent = false;
|
||||
}
|
||||
@ -231,6 +232,7 @@ export class ConfigurationHandler {
|
||||
try {
|
||||
const cleaned = objectWithoutProperties(config);
|
||||
$scope.JSONContent = JSON.stringify(cleaned, null, 2);
|
||||
$scope.$broadcast('JSONContentReady', { data: $scope.JSONContent });
|
||||
} catch (error) {
|
||||
$scope.JSONContent = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user