Merge pull request #3324 from ssilvert/remember-selected-flow

KEYCLOAK-2295: Flow selection forgotten when clicking to a sibling tab.
This commit is contained in:
Stan Silvert 2016-10-17 07:30:51 -04:00 committed by GitHub
commit 8ffb1ecc7d
2 changed files with 21 additions and 11 deletions

View file

@ -1886,14 +1886,12 @@ module.controller('CreateFlowCtrl', function($scope, realm,
};
});
module.controller('CreateExecutionFlowCtrl', function($scope, realm, topFlow, parentFlow, formProviders,
module.controller('CreateExecutionFlowCtrl', function($scope, realm, parentFlow, formProviders,
CreateExecutionFlow,
Notifications, $location) {
$scope.realm = realm;
$scope.formProviders = formProviders;
var returnToTopFlow = parentFlow.topLevel ? parentFlow.alias : topFlow;
var defaultFlowType = parentFlow.providerId == 'client-flow' ? 'client-flow' : 'basic-flow';
$scope.flow = {
alias: "",
@ -1908,23 +1906,21 @@ module.controller('CreateExecutionFlowCtrl', function($scope, realm, topFlow, pa
$scope.save = function() {
$scope.flow.provider = $scope.provider.id;
CreateExecutionFlow.save({realm: realm.realm, alias: parentFlow.alias}, $scope.flow, function() {
$location.url("/realms/" + realm.realm + "/authentication/flows/" + returnToTopFlow);
$location.url("/realms/" + realm.realm + "/authentication/flows");
Notifications.success("Flow Created.");
})
}
$scope.cancel = function() {
$location.url("/realms/" + realm.realm + "/authentication/flows/" + returnToTopFlow);
$location.url("/realms/" + realm.realm + "/authentication/flows");
};
});
module.controller('CreateExecutionCtrl', function($scope, realm, topFlow, parentFlow, formActionProviders, authenticatorProviders, clientAuthenticatorProviders,
module.controller('CreateExecutionCtrl', function($scope, realm, parentFlow, formActionProviders, authenticatorProviders, clientAuthenticatorProviders,
CreateExecution,
Notifications, $location) {
$scope.realm = realm;
$scope.parentFlow = parentFlow;
var returnToTopFlow = parentFlow.topLevel ? parentFlow.alias : topFlow;
if (parentFlow.providerId == 'form-flow') {
$scope.providers = formActionProviders;
} else if (parentFlow.providerId == 'client-flow') {
@ -1943,23 +1939,32 @@ module.controller('CreateExecutionCtrl', function($scope, realm, topFlow, parent
provider: $scope.provider.id
}
CreateExecution.save({realm: realm.realm, alias: parentFlow.alias}, execution, function() {
$location.url("/realms/" + realm.realm + "/authentication/flows/" + returnToTopFlow);
$location.url("/realms/" + realm.realm + "/authentication/flows");
Notifications.success("Execution Created.");
})
}
$scope.cancel = function() {
$location.url("/realms/" + realm.realm + "/authentication/flows/" + returnToTopFlow);
$location.url("/realms/" + realm.realm + "/authentication/flows");
};
});
module.controller('AuthenticationFlowsCtrl', function($scope, $route, realm, flows, selectedFlow,
module.controller('AuthenticationFlowsCtrl', function($scope, $route, realm, flows, selectedFlow, LastFlowSelected,
AuthenticationFlows, AuthenticationFlowsCopy, AuthenticationFlowExecutions,
AuthenticationExecution, AuthenticationExecutionRaisePriority, AuthenticationExecutionLowerPriority,
$modal, Notifications, CopyDialog, $location) {
$scope.realm = realm;
$scope.flows = flows;
if (selectedFlow !== null) {
LastFlowSelected.alias = selectedFlow;
}
if (selectedFlow === null && LastFlowSelected.alias !== null) {
selectedFlow = LastFlowSelected.alias;
}
if (flows.length > 0) {
$scope.flow = flows[0];
if (selectedFlow) {

View file

@ -347,6 +347,11 @@ module.service('UserSearchState', function() {
};
});
// Service tracks the last flow selected in Authentication-->Flows tab
module.service('LastFlowSelected', function() {
this.alias = null;
});
module.factory('UserFederationInstances', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/user-federation/instances/:instance', {
realm : '@realm',