Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nengyuanzhang committed Jan 1, 2024
2 parents b693344 + 30f2c09 commit eadf496
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- fixed non-standard actions of microgrid in myems-api and myems-admin
- fixed empty qrcode issue when creating objects in myems-admin
- upgraded Font Awesome to v4.7.0 in myems-admin
- fixed api key save button issue in myems-admin
### Removed
-

Expand Down
18 changes: 17 additions & 1 deletion myems-admin/app/controllers/users/apikey/apikey.controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
app.controller('ApiKeyController', function (
$scope,
$rootScope,
$window,
$uibModal,
ApiKeyService,
Expand Down Expand Up @@ -49,6 +50,7 @@ app.controller('ApiKeyController', function (
}, function () {

});
$rootScope.modalInstance = modalInstance;
};

$scope.editApiKey = function (apiKey) {
Expand Down Expand Up @@ -87,6 +89,7 @@ app.controller('ApiKeyController', function (
}, function () {
//do nothing;
});
$rootScope.modalInstance = modalInstance;
};

$scope.deleteApiKey = function (apiKey) {
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion myems-admin/views/users/apikey/apikey.model.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ <h4 class="modal-title">{{operation | translate}}(ID:{{apiKey.id}})</h4>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="cancel()">{{'SETTING.CANCEL' | translate}}</button>
<button type="button" class="btn btn-primary"
ng-click="ok()">{{'SETTING.SAVE' | translate}}</button>
ng-click="ok()" ng-disabled="isButtonDisabled()">{{'SETTING.SAVE' | translate}}</button>
</div>
</div>

0 comments on commit eadf496

Please sign in to comment.