/
editApp.ts
76 lines (72 loc) · 1.56 KB
/
editApp.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import type { AppEditType } from '@/types/app';
import { customAlphabet } from 'nanoid';
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz', 12);
export const editModeMap = (isEdit: boolean) => {
if (isEdit) {
return {
title: 'Update Application',
applyBtnText: 'Update',
applyMessage: 'Confirm Update Application?',
applySuccess: 'Update Successful',
applyError: 'Update Failed'
};
}
return {
title: 'Application Deployment',
applyBtnText: 'Deploy',
applyMessage: 'Confirm Deploy Application?',
applySuccess: 'Deployment Successful',
applyError: 'Deployment Failed'
};
};
export const defaultEditVal: AppEditType = {
appName: 'hello-world',
imageName: 'nginx',
runCMD: '',
cmdParam: '',
replicas: 1,
cpu: 100,
memory: 64,
networks: [
{
networkName: '',
portName: nanoid(),
port: 80,
protocol: 'HTTP',
openPublicDomain: false,
publicDomain: '',
customDomain: ''
}
],
envs: [],
hpa: {
use: false,
target: 'cpu',
value: 50,
minReplicas: 1,
maxReplicas: 5
},
configMapList: [],
secret: {
use: false,
username: '',
password: '',
serverAddress: 'docker.io'
},
storeList: [],
gpu: {
manufacturers: 'nvidia',
type: '',
amount: 1
}
};
export const GpuAmountMarkList = [
{ label: '1', value: 1 },
{ label: '2', value: 2 },
{ label: '3', value: 3 },
{ label: '4', value: 4 },
{ label: '5', value: 5 },
{ label: '6', value: 6 },
{ label: '7', value: 7 },
{ label: '8', value: 8 }
];