mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 14:59:41 +02:00
* feat(cluster): add tabs * feat(cluster): add cluster status informations to cluster detail view * feat(cluster): change data display * feat(cluster): prevent regular users to see cluster health * feat(kubernetes): reviewed ComponentStatus handling * refactor(kubernetes): review apiToModel for KubernetesComponentStatus * refactor(kubernetes): remove unused variable * refactor(kubernetes): clean hasUnhealthyComponentStatus code Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
34 lines
995 B
JavaScript
34 lines
995 B
JavaScript
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);
|