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/react/kubernetes/utils.ts

23 lines
473 B

import { Annotation } from './annotations/types';
export function parseCpu(cpu: string) {
let res = parseInt(cpu, 10);
if (cpu.endsWith('m')) {
res /= 1000;
} else if (cpu.endsWith('n')) {
res /= 1000000000;
}
return res;
}
export function prepareAnnotations(annotations: Annotation[]) {
const result = annotations.reduce(
(acc, a) => {
acc[a.Key] = a.Value;
return acc;
},
{} as Record<string, string>
);
return result;
}