webapp.scripts.app.settings.tokens.token.new.controller.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of centraldogma-server Show documentation
Show all versions of centraldogma-server Show documentation
Highly-available version-controlled service configuration repository based on Git, ZooKeeper and HTTP/2 (centraldogma-server)
The newest version!
'use strict';
angular.module('CentralDogmaAdmin').controller('TokenNewController',
function ($scope, $timeout, $uibModal, $uibModalInstance, $filter, SettingsService, NotificationUtil) {
$scope.isAdmin = false;
$scope.generateToken = function (isAdmin) {
var data = 'appId=' + encodeURIComponent($scope.appId) + '&isAdmin=' + isAdmin;
SettingsService.createToken(data).then(function (token) {
$scope.newToken = token;
$scope.newToken.creation.timestamp = moment(token.creationTime).fromNow();
$uibModalInstance.close($scope.newToken);
}, function (error) {
if (typeof error.status !== 'undefined' && error.status === 409) {
NotificationUtil.error('settings.token_application_id.exist', {appId: $scope.appId});
} else {
NotificationUtil.error(error);
}
});
};
$scope.close = function () {
$uibModalInstance.close();
};
});