mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 09:55:18 +00:00
Prevents app load if empty array
This commit is contained in:
parent
2804e440e1
commit
4d96063b52
@ -129,6 +129,13 @@ app.controller('settingsController', function ($scope, $rootScope, $http, $route
|
|||||||
try {
|
try {
|
||||||
const patternList = await genericReq.request('GET','/get-list',{});
|
const patternList = await genericReq.request('GET','/get-list',{});
|
||||||
$scope.indexPatterns = patternList.data.data;
|
$scope.indexPatterns = patternList.data.data;
|
||||||
|
|
||||||
|
if(!patternList.data.data.length){
|
||||||
|
$rootScope.blankScreenError = 'Sorry but your user has no access to any valid index pattern'
|
||||||
|
$location.search('tab',null);
|
||||||
|
$location.path('/blank-screen');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const data = await genericReq.request('GET', '/api/wazuh-api/apiEntries');
|
const data = await genericReq.request('GET', '/api/wazuh-api/apiEntries');
|
||||||
for(const entry of data.data) $scope.showEditForm[entry._id] = false;
|
for(const entry of data.data) $scope.showEditForm[entry._id] = false;
|
||||||
|
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
require('ui/modules').get('app/wazuh', [])
|
require('ui/modules').get('app/wazuh', [])
|
||||||
.service('patternHandler', function ($rootScope, $route, genericReq, courier, appState, errorHandler) {
|
.service('patternHandler', function ($rootScope, $route, $location, genericReq, courier, appState, errorHandler) {
|
||||||
return {
|
return {
|
||||||
getPatternList: async () => {
|
getPatternList: async () => {
|
||||||
try {
|
try {
|
||||||
const patternList = await genericReq.request('GET','/get-list',{});
|
const patternList = await genericReq.request('GET','/get-list',{});
|
||||||
|
|
||||||
|
if(!patternList.data.data.length){
|
||||||
|
$rootScope.blankScreenError = 'Sorry but your user has no access to any valid index pattern'
|
||||||
|
$location.search('tab',null);
|
||||||
|
$location.path('/blank-screen');
|
||||||
|
return;
|
||||||
|
}
|
||||||
return patternList.data.data;
|
return patternList.data.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
errorHandler.handle(error,'Pattern Handler (getPatternList)');
|
errorHandler.handle(error,'Pattern Handler (getPatternList)');
|
||||||
|
Loading…
Reference in New Issue
Block a user