You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/kubernetes/component-status/converter.js

22 lines
644 B

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;
}
}