mirror of https://github.com/portainer/portainer
fix(app): extensions status retrieval (#2910)
* fix(rbac): extensions status retrieval not interrupted anymore * refactor(extensions): change endpoint used to retrieve extension activation statuspull/2877/head
parent
086d4f1d1c
commit
5388585ef1
|
@ -60,8 +60,9 @@ angular.module('portainer.app')
|
|||
if (extensionId === service.EXTENSIONS.RBAC) {
|
||||
return StateManager.getExtension(extensionId) ? true : false;
|
||||
} else {
|
||||
const extension = await Extension.get({id: extensionId}).$promise;
|
||||
return extension.Enabled;
|
||||
const extensions = await service.extensions(false);
|
||||
const extension = _.find(extensions, (ext) => ext.Id === extensionId);
|
||||
return extension ? extension.Enabled : false;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ function($q, $scope, $state, $stateParams, $sanitize, Authentication, UserServic
|
|||
OAuthProvider: ''
|
||||
};
|
||||
|
||||
function retrieveAndSaveEnabledExtensions() {
|
||||
async function retrieveAndSaveEnabledExtensions() {
|
||||
try {
|
||||
ExtensionService.retrieveAndSaveEnabledExtensions();
|
||||
await ExtensionService.retrieveAndSaveEnabledExtensions();
|
||||
} catch (err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve enabled extensions');
|
||||
}
|
||||
|
@ -28,7 +28,9 @@ function($q, $scope, $state, $stateParams, $sanitize, Authentication, UserServic
|
|||
|
||||
Authentication.login(username, password)
|
||||
.then(function success() {
|
||||
retrieveAndSaveEnabledExtensions();
|
||||
return retrieveAndSaveEnabledExtensions();
|
||||
})
|
||||
.then(function () {
|
||||
checkForEndpoints();
|
||||
})
|
||||
.catch(function error() {
|
||||
|
@ -40,7 +42,9 @@ function($q, $scope, $state, $stateParams, $sanitize, Authentication, UserServic
|
|||
return $q.reject();
|
||||
})
|
||||
.then(function success() {
|
||||
retrieveAndSaveEnabledExtensions();
|
||||
return retrieveAndSaveEnabledExtensions();
|
||||
})
|
||||
.then(function() {
|
||||
$state.go('portainer.updatePassword');
|
||||
})
|
||||
.catch(function error() {
|
||||
|
@ -141,7 +145,9 @@ function($q, $scope, $state, $stateParams, $sanitize, Authentication, UserServic
|
|||
function oAuthLogin(code) {
|
||||
return Authentication.OAuthLogin(code)
|
||||
.then(function success() {
|
||||
retrieveAndSaveEnabledExtensions();
|
||||
return retrieveAndSaveEnabledExtensions();
|
||||
})
|
||||
.then(function() {
|
||||
URLHelper.cleanParameters();
|
||||
})
|
||||
.catch(function error() {
|
||||
|
|
|
@ -30,7 +30,8 @@ angular.module('portainer.app')
|
|||
$scope.state.actionInProgress = true;
|
||||
ExtensionService.enable(license)
|
||||
.then(function onSuccess() {
|
||||
ExtensionService.retrieveAndSaveEnabledExtensions();
|
||||
return ExtensionService.retrieveAndSaveEnabledExtensions();
|
||||
}).then(function () {
|
||||
Notifications.success('Extension successfully enabled');
|
||||
$state.reload();
|
||||
})
|
||||
|
|
|
@ -14,9 +14,9 @@ function ($scope, $state, Notifications, Authentication, StateManager, UserServi
|
|||
actionInProgress: false
|
||||
};
|
||||
|
||||
function retrieveAndSaveEnabledExtensions() {
|
||||
async function retrieveAndSaveEnabledExtensions() {
|
||||
try {
|
||||
ExtensionService.retrieveAndSaveEnabledExtensions();
|
||||
await ExtensionService.retrieveAndSaveEnabledExtensions();
|
||||
} catch (err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve enabled extensions');
|
||||
}
|
||||
|
@ -32,7 +32,9 @@ function ($scope, $state, Notifications, Authentication, StateManager, UserServi
|
|||
return Authentication.login(username, password);
|
||||
})
|
||||
.then(function success() {
|
||||
retrieveAndSaveEnabledExtensions();
|
||||
return retrieveAndSaveEnabledExtensions();
|
||||
})
|
||||
.then(function () {
|
||||
return EndpointService.endpoints();
|
||||
})
|
||||
.then(function success(data) {
|
||||
|
|
Loading…
Reference in New Issue