Added return to List view on Ruleset button

This commit is contained in:
Juanjo Jiménez 2018-05-07 13:20:11 +02:00
parent 812ea06896
commit 982b74cec7
3 changed files with 26 additions and 3 deletions

View File

@ -33,6 +33,11 @@ app.controller('managerController', function ($scope, $rootScope, $routeParams,
$rootScope.groupsIsReloaded = true;
}
$scope.reloadRuleset = () => {
$scope.submenuNavItem = 'ruleset';
$rootScope.rulesetIsReloaded = true;
}
// Watchers
$scope.$watch('submenuNavItem', () => {
if($scope.submenuNavItem === 'ruleset') {

View File

@ -20,12 +20,20 @@ app.controller('rulesController', function ($scope, $rootScope, Rules, RulesRela
//Initialization
$scope.loading = true;
$scope.viewingDetail = false;
$scope.rules = Rules;
$scope.rulesRelated = RulesRelated;
$scope.rulesAutoComplete = RulesAutoComplete;
$scope.setRulesTab('rules');
$scope.isArray = angular.isArray;
// Reloading watcher initialization
const reloadWatcher = $rootScope.$watch('rulesetIsReloaded',() => {
delete $rootScope.rulesetIsReloaded;
$scope.viewingDetail = false;
if(!$scope.$$phase) $scope.$digest();
});
$scope.analizeRules = async search => {
try {
$scope.rulesAutoComplete.filters = [];
@ -161,6 +169,7 @@ app.controller('rulesController', function ($scope, $rootScope, Rules, RulesRela
$scope.rules.reset();
$scope.rulesRelated.reset();
$scope.rulesAutoComplete.reset();
reloadWatcher();
});
});
@ -169,6 +178,7 @@ app.controller('decodersController', function ($scope, $rootScope, $sce, Decoder
//Initialization
$scope.loading = true;
$scope.viewingDetail = false;
$scope.decoders = Decoders;
$scope.decodersRelated = DecodersRelated;
$scope.decodersAutoComplete = DecodersAutoComplete;
@ -186,6 +196,13 @@ app.controller('decodersController', function ($scope, $rootScope, $sce, Decoder
'#E0F9D7', '#FCEACA', '#CFFAFF', '#F9E2D2', '#FCE2DE', '#BADFF4', '#F9D9F9', '#DEDAF7' //7
];
// Reloading watcher initialization
const reloadWatcher = $rootScope.$watch('rulesetIsReloaded',() => {
delete $rootScope.rulesetIsReloaded;
$scope.viewingDetail = false;
if(!$scope.$$phase) $scope.$digest();
});
$scope.colorRegex = regex => {
regex = regex.toString();
let valuesArray = regex.match(/\(((?!<\/span>).)*?\)(?!<\/span>)/gmi);
@ -332,5 +349,6 @@ app.controller('decodersController', function ($scope, $rootScope, $sce, Decoder
$scope.decoders.reset();
$scope.decodersRelated.reset();
$scope.decodersAutoComplete.reset();
reloadWatcher();
});
});

View File

@ -2,11 +2,11 @@
<wz-menu ng-init="menuNavItem = 'manager'"></wz-menu>
<div layout="row" layout-align="center start">
<div layout="row" layout-align="center start">
<md-nav-bar flex class="pading-right-0 wz-md-navbar" md-selected-nav-item="submenuNavItem" nav-bar-aria-label="navigation submenu">
<md-nav-item md-nav-click="submenuNavItem = 'status'" name="status">Status</md-nav-item>
<md-nav-item md-nav-click="submenuNavItem = 'ruleset'" name="ruleset">Ruleset</md-nav-item>
<md-nav-item md-nav-click="submenuNavItem = 'configuration'" name="configuration">Configuration</md-nav-item>
<md-nav-item md-nav-click="reloadRuleset()" name="ruleset">Ruleset</md-nav-item>
<md-nav-item md-nav-click="submenuNavItem = 'configuration'" name="configuration">Configuration</md-nav-item>
<md-nav-item md-nav-click="submenuNavItem = 'logs'" name="logs">Logs</md-nav-item>
<md-nav-item md-nav-click="reloadGroups()" name="groups">Groups</md-nav-item>
</md-nav-bar>