fix: instance type api update
This commit is contained in:
@@ -172,8 +172,8 @@ export const convertKiToGi = (value?: string): string | undefined => {
|
||||
const match = /^(-?\d+(?:\.\d+)?)(Ki|Mi|Gi|Ti)$/.exec(value);
|
||||
if (!match) return value;
|
||||
const [, num, unit] = match;
|
||||
if (unit === 'Ti') return `${_.round(Number(num), 2)}Ti`;
|
||||
return `${_.round(Number(num) / GI_DIVISOR[unit], 2)}Gi`;
|
||||
if (unit === 'Ti') return `${_.floor(Number(num), 0)}Ti`;
|
||||
return `${_.floor(Number(num) / GI_DIVISOR[unit], 0)}Gi`;
|
||||
};
|
||||
|
||||
const parseQuantity = (value?: string | null): number => {
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
export type ImagePullPolicy = 'Always' | 'IfNotPresent' | 'Never';
|
||||
|
||||
type QuanityCPU = `${number}m` | string;
|
||||
|
||||
type QuanityMemory =
|
||||
| `${number}Ki`
|
||||
| `${number}Mi`
|
||||
| `${number}Gi`
|
||||
| `${number}Ti`
|
||||
| string;
|
||||
|
||||
type QuanityLocalStorage =
|
||||
| `${number}Ki`
|
||||
| `${number}Mi`
|
||||
| `${number}Gi`
|
||||
| `${number}Ti`
|
||||
| string;
|
||||
|
||||
// instance form data
|
||||
export interface FormData {
|
||||
name: string;
|
||||
@@ -116,9 +132,9 @@ export interface InstanceTypeCandidate {
|
||||
|
||||
export interface InstanceTypeTierOnceMaxRequestResource {
|
||||
accelerator?: string;
|
||||
cpu: string;
|
||||
ram: string;
|
||||
localStorage: string;
|
||||
cpu: QuanityCPU;
|
||||
ram: QuanityMemory;
|
||||
localStorage: QuanityLocalStorage;
|
||||
}
|
||||
|
||||
export interface InstanceTypeTier {
|
||||
@@ -127,10 +143,10 @@ export interface InstanceTypeTier {
|
||||
}
|
||||
|
||||
export interface InstanceTypeOnceMaxRequestResource {
|
||||
accelerator?: string | null;
|
||||
cpu: string;
|
||||
ram: string;
|
||||
localStorage: string;
|
||||
accelerator?: `${number}` | null;
|
||||
cpu: QuanityCPU;
|
||||
ram: QuanityMemory;
|
||||
localStorage: QuanityLocalStorage;
|
||||
}
|
||||
|
||||
export interface InstanceTypeSpec {
|
||||
@@ -142,6 +158,10 @@ export interface InstanceTypeSpec {
|
||||
family?: string | null;
|
||||
computeCapability?: string | null;
|
||||
sliced?: string | null;
|
||||
unitResources?: {
|
||||
cpu: QuanityCPU;
|
||||
ram: QuanityMemory;
|
||||
};
|
||||
}
|
||||
|
||||
export interface InstanceTypeStatus {
|
||||
|
||||
Reference in New Issue
Block a user