Moved "hideWzMenu" to resolving section

This commit is contained in:
JuanCarlos 2019-08-28 08:35:18 +02:00 committed by Jesús Ángel
parent 06fd16edc1
commit 789bf1fd04
3 changed files with 21 additions and 14 deletions

View File

@ -111,7 +111,6 @@ app.run(function($rootScope, $route, $location, appState, $window) {
$rootScope.$on('$locationChangeSuccess', () => {
const navigation = appState.getNavigation();
$rootScope.hideWzMenu = navigation.currLocation === '/health-check';
appState.setNavigation({ currLocation: $location.path() });
if (navigation.currLocation !== navigation.prevLocation) {
if (navigation.discoverSections.includes(navigation.currLocation)) {
@ -240,4 +239,4 @@ uiModules.get('kibana').provider('dashboardConfig', () => {
};
}
};
});
});

View File

@ -198,7 +198,6 @@ export function settingsWizard(
genericReq
.request('GET', '/elastic/apis')
.then(data => {
appState.setWzMenu();
if (data.data.length > 0) {
const apiEntries = data.data;
appState.setCurrentAPI(
@ -229,7 +228,6 @@ export function settingsWizard(
genericReq
.request('GET', '/elastic/apis')
.then(data => {
appState.setWzMenu();
if (
data.data.length > 0 &&
data.data.find(x => x['_id'] == apiId)
@ -259,8 +257,9 @@ export function settingsWizard(
});
}
}
appState.setWzMenu();
return deferred.promise;
} catch (error) {
!disableErrors && errorHandler.handle(error);
}
}
}

View File

@ -128,6 +128,10 @@ function wzConfig($q, genericReq, wazuhConfig, $rootScope, $location) {
function wzKibana($location, $window, $rootScope) {
assignPreviousLocation($rootScope, $location);
// Sets ?_a=(columns:!(_source),filters:!())
$location.search('_a', '(columns:!(_source),filters:!())');
// Removes ?_g
$location.search('_g', null);
return goToKibana($location, $window);
}
@ -136,6 +140,11 @@ function clearRuleId(commonData) {
return Promise.resolve();
}
function enableWzMenu($rootScope, $location) {
const location = $location.path();
$rootScope.hideWzMenu = location.includes('/health-check');
}
//Routes
routes.enable();
routes
@ -145,27 +154,27 @@ routes
})
.when('/agents/:id?/:tab?/:view?', {
template: agentsTemplate,
resolve: { nestedResolve, ip, savedSearch }
resolve: { enableWzMenu, nestedResolve, ip, savedSearch }
})
.when('/agents-preview/', {
template: agentsPrevTemplate,
resolve: { nestedResolve, ip, savedSearch }
resolve: { enableWzMenu, nestedResolve, ip, savedSearch }
})
.when('/manager/', {
template: managementTemplate,
resolve: { nestedResolve, ip, savedSearch, clearRuleId }
resolve: { enableWzMenu, nestedResolve, ip, savedSearch, clearRuleId }
})
.when('/overview/', {
template: overviewTemplate,
resolve: { nestedResolve, ip, savedSearch }
resolve: { enableWzMenu, nestedResolve, ip, savedSearch }
})
.when('/wazuh-discover/', {
template: discoverTemplate,
resolve: { nestedResolve, ip, savedSearch }
resolve: { enableWzMenu, nestedResolve, ip, savedSearch }
})
.when('/settings', {
template: settingsTemplate,
resolve: { nestedResolve, ip, savedSearch }
resolve: { enableWzMenu, nestedResolve, ip, savedSearch }
})
.when('/visualize/create?', {
redirectTo: function() {},
@ -181,11 +190,11 @@ routes
})
.when('/wazuh-dev', {
template: devToolsTemplate,
resolve: { nestedResolve }
resolve: { enableWzMenu, nestedResolve }
})
.when('/blank-screen', {
template: blankScreenTemplate,
resolve: { wzConfig }
resolve: { enableWzMenu, wzConfig }
})
.when('/', {
redirectTo: '/overview/'
@ -195,4 +204,4 @@ routes
})
.otherwise({
redirectTo: '/overview'
});
});