mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 09:55:18 +00:00
Merge branch 'dev-factories-single-file' of https://github.com/jesusgn90/wazuh-kibana-app into jesusgn90-dev-factories-single-file
Conflicts: public/controllers/groups.js
This commit is contained in:
commit
1f4ff21295
@ -30,6 +30,11 @@ require('plugins/wazuh/kibana-integrations/kibanaSearchbarDirective.js');
|
||||
|
||||
// Require controllers
|
||||
|
||||
// Factories
|
||||
require('plugins/wazuh/controllers/common/factories.js');
|
||||
require('plugins/wazuh/controllers/common/filters.js');
|
||||
require('plugins/wazuh/controllers/common/directives.js');
|
||||
|
||||
// Overview
|
||||
require('plugins/wazuh/controllers/overview.js');
|
||||
|
||||
|
@ -2,12 +2,6 @@ import rison from 'rison-node';
|
||||
// Require config
|
||||
let app = require('ui/modules').get('app/wazuh', []);
|
||||
|
||||
// We are using the DataHandler template and customize its path to get information about agents
|
||||
app.factory('AgentsAutoComplete', function (DataHandler) {
|
||||
let AgentsAutoComplete = new DataHandler();
|
||||
AgentsAutoComplete.path = '/agents';
|
||||
return AgentsAutoComplete;
|
||||
});
|
||||
|
||||
app.controller('agentsController',
|
||||
function ($scope, $q, $routeParams, $route, $location, $rootScope, Notifier, appState, genericReq, apiReq, AgentsAutoComplete) {
|
||||
|
@ -1,12 +1,5 @@
|
||||
let app = require('ui/modules').get('app/wazuh', []);
|
||||
|
||||
// We are using the DataHandler template and customize its path to get information about agents
|
||||
app.factory('Agents', function (DataHandler) {
|
||||
let Agents = new DataHandler();
|
||||
Agents.path = '/agents';
|
||||
return Agents;
|
||||
});
|
||||
|
||||
app.controller('agentsPreviewController', function ($scope, Notifier, genericReq, apiReq, appState, Agents) {
|
||||
const notify = new Notifier({ location: 'Agents - Preview' });
|
||||
$scope.loading = true;
|
||||
|
14
public/controllers/common/directives.js
Normal file
14
public/controllers/common/directives.js
Normal file
@ -0,0 +1,14 @@
|
||||
const app = require('ui/modules').get('app/wazuh', []);
|
||||
app
|
||||
.directive('dynamic', function($compile) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
replace: true,
|
||||
link: function(scope, ele, attrs) {
|
||||
scope.$watch(attrs.dynamic, function(html) {
|
||||
ele.html(html);
|
||||
$compile(ele.contents())(scope);
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
41
public/controllers/common/factories.js
Normal file
41
public/controllers/common/factories.js
Normal file
@ -0,0 +1,41 @@
|
||||
const app = require('ui/modules').get('app/wazuh', []);
|
||||
|
||||
app
|
||||
.factory('Groups', function(DataHandler) {
|
||||
let Groups = new DataHandler();
|
||||
Groups.path = '/agents/groups';
|
||||
return Groups;
|
||||
})
|
||||
.factory('GroupAgents', function(DataHandler) {
|
||||
return new DataHandler();
|
||||
})
|
||||
.factory('GroupFiles', function(DataHandler) {
|
||||
return new DataHandler();
|
||||
})
|
||||
.factory('AgentsAutoComplete', function (DataHandler) {
|
||||
let AgentsAutoComplete = new DataHandler();
|
||||
AgentsAutoComplete.path = '/agents';
|
||||
return AgentsAutoComplete;
|
||||
})
|
||||
.factory('Agents', function (DataHandler) {
|
||||
let Agents = new DataHandler();
|
||||
Agents.path = '/agents';
|
||||
return Agents;
|
||||
})
|
||||
.factory('Logs', function (DataHandler) {
|
||||
let Logs = new DataHandler();
|
||||
Logs.path = '/manager/logs';
|
||||
return Logs;
|
||||
})
|
||||
.factory('Rules', function (DataHandler) {
|
||||
let Rules = new DataHandler();
|
||||
Rules.path = '/rules';
|
||||
return Rules;
|
||||
})
|
||||
.factory('Decoders', function (DataHandler) {
|
||||
let Decoders = new DataHandler();
|
||||
Decoders.path = '/decoders';
|
||||
return Decoders;
|
||||
});
|
||||
|
||||
|
8
public/controllers/common/filters.js
Normal file
8
public/controllers/common/filters.js
Normal file
@ -0,0 +1,8 @@
|
||||
const app = require('ui/modules').get('app/wazuh', []);
|
||||
|
||||
app
|
||||
.filter('prettyJSON', function() {
|
||||
return function(json) {
|
||||
return angular.toJson(json, true);
|
||||
};
|
||||
})
|
@ -1,39 +1,5 @@
|
||||
let app = require('ui/modules').get('app/wazuh', []);
|
||||
const beautifier = require('plugins/wazuh/utils/json-beautifier');
|
||||
// We are using the DataHandler template and customize its path to get information about groups
|
||||
app
|
||||
.factory('Groups', function(DataHandler) {
|
||||
let Groups = new DataHandler();
|
||||
Groups.path = '/agents/groups';
|
||||
return Groups;
|
||||
})
|
||||
.factory('GroupAgents', function(DataHandler) {
|
||||
return new DataHandler();
|
||||
})
|
||||
.factory('GroupFiles', function(DataHandler) {
|
||||
return new DataHandler();
|
||||
})
|
||||
.filter('prettyJSON', function() {
|
||||
return function(json) {
|
||||
return angular.toJson(json, true);
|
||||
};
|
||||
})
|
||||
.directive('dynamic', function($compile) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
replace: true,
|
||||
link: function(scope, ele, attrs) {
|
||||
scope.$watch(attrs.dynamic, function(html) {
|
||||
ele.html(html);
|
||||
$compile(ele.contents())(scope);
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
app.filter('prettyJSON', function () {
|
||||
return function(json) { return angular.toJson(json, true); };
|
||||
});
|
||||
|
||||
// Groups preview controller
|
||||
app.controller('groupsPreviewController',
|
||||
|
@ -1,12 +1,5 @@
|
||||
let app = require('ui/modules').get('app/wazuh', []);
|
||||
|
||||
// We are using the DataHandler template and customize its path to get information about logs
|
||||
app.factory('Logs', function (DataHandler) {
|
||||
let Logs = new DataHandler();
|
||||
Logs.path = '/manager/logs';
|
||||
return Logs;
|
||||
});
|
||||
|
||||
// Logs controller
|
||||
app.controller('managerLogController', function ($scope, Logs, apiReq) {
|
||||
$scope.searchTerm = '';
|
||||
|
@ -1,18 +1,5 @@
|
||||
var app = require('ui/modules').get('app/wazuh');
|
||||
|
||||
// We are using the DataHandler template and customize its path to get information
|
||||
app.factory('Rules', function (DataHandler) {
|
||||
var Rules = new DataHandler();
|
||||
Rules.path = '/rules';
|
||||
return Rules;
|
||||
});
|
||||
|
||||
app.factory('Decoders', function (DataHandler) {
|
||||
var Decoders = new DataHandler();
|
||||
Decoders.path = '/decoders';
|
||||
return Decoders;
|
||||
});
|
||||
|
||||
app.controller('rulesController', function ($scope, Notifier, Rules) {
|
||||
//Initialization
|
||||
const notify = new Notifier({ location: 'Manager - Rules' });
|
||||
|
Loading…
Reference in New Issue
Block a user