mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +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>
21 lines
644 B
JavaScript
21 lines
644 B
JavaScript
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;
|
|
}
|
|
}
|