Compare commits

...

2 Commits

Author SHA1 Message Date
Felix Han
dceeb3a757 fix(app): CE-478 removed comments 2021-03-16 09:24:22 +13:00
xAt0mZ
da5c570968 fix(app): EndpointProvider fallback on URL EndpointID when no endpoint is selected 2021-03-09 13:59:55 +13:00
2 changed files with 16 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ class KubernetesConfigureController {
constructor(
$async,
$state,
$stateParams,
$transition$,
Notifications,
KubernetesStorageService,
EndpointService,
@@ -24,7 +24,7 @@ class KubernetesConfigureController {
) {
this.$async = $async;
this.$state = $state;
this.$stateParams = $stateParams;
this.$transition$ = $transition$;
this.Notifications = Notifications;
this.KubernetesStorageService = KubernetesStorageService;
this.EndpointService = EndpointService;
@@ -210,7 +210,7 @@ class KubernetesConfigureController {
actionInProgress: false,
displayConfigureClassPanel: {},
viewReady: false,
endpointId: this.$stateParams.id,
endpointId: this.$transition$.params().id,
duplicates: {
ingressClasses: new KubernetesFormValidationReferences(),
},

View File

@@ -1,8 +1,9 @@
import _ from 'lodash-es';
angular.module('portainer.app').factory('EndpointProvider', [
'LocalStorage',
function EndpointProviderFactory(LocalStorage) {
angular.module('portainer.app').factory(
'EndpointProvider',
/* @ngInject */
function EndpointProviderFactory(LocalStorage, $uiRouterGlobals) {
'use strict';
var service = {};
var endpoint = {};
@@ -36,9 +37,16 @@ angular.module('portainer.app').factory('EndpointProvider', [
if (endpoint.ID === undefined) {
endpoint.ID = LocalStorage.getEndpointID();
}
if (endpoint.ID === null || endpoint.ID === undefined) {
return service.getUrlEndpointID();
}
return endpoint.ID;
};
service.getUrlEndpointID = () => {
return $uiRouterGlobals.params.id;
};
service.setEndpointID = function (id) {
endpoint.ID = id;
LocalStorage.storeEndpointID(id);
@@ -88,5 +96,5 @@ angular.module('portainer.app').factory('EndpointProvider', [
};
return service;
},
]);
}
);