mirror of https://github.com/portainer/portainer
feat(k8s): remove cluster status panel (#5570)
parent
f0a88b7367
commit
46ffca92fd
@ -1,21 +0,0 @@
|
||||
import _ from 'lodash-es';
|
||||
import { KubernetesComponentStatus } from './models';
|
||||
|
||||
export class KubernetesComponentStatusConverter {
|
||||
/**
|
||||
* Convert API data to KubernetesComponentStatus model
|
||||
*/
|
||||
static apiToModel(data) {
|
||||
const res = new KubernetesComponentStatus();
|
||||
res.ComponentName = data.metadata.name;
|
||||
|
||||
const healthyCondition = _.find(data.conditions, { type: 'Healthy' });
|
||||
if (healthyCondition && healthyCondition.status === 'True') {
|
||||
res.Healthy = true;
|
||||
} else if (healthyCondition && healthyCondition.status === 'False') {
|
||||
res.ErrorMessage = healthyCondition.message;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
/**
|
||||
* KubernetesComponentStatus Model
|
||||
*/
|
||||
const _KubernetesComponentStatus = Object.freeze({
|
||||
ComponentName: '',
|
||||
Healthy: false,
|
||||
ErrorMessage: '',
|
||||
});
|
||||
|
||||
export class KubernetesComponentStatus {
|
||||
constructor() {
|
||||
Object.assign(this, JSON.parse(JSON.stringify(_KubernetesComponentStatus)));
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
angular.module('portainer.kubernetes').factory('KubernetesComponentStatus', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function KubernetesComponentStatusFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return function () {
|
||||
const url = API_ENDPOINT_ENDPOINTS + '/:endpointId/kubernetes/api/v1' + '/componentstatuses/:id';
|
||||
return $resource(
|
||||
url,
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
get: {
|
||||
method: 'GET',
|
||||
ignoreLoadingBar: true,
|
||||
},
|
||||
}
|
||||
);
|
||||
};
|
||||
},
|
||||
]);
|
@ -1,34 +0,0 @@
|
||||
import angular from 'angular';
|
||||
import PortainerError from 'Portainer/error';
|
||||
import _ from 'lodash-es';
|
||||
import { KubernetesComponentStatusConverter } from './converter';
|
||||
|
||||
class KubernetesComponentStatusService {
|
||||
/* @ngInject */
|
||||
constructor($async, KubernetesComponentStatus) {
|
||||
this.$async = $async;
|
||||
this.KubernetesComponentStatus = KubernetesComponentStatus;
|
||||
|
||||
this.getAsync = this.getAsync.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET
|
||||
*/
|
||||
async getAsync() {
|
||||
try {
|
||||
const data = await this.KubernetesComponentStatus().get().$promise;
|
||||
const res = _.map(data.items, (item) => KubernetesComponentStatusConverter.apiToModel(item));
|
||||
return res;
|
||||
} catch (err) {
|
||||
throw new PortainerError('Unable to retrieve cluster status', err);
|
||||
}
|
||||
}
|
||||
|
||||
get() {
|
||||
return this.$async(this.getAsync);
|
||||
}
|
||||
}
|
||||
|
||||
export default KubernetesComponentStatusService;
|
||||
angular.module('portainer.kubernetes').service('KubernetesComponentStatusService', KubernetesComponentStatusService);
|
Loading…
Reference in new issue