refactor: gpu service API alignment
This commit is contained in:
@@ -20,90 +20,13 @@ export const status: Record<string, StatusType> = {
|
||||
[StoragePhaseValueMap.Pending]: StatusMaps.transitioning
|
||||
};
|
||||
|
||||
export const StorageTypeValueMap = {
|
||||
Local: 'local',
|
||||
Shared: 'shared',
|
||||
Object: 'object'
|
||||
};
|
||||
|
||||
export const StorageTypeLabelMap: Record<string, string> = {
|
||||
[StorageTypeValueMap.Local]: 'gpuservice.storage.type.local',
|
||||
[StorageTypeValueMap.Shared]: 'gpuservice.storage.type.shared',
|
||||
[StorageTypeValueMap.Object]: 'gpuservice.storage.type.object'
|
||||
};
|
||||
|
||||
export const StorageTypeOptions = [
|
||||
{
|
||||
label: StorageTypeLabelMap[StorageTypeValueMap.Local],
|
||||
value: StorageTypeValueMap.Local,
|
||||
locale: true
|
||||
},
|
||||
{
|
||||
label: StorageTypeLabelMap[StorageTypeValueMap.Shared],
|
||||
value: StorageTypeValueMap.Shared,
|
||||
locale: true
|
||||
},
|
||||
{
|
||||
label: StorageTypeLabelMap[StorageTypeValueMap.Object],
|
||||
value: StorageTypeValueMap.Object,
|
||||
locale: true
|
||||
}
|
||||
];
|
||||
|
||||
export const AccessModeValueMap = {
|
||||
ReadWriteOnce: 'ReadWriteOnce',
|
||||
ReadOnlyMany: 'ReadOnlyMany',
|
||||
ReadWriteMany: 'ReadWriteMany',
|
||||
ReadWriteOncePod: 'ReadWriteOncePod'
|
||||
};
|
||||
|
||||
export const AccessModeOptions = [
|
||||
{
|
||||
label: 'ReadWriteOnce',
|
||||
value: AccessModeValueMap.ReadWriteOnce
|
||||
},
|
||||
{
|
||||
label: 'ReadWriteMany',
|
||||
value: AccessModeValueMap.ReadWriteMany
|
||||
},
|
||||
{
|
||||
label: 'ReadOnlyMany',
|
||||
value: AccessModeValueMap.ReadOnlyMany
|
||||
},
|
||||
{
|
||||
label: 'ReadWriteOncePod',
|
||||
value: AccessModeValueMap.ReadWriteOncePod
|
||||
}
|
||||
];
|
||||
|
||||
export const ReClaimPolicyValueMap = {
|
||||
Retain: 'Retain',
|
||||
Delete: 'Delete',
|
||||
Recycle: 'Recycle'
|
||||
};
|
||||
|
||||
export const ReClaimPolicyOptions = [
|
||||
{
|
||||
label: 'Retain',
|
||||
value: ReClaimPolicyValueMap.Retain
|
||||
},
|
||||
{
|
||||
label: 'Delete',
|
||||
value: ReClaimPolicyValueMap.Delete
|
||||
},
|
||||
{
|
||||
label: 'Recycle',
|
||||
value: ReClaimPolicyValueMap.Recycle
|
||||
}
|
||||
];
|
||||
|
||||
export const rowActionList = [
|
||||
// {
|
||||
// label: 'common.button.edit',
|
||||
// key: 'edit',
|
||||
// locale: true,
|
||||
// icon: icons.EditOutlined
|
||||
// },
|
||||
{
|
||||
label: 'common.button.edit',
|
||||
key: 'edit',
|
||||
locale: true,
|
||||
icon: icons.EditOutlined
|
||||
},
|
||||
{
|
||||
label: 'common.button.delete',
|
||||
key: 'delete',
|
||||
|
||||
@@ -1,60 +1,68 @@
|
||||
export type AccessModeType =
|
||||
| 'ReadOnlyMany'
|
||||
| 'ReadWriteMany'
|
||||
| 'ReadWriteOnce'
|
||||
| 'ReadWriteOncePod';
|
||||
|
||||
export type ReClaimPolicyType = 'Retain' | 'Delete' | 'Recycle';
|
||||
export interface FormData {
|
||||
metadata: {
|
||||
name: string;
|
||||
namespace: string;
|
||||
};
|
||||
spec: {
|
||||
capacity: string;
|
||||
type: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ManagedField {
|
||||
manager: string;
|
||||
operation: string;
|
||||
apiVersion: string;
|
||||
time: string;
|
||||
fieldsType: string;
|
||||
fieldsV1: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface Metadata {
|
||||
name: string;
|
||||
namespace?: string;
|
||||
uid: string;
|
||||
resourceVersion: string;
|
||||
creationTimestamp: string;
|
||||
annotations?: Record<string, string>;
|
||||
finalizers?: string[];
|
||||
managedFields?: ManagedField[];
|
||||
owner_principal_id?: number | null;
|
||||
displayName?: string | null;
|
||||
description?: string | null;
|
||||
spec: {
|
||||
type: string;
|
||||
capacity: string;
|
||||
};
|
||||
}
|
||||
|
||||
// Per `GPUInstancePersistentVolumeUpdate`, only displayName / description /
|
||||
// owner_principal_id are mutable post-create.
|
||||
export interface UpdateData {
|
||||
owner_principal_id?: number | null;
|
||||
displayName?: string | null;
|
||||
description?: string | null;
|
||||
}
|
||||
|
||||
export interface ListItem {
|
||||
metadata: Metadata;
|
||||
id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
deleted_at?: string | null;
|
||||
owner_principal_id?: number | null;
|
||||
displayName?: string | null;
|
||||
description?: string | null;
|
||||
name: string;
|
||||
spec: {
|
||||
type: string;
|
||||
capacity: string;
|
||||
accessMode: AccessModeType;
|
||||
};
|
||||
status: {
|
||||
phaseMessage?: string;
|
||||
phase: 'Available' | 'Unavailable' | 'Pending';
|
||||
volume: {
|
||||
name: string;
|
||||
};
|
||||
};
|
||||
status?: {
|
||||
phase?: string | null;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface StorageClassNFS {
|
||||
server: string;
|
||||
share: string;
|
||||
subDirectory?: string | null;
|
||||
mountPermissions?: string | null;
|
||||
mountOptions?: string[] | null;
|
||||
}
|
||||
|
||||
export interface StorageClassS3 {
|
||||
endpoint: string;
|
||||
region?: string | null;
|
||||
insecure?: boolean | null;
|
||||
accessKey?: string | null;
|
||||
bucket?: string | null;
|
||||
mountOptions?: string[] | null;
|
||||
}
|
||||
|
||||
export interface StorageClassItem {
|
||||
metadata: Metadata;
|
||||
provisioner: string;
|
||||
reclaimPolicy: 'Delete' | 'Retain';
|
||||
volumeBindingMode: 'Immediate' | 'WaitForFirstConsumer';
|
||||
id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
deleted_at?: string | null;
|
||||
owner_principal_id?: number | null;
|
||||
displayName?: string | null;
|
||||
description?: string | null;
|
||||
name: string;
|
||||
spec: {
|
||||
nfs?: StorageClassNFS | null;
|
||||
s3?: StorageClassS3 | null;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user