Merge pull request #1217 from stianst/master

KEYCLOAK-1254
This commit is contained in:
Stian Thorgersen 2015-05-05 06:16:12 +02:00
commit 5cb11b9036

View file

@ -486,31 +486,38 @@ module.controller('ClientInstallationCtrl', function($scope, realm, client, Clie
$scope.installation = null; $scope.installation = null;
$scope.download = null; $scope.download = null;
$scope.configFormat = null; $scope.configFormat = null;
$scope.filename = null;
$scope.configFormats = [ $scope.configFormats = [
"keycloak.json", "Keycloak JSON",
"Wildfly/JBoss Subsystem XML" "Wildfly/EAP Subsystem XML"
]; ];
$scope.changeFormat = function() { $scope.changeFormat = function() {
if ($scope.configFormat == "keycloak.json") { if ($scope.configFormat == "Keycloak JSON") {
$scope.filename = 'keycloak.json';
var url = ClientInstallation.url({ realm: $routeParams.realm, client: $routeParams.client }); var url = ClientInstallation.url({ realm: $routeParams.realm, client: $routeParams.client });
$http.get(url).success(function(data) { $http.get(url).success(function(data) {
var tmp = angular.fromJson(data); var tmp = angular.fromJson(data);
$scope.installation = angular.toJson(tmp, true); $scope.installation = angular.toJson(tmp, true);
$scope.type = 'application/json'; $scope.type = 'application/json';
}) })
} else if ($scope.configFormat == "Wildfly/JBoss Subsystem XML") { } else if ($scope.configFormat == "Wildfly/EAP Subsystem XML") {
$scope.filename = 'keycloak.xml';
var url = ClientInstallationJBoss.url({ realm: $routeParams.realm, client: $routeParams.client }); var url = ClientInstallationJBoss.url({ realm: $routeParams.realm, client: $routeParams.client });
$http.get(url).success(function(data) { $http.get(url).success(function(data) {
$scope.installation = data; $scope.installation = data;
$scope.type = 'text/xml'; $scope.type = 'text/xml';
}) })
} }
console.debug($scope.filename);
}; };
$scope.download = function() { $scope.download = function() {
saveAs(new Blob([$scope.installation], { type: $scope.type }), 'keycloak.json'); saveAs(new Blob([$scope.installation], { type: $scope.type }), $scope.filename);
} }
}); });