mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
refactor(app): migrate app summary section [EE-6239] (#10910)
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
This commit is contained in:
parent
7a4314032a
commit
abf517de28
61 changed files with 1461 additions and 661 deletions
|
@ -30,7 +30,7 @@ export class KubernetesHorizontalPodAutoScalerConverter {
|
|||
payload.metadata.name = data.TargetEntity.Name;
|
||||
payload.spec.minReplicas = data.MinReplicas;
|
||||
payload.spec.maxReplicas = data.MaxReplicas;
|
||||
payload.spec.targetCPUUtilizationPercentage = data.TargetCPUUtilization;
|
||||
payload.spec.targetCPUUtilizationPercentage = data.targetCpuUtilizationPercentage;
|
||||
payload.spec.scaleTargetRef.apiVersion = data.TargetEntity.ApiVersion;
|
||||
payload.spec.scaleTargetRef.kind = data.TargetEntity.Kind;
|
||||
payload.spec.scaleTargetRef.name = data.TargetEntity.Name;
|
||||
|
@ -48,86 +48,12 @@ export class KubernetesHorizontalPodAutoScalerConverter {
|
|||
const res = new KubernetesHorizontalPodAutoScaler();
|
||||
res.Name = formValues.Name;
|
||||
res.Namespace = formValues.ResourcePool.Namespace.Name;
|
||||
res.MinReplicas = formValues.AutoScaler.MinReplicas;
|
||||
res.MaxReplicas = formValues.AutoScaler.MaxReplicas;
|
||||
res.TargetCPUUtilization = formValues.AutoScaler.TargetCPUUtilization;
|
||||
res.MinReplicas = formValues.AutoScaler.minReplicas;
|
||||
res.MaxReplicas = formValues.AutoScaler.maxReplicas;
|
||||
res.TargetCPUUtilization = formValues.AutoScaler.targetCpuUtilizationPercentage;
|
||||
res.TargetEntity.Name = formValues.Name;
|
||||
res.TargetEntity.Kind = kind;
|
||||
res.TargetEntity.ApiVersion = formValues.AutoScaler.ApiVersion;
|
||||
res.TargetEntity.ApiVersion = formValues.AutoScaler.apiVersion;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convertion functions to use with v2beta2 model
|
||||
*/
|
||||
|
||||
// static apiToModel(data, yaml) {
|
||||
// const res = new KubernetesHorizontalPodAutoScaler();
|
||||
// res.Id = data.metadata.uid;
|
||||
// res.Namespace = data.metadata.namespace;
|
||||
// res.Name = data.metadata.name;
|
||||
// res.MinReplicas = data.spec.minReplicas;
|
||||
// res.MaxReplicas = data.spec.maxReplicas;
|
||||
// res.TargetCPUUtilization = data.spec.targetCPUUtilization;
|
||||
|
||||
// _.forEach(data.spec.metrics, (metric) => {
|
||||
// if (metric.type === 'Resource') {
|
||||
// if (metric.resource.name === 'cpu') {
|
||||
// res.TargetCPUUtilization = metric.resource.target.averageUtilization;
|
||||
// }
|
||||
// if (metric.resource.name === 'memory') {
|
||||
// res.TargetMemoryValue = parseFloat(metric.resource.target.averageValue) / 1000;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// if (data.spec.scaleTargetRef) {
|
||||
// res.TargetEntity.ApiVersion = data.spec.scaleTargetRef.apiVersion;
|
||||
// res.TargetEntity.Kind = data.spec.scaleTargetRef.kind;
|
||||
// res.TargetEntity.Name = data.spec.scaleTargetRef.name;
|
||||
// }
|
||||
// res.Yaml = yaml ? yaml.data : '';
|
||||
// return res;
|
||||
// }
|
||||
|
||||
// static createPayload(data) {
|
||||
// const payload = new KubernetesHorizontalPodAutoScalerCreatePayload();
|
||||
// payload.metadata.namespace = data.Namespace;
|
||||
// payload.metadata.name = data.TargetEntity.Name;
|
||||
// payload.spec.minReplicas = data.MinReplicas;
|
||||
// payload.spec.maxReplicas = data.MaxReplicas;
|
||||
|
||||
// if (data.TargetMemoryValue) {
|
||||
// const memoryMetric = new KubernetesHorizontalPodAutoScalerMemoryMetric();
|
||||
// memoryMetric.resource.target.averageValue = data.TargetMemoryValue;
|
||||
// payload.spec.metrics.push(memoryMetric);
|
||||
// }
|
||||
|
||||
// if (data.TargetCPUUtilization) {
|
||||
// const cpuMetric = new KubernetesHorizontalPodAutoScalerCPUMetric();
|
||||
// cpuMetric.resource.target.averageUtilization = data.TargetCPUUtilization;
|
||||
// payload.spec.metrics.push(cpuMetric);
|
||||
// }
|
||||
|
||||
// payload.spec.scaleTargetRef.apiVersion = data.TargetEntity.ApiVersion;
|
||||
// payload.spec.scaleTargetRef.kind = data.TargetEntity.Kind;
|
||||
// payload.spec.scaleTargetRef.name = data.TargetEntity.Name;
|
||||
|
||||
// return payload;
|
||||
// }
|
||||
|
||||
// static applicationFormValuesToModel(formValues, kind) {
|
||||
// const res = new KubernetesHorizontalPodAutoScaler();
|
||||
// res.Name = formValues.Name;
|
||||
// res.Namespace = formValues.ResourcePool.Namespace.Name;
|
||||
// res.MinReplicas = formValues.AutoScaler.MinReplicas;
|
||||
// res.MaxReplicas = formValues.AutoScaler.MaxReplicas;
|
||||
// res.TargetCPUUtilization = formValues.AutoScaler.TargetCPUUtilization;
|
||||
// if (formValues.AutoScaler.TargetMemoryValue) {
|
||||
// res.TargetMemoryValue = formValues.AutoScaler.TargetMemoryValue + 'M';
|
||||
// }
|
||||
// res.TargetEntity.Name = formValues.Name;
|
||||
// res.TargetEntity.Kind = kind;
|
||||
// return res;
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue