All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webapp.scripts.app.settings.tokens.token.new.controller.js Maven / Gradle / Ivy

Go to download

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();
    };
  });




© 2015 - 2024 Weber Informatics LLC | Privacy Policy