Add a "Download dockercfg" link to the token view

This commit is contained in:
Joseph Schorr 2013-10-22 22:39:36 -04:00
parent d51ab5952b
commit 08c365be28
6 changed files with 438 additions and 0 deletions

View file

@ -498,6 +498,25 @@ function RepoAdminCtrl($scope, Restangular, $routeParams, $rootScope) {
});
});
$scope.isDownloadSupported = function() {
try { return !!new Blob(); } catch(e){}
return false;
};
$scope.downloadCfg = function(token) {
var auth = $.base64.encode("$token:" + token.code);
config = {
"https://quay.io/v1/": {
"auth": auth,
"email": ""
}
};
var file = JSON.stringify(config, null, ' ');
var blob = new Blob([file]);
saveAs(blob, token.friendlyName + "-dockercfg");
};
$scope.addNewPermission = function(username) {
// Don't allow duplicates.
if ($scope.permissions[username]) { return; }