mirror of https://github.com/portainer/portainer
fix(core/home): fix an issue when connecting to an Edge kubernetes endpoint (#4274)
parent
eb0278d230
commit
0019b22be5
|
@ -18,7 +18,7 @@ angular.module('portainer.kubernetes', ['portainer.app']).config([
|
||||||
try {
|
try {
|
||||||
if (endpoint.Type === 7) {
|
if (endpoint.Type === 7) {
|
||||||
try {
|
try {
|
||||||
await KubernetesHealthService.ping();
|
await KubernetesHealthService.ping(endpoint.Id);
|
||||||
endpoint.Status = 1;
|
endpoint.Status = 1;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
endpoint.Status = 2;
|
endpoint.Status = 2;
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
angular.module('portainer.kubernetes').factory('KubernetesHealth', [
|
angular.module('portainer.kubernetes').factory('KubernetesHealth', [
|
||||||
'$resource',
|
'$resource',
|
||||||
'API_ENDPOINT_ENDPOINTS',
|
'API_ENDPOINT_ENDPOINTS',
|
||||||
'EndpointProvider',
|
function KubernetesHealthFactory($resource, API_ENDPOINT_ENDPOINTS) {
|
||||||
function KubernetesHealthFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
|
||||||
'use strict';
|
'use strict';
|
||||||
return $resource(
|
return $resource(
|
||||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/kubernetes/healthz',
|
API_ENDPOINT_ENDPOINTS + '/:id/kubernetes/healthz',
|
||||||
|
{},
|
||||||
{
|
{
|
||||||
endpointId: EndpointProvider.endpointID,
|
ping: { method: 'GET', timeout: 15000, params: { id: 'id' } },
|
||||||
},
|
|
||||||
{
|
|
||||||
ping: { method: 'GET', timeout: 15000 },
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,16 +13,16 @@ class KubernetesHealthService {
|
||||||
/**
|
/**
|
||||||
* PING
|
* PING
|
||||||
*/
|
*/
|
||||||
async pingAsync() {
|
async pingAsync(endpointID) {
|
||||||
try {
|
try {
|
||||||
return await this.KubernetesHealth.ping().$promise;
|
return await this.KubernetesHealth.ping({ id: endpointID }).$promise;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new PortainerError('Unable to retrieve environment health', err);
|
throw new PortainerError('Unable to retrieve environment health', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ping() {
|
ping(endpointID) {
|
||||||
return this.$async(this.pingAsync);
|
return this.$async(this.pingAsync, endpointID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue