Using angularjs instead of JS code

This commit is contained in:
root 2017-06-07 12:02:08 +02:00
parent e3a3730142
commit 844af23ab4
21 changed files with 15 additions and 43 deletions

View File

@ -2,6 +2,4 @@
var app = require('ui/modules').get('app/wazuh', []);
app.controller('auditController', function ($scope, $q, DataFactory, errlog) {
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
});

View File

@ -2,7 +2,5 @@
var app = require('ui/modules').get('app/wazuh', []);
app.controller('fimController', function ($scope, $q, DataFactory, errlog) {
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
$scope._fimEvent = 'all'
});

View File

@ -2,7 +2,5 @@
var app = require('ui/modules').get('app/wazuh', []);
app.controller('oscapController', function ($scope, DataFactory, errlog, appState) {
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
$scope.defaultManagerName = appState.getDefaultManager().name;
});

View File

@ -2,7 +2,5 @@
var app = require('ui/modules').get('app/wazuh', []);
app.controller('agentsOverviewController', function ($scope, DataFactory, appState) {
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
$scope.defaultManagerName = appState.getDefaultManager().name;
});

View File

@ -2,8 +2,6 @@
var app = require('ui/modules').get('app/wazuh', []);
app.controller('PCIController', function ($scope, DataFactory, errlog, appState, genericReq) {
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
$scope.defaultManagerName = appState.getDefaultManager().name;
var tabs = [];

View File

@ -2,7 +2,5 @@
var app = require('ui/modules').get('app/wazuh', []);
app.controller('pmController', function ($scope, DataFactory, errlog, appState) {
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
$scope.defaultManagerName = appState.getDefaultManager().name;
});

View File

@ -30,8 +30,6 @@ app.factory('Agents', function($http, DataFactory) {
});
app.controller('agentsPreviewController', function ($scope, DataFactory, Notifier, errlog, genericReq, Agents) {
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
$scope.load = true;
$scope.agents = [];
$scope._status = 'all';

View File

@ -23,8 +23,6 @@ app.controller('managerController', function ($scope, $route, $routeParams, $loc
app.controller('managerStatusController', function ($scope, DataFactory, genericReq, errlog, Notifier) {
//Initialization
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
$scope.load = true;
$scope.timeFilter = "24h";
const notify = new Notifier({location: 'Manager - Status'});
@ -101,8 +99,6 @@ app.controller('managerStatusController', function ($scope, DataFactory, generic
app.controller('managerConfigurationController', function ($scope, DataFactory, errlog, Notifier) {
//Initialization
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
$scope.load = true;
$scope.isArray = angular.isArray;
const notify = new Notifier({location: 'Manager - Configuration'});

View File

@ -3,7 +3,6 @@ import chrome from 'ui/chrome';
var app = require('ui/modules').get('app/wazuh', []);
app.controller('overviewController', function ($scope, appState, $window, genericReq, $q, $routeParams, $route, $location, $http, $rootScope) {
$scope.state = appState;
$scope.defaultManager = $scope.state.getDefaultManager().name;
$scope.extensions = $scope.state.getExtensions().extensions;
@ -123,8 +122,6 @@ app.controller('overviewController', function ($scope, appState, $window, generi
});
app.controller('overviewGeneralController', function ($scope, DataFactory, genericReq, errlog, $route) {
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
$scope.load = true;
$scope.$parent.state.setOverviewState('general');
$scope.defaultManager = $scope.$parent.state.getDefaultManager().name;

View File

@ -55,8 +55,6 @@ app.factory('Decoders', function($http, DataFactory) {
app.controller('rulesController', function ($scope, $q, DataFactory, Notifier, errlog, $window, $document, Rules) {
//Initialization
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="block";
$scope.load = true;
$scope.setRulesTab('rules');
$scope.ruleActive = false;
@ -490,4 +488,4 @@ app.controller('decodersController', function ($scope, $q, $sce, DataFactory, No
});
$scope.decoders.length = 0;
});
});
});

View File

@ -17,8 +17,7 @@ var app = require('ui/modules').get('app/wazuh', [])
visWidth: '@visWidth',
visSearchable: '@visSearchable',
visClickable: '@visClickable',
visTimefilter: '@visTimefilter',
showRing: '@showRing'
visTimefilter: '@visTimefilter'
},
template: require('../templates/directives/kibana-visualization-template.html')
}
@ -203,10 +202,7 @@ require('ui/modules').get('app/wazuh', []).controller('VisController', function
$scope.$on('$destroy', updateQueryWatch);
$scope.$on('$destroy', fetchVisualizationWatch);
$scope.$on('$destroy', visFilterWatch);
if($scope.showRing == 'hide'){
var ring = document.getElementsByClassName("uil-ring-css");
ring[0].style.display="none";
}
};
});

View File

@ -54,7 +54,6 @@ body{
}
}
div.uil-ring-css {
display:none;
margin:auto;
}
.uil-ring-css {

View File

@ -1,6 +1,6 @@
import chrome from 'ui/chrome';
require('ui/modules').get('app/wazuh', [])
.service('errlog', function ($q, $http, genericReq) {
.service('errlog', function ($q, $http) {
return {
log: function (message, details) {
var defered = $q.defer();
@ -16,7 +16,7 @@ require('ui/modules').get('app/wazuh', [])
'details': details
}
genericReq.request('POST', '/api/wazuh-api/errlog', requestData)
$http.post(chrome.addBasePath('/api/wazuh-api/errlog'), requestData)
.then(function () {
defered.resolve();
}, function (data) {

View File

@ -1,12 +1,12 @@
import chrome from 'ui/chrome';
require('ui/modules').get('app/wazuh', [])
.service('testConnection', function ($q, $http, genericReq) {
.service('testConnection', function ($q, $http) {
return {
check_stored: function () {
var defered = $q.defer();
var promise = defered.promise;
genericReq.request("GET", "/api/wazuh-api/check")
$http.get(chrome.addBasePath("/api/wazuh-api/check"))
.then(function (data) {
if (data.error) {
defered.reject(data);
@ -22,7 +22,7 @@ require('ui/modules').get('app/wazuh', [])
check: function (data) {
var defered = $q.defer();
var promise = defered.promise;
genericReq.request("POST", "/api/wazuh-api/check", data)
$http.post(chrome.addBasePath("/api/wazuh-api/check"), data)
.then(function (data) {
if (data.error) {
defered.reject(data);

View File

@ -2,7 +2,7 @@
<!-- Kibana search bar -->
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-show="load"><div></div></div>
<div class='uil-ring-css' ng-show='chrome.httpActive.length'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels'">
<md-card flex layout="column">

View File

@ -2,7 +2,7 @@
<!-- Kibana search bar -->
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-show="load"><div></div></div>
<div class='uil-ring-css' ng-show='chrome.httpActive.length'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels'">
<md-card flex layout="column">

View File

@ -2,7 +2,7 @@
<!-- Kibana search bar -->
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-show="load"><div></div></div>
<div class='uil-ring-css' ng-show='chrome.httpActive.length'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels'">
<md-card flex layout="column">

View File

@ -2,7 +2,7 @@
<!-- Kibana search bar -->
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-show="load"><div></div></div>
<div class='uil-ring-css' ng-show='chrome.httpActive.length'><div></div></div>
<div ng-if="tabView == 'panels'">
<md-content layout="row">
<md-card flex layout="column">

View File

@ -2,7 +2,7 @@
<!-- Kibana search bar -->
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-show="load"><div></div></div>
<div class='uil-ring-css' ng-show='chrome.httpActive.length'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels'">
<md-card flex layout="column">

View File

@ -2,7 +2,7 @@
<!-- Kibana search bar -->
<kbn-searchbar ng-if="tabView == 'panels'"></kbn-searchbar>
<div class='uil-ring-css' ng-show="load"><div></div></div>
<div class='uil-ring-css' ng-show='chrome.httpActive.length'><div></div></div>
<!-- No results message -->
<md-content flex layout="row" layout-align="start start" ng-if="!results && tabView == 'panels'">
<md-card flex layout="column">

View File

@ -1,6 +1,6 @@
<div ng-if="submenuNavItem == 'preview'">
<md-content flex class="agentsPreview" ng-controller="agentsPreviewController" layout="column" style="height: 100%;" class="md-padding" layout-align="start space-around">
<div class='uil-ring-css'><div></div></div>
<div class='uil-ring-css' ng-show='chrome.httpActive.length'><div></div></div>
<div infinite-scroll-module='agents.nextPage()' infinite-scroll-disabled='agents.busy' infinite-scroll-distance='0' style="padding: 0">
<md-progress-linear class="md-accent" md-mode="indeterminate" ng-show="load"></md-progress-linear>
<div flex layout="column" layout-align="space-between stretch">