From 48e514a8d17a1fac67d5d2d492644da01f868ce0 Mon Sep 17 00:00:00 2001 From: llis <2227043858@qq.com> Date: Mon, 1 Jan 2024 11:40:09 +0800 Subject: [PATCH 1/2] Updated API save button logic and auto-close dialog --- .../users/apikey/apikey.controller.js | 18 +++++++++++++++++- .../views/users/apikey/apikey.model.html | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/myems-admin/app/controllers/users/apikey/apikey.controller.js b/myems-admin/app/controllers/users/apikey/apikey.controller.js index a957488ff0..9ac26e9e84 100644 --- a/myems-admin/app/controllers/users/apikey/apikey.controller.js +++ b/myems-admin/app/controllers/users/apikey/apikey.controller.js @@ -1,6 +1,7 @@ 'use strict'; app.controller('ApiKeyController', function ( $scope, + $rootScope, $window, $uibModal, ApiKeyService, @@ -49,6 +50,7 @@ app.controller('ApiKeyController', function ( }, function () { }); + $rootScope.modalInstance = modalInstance; }; $scope.editApiKey = function (apiKey) { @@ -87,6 +89,7 @@ app.controller('ApiKeyController', function ( }, function () { //do nothing; }); + $rootScope.modalInstance = modalInstance; }; $scope.deleteApiKey = function (apiKey) { @@ -127,10 +130,16 @@ app.controller('ApiKeyController', function ( }; $scope.getAllApiKeys(); - }); app.controller('ModalAddApiKeyCtrl', function ($scope, $uibModalInstance) { + $scope.isButtonDisabled = function() { + if ($scope.apiKey.name && $scope.apiKey.expires_datetime_utc > $scope.apiKey.created_datetime_utc) { + return false; + } else { + return true; + } + }; $scope.operation = "USER.ADD_API_KEY"; $scope.apiKey = { created_datetime_utc:moment(), @@ -162,6 +171,13 @@ app.controller('ModalAddApiKeyCtrl', function ($scope, $uibModalInstance) { app.controller('ModalEditApiKeyCtrl', function ($scope, $uibModalInstance, params) { + $scope.isButtonDisabled = function() { + if ($scope.apiKey.name && $scope.apiKey.expires_datetime_utc > $scope.apiKey.created_datetime_utc) { + return false; + } else { + return true; + } + }; $scope.operation = "USER.EDIT_API_KEY"; $scope.apiKey = params.apiKey; $scope.flag = false; diff --git a/myems-admin/views/users/apikey/apikey.model.html b/myems-admin/views/users/apikey/apikey.model.html index acad050b96..498dfb419c 100644 --- a/myems-admin/views/users/apikey/apikey.model.html +++ b/myems-admin/views/users/apikey/apikey.model.html @@ -43,6 +43,6 @@