1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

refactor(app): backport technical changes (#4679)

* refactor(app): backport technical changes

* refactor(app): remove EE only features

* feat(app): small review changes to match EE codebase layout on some files

Co-authored-by: xAt0mZ <baron_l@epitech.eu>
This commit is contained in:
Alice Groux 2021-02-26 16:50:33 +01:00 committed by GitHub
parent 158bdae10e
commit ccf6babc02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 951 additions and 976 deletions

View file

@ -1,4 +1,9 @@
import _ from 'lodash-es';
import { KubernetesResourcePool } from 'Kubernetes/models/resource-pool/models';
import { KubernetesNamespace } from 'Kubernetes/models/namespace/models';
import { KubernetesIngressConverter } from 'Kubernetes/ingress/converter';
import KubernetesResourceQuotaConverter from './resourceQuota';
class KubernetesResourcePoolConverter {
static apiToResourcePool(namespace) {
@ -7,6 +12,24 @@ class KubernetesResourcePoolConverter {
res.Yaml = namespace.Yaml;
return res;
}
static formValuesToResourcePool(formValues) {
const namespace = new KubernetesNamespace();
namespace.Name = formValues.Name;
namespace.ResourcePoolName = formValues.Name;
namespace.ResourcePoolOwner = formValues.Owner;
const quota = KubernetesResourceQuotaConverter.resourcePoolFormValuesToResourceQuota(formValues);
const ingMap = _.map(formValues.IngressClasses, (c) => {
if (c.Selected) {
c.Namespace = namespace.Name;
return KubernetesIngressConverter.resourcePoolIngressClassFormValueToIngress(c);
}
});
const ingresses = _.without(ingMap, undefined);
return [namespace, quota, ingresses];
}
}
export default KubernetesResourcePoolConverter;