fix(core/home): fix an issue when connecting to an Edge kubernetes endpoint (#4274)

pull/4280/head
Anthony Lapenna 2020-08-27 00:26:21 +12:00 committed by GitHub
parent eb0278d230
commit 0019b22be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 12 deletions

View File

@ -18,7 +18,7 @@ angular.module('portainer.kubernetes', ['portainer.app']).config([
try {
if (endpoint.Type === 7) {
try {
await KubernetesHealthService.ping();
await KubernetesHealthService.ping(endpoint.Id);
endpoint.Status = 1;
} catch (e) {
endpoint.Status = 2;

View File

@ -1,16 +1,13 @@
angular.module('portainer.kubernetes').factory('KubernetesHealth', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
function KubernetesHealthFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
function KubernetesHealthFactory($resource, API_ENDPOINT_ENDPOINTS) {
'use strict';
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/kubernetes/healthz',
API_ENDPOINT_ENDPOINTS + '/:id/kubernetes/healthz',
{},
{
endpointId: EndpointProvider.endpointID,
},
{
ping: { method: 'GET', timeout: 15000 },
ping: { method: 'GET', timeout: 15000, params: { id: 'id' } },
}
);
},

View File

@ -13,16 +13,16 @@ class KubernetesHealthService {
/**
* PING
*/
async pingAsync() {
async pingAsync(endpointID) {
try {
return await this.KubernetesHealth.ping().$promise;
return await this.KubernetesHealth.ping({ id: endpointID }).$promise;
} catch (err) {
throw new PortainerError('Unable to retrieve environment health', err);
}
}
ping() {
return this.$async(this.pingAsync);
ping(endpointID) {
return this.$async(this.pingAsync, endpointID);
}
}