-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathsetting.ts
More file actions
165 lines (158 loc) · 6.17 KB
/
Copy pathsetting.ts
File metadata and controls
165 lines (158 loc) · 6.17 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import http from '@/api';
import { deepCopy } from '@/utils/util';
import { Base64 } from 'js-base64';
import { ResPage, SearchWithPage, DescriptionUpdate, ReqPage } from '../interface';
import { Setting } from '../interface/setting';
import { TimeoutEnum } from '@/enums/http-enum';
// license
export const uploadLicense = (oldLicense: string, params: FormData) => {
if (oldLicense === '') {
return http.upload('/core/licenses/upload', params);
}
return http.upload('/core/licenses/update', params);
};
export const searchLicense = (params: ReqPage) => {
return http.post<ResPage<Setting.License>>('/core/licenses/search', params);
};
export const deleteLicense = (params: { ids: number }) => {
return http.post('/core/licenses/del', params);
};
export const getLicenseStatus = () => {
return http.get<Setting.LicenseStatus>(`/core/licenses/status`);
};
export const getMasterLicenseStatus = () => {
return http.get<Setting.LicenseStatus>(`/core/licenses/master/status`);
};
export const syncLicense = (id: number) => {
return http.post(`/core/licenses/sync`, { id: id });
};
export const bindLicense = (id: number, nodeID: number) => {
return http.post(`/core/licenses/bind`, { nodeID: nodeID, licenseID: id }, TimeoutEnum.T_60S);
};
export const unbindLicense = (id: number, force: boolean) => {
return http.post(`/core/licenses/unbind`, { id: id, force: force }, TimeoutEnum.T_60S);
};
export const loadLicenseOptions = () => {
return http.get(`/core/licenses/options`);
};
export const listNodeOptions = () => {
return http.get<Array<Setting.NodeItem>>(`/core/nodes/list`);
};
export const listAllNodes = () => {
return http.get<Array<Setting.NodeItem>>(`/core/nodes/all`);
};
// agent
export const loadBaseDir = () => {
return http.get<string>(`/settings/basedir`);
};
export const loadDaemonJsonPath = () => {
return http.get<string>(`/settings/daemonjson`, {});
};
export const updateAgentSetting = (param: Setting.SettingUpdate) => {
return http.post(`/settings/update`, param);
};
export const getAgentSettingInfo = () => {
return http.post<Setting.SettingInfo>(`/settings/search`);
};
// core
export const getSettingInfo = () => {
return http.post<Setting.SettingInfo>(`/core/settings/search`);
};
export const getTerminalInfo = () => {
return http.post<Setting.TerminalInfo>(`/core/settings/terminal/search`);
};
export const UpdateTerminalInfo = (param: Setting.TerminalInfo) => {
return http.post(`/core/settings/terminal/update`, param);
};
export const getSystemAvailable = () => {
return http.get(`/core/settings/search/available`);
};
export const updateSetting = (param: Setting.SettingUpdate) => {
return http.post(`/core/settings/update`, param);
};
export const updateMenu = (param: Setting.SettingUpdate) => {
return http.post(`/core/settings/menu/update`, param);
};
export const updateProxy = (params: Setting.ProxyUpdate) => {
let request = deepCopy(params) as Setting.ProxyUpdate;
if (request.proxyPasswd) {
request.proxyPasswd = Base64.encode(request.proxyPasswd);
}
request.proxyType = request.proxyType === 'close' ? '' : request.proxyType;
return http.post(`/core/settings/proxy/update`, request);
};
export const updatePassword = (param: Setting.PasswordUpdate) => {
return http.post(`/core/settings/password/update`, param);
};
export const loadInterfaceAddr = () => {
return http.get(`/core/settings/interface`);
};
export const updateBindInfo = (ipv6: string, bindAddress: string) => {
return http.post(`/core/settings/bind/update`, { ipv6: ipv6, bindAddress: bindAddress });
};
export const updatePort = (param: Setting.PortUpdate) => {
return http.post(`/core/settings/port/update`, param);
};
export const updateSSL = (param: Setting.SSLUpdate) => {
return http.post(`/core/settings/ssl/update`, param);
};
export const loadSSLInfo = () => {
return http.get<Setting.SSLInfo>(`/core/settings/ssl/info`);
};
export const downloadSSL = () => {
return http.download<any>(`/core/settings/ssl/download`);
};
export const handleExpired = (param: Setting.PasswordUpdate) => {
return http.post(`/core/settings/expired/handle`, param);
};
export const loadMFA = (param: Setting.MFARequest) => {
return http.post<Setting.MFAInfo>(`/core/settings/mfa`, param);
};
export const bindMFA = (param: Setting.MFABind) => {
return http.post(`/core/settings/mfa/bind`, param);
};
// snapshot
export const loadSnapshotInfo = () => {
return http.get<Setting.SnapshotData>(`/settings/snapshot/load`);
};
export const snapshotCreate = (param: Setting.SnapshotCreate) => {
return http.post(`/settings/snapshot`, param);
};
export const snapshotRecreate = (id: number) => {
return http.post(`/settings/snapshot/recreate`, { id: id });
};
export const snapshotImport = (param: Setting.SnapshotImport) => {
return http.post(`/settings/snapshot/import`, param);
};
export const updateSnapshotDescription = (param: DescriptionUpdate) => {
return http.post(`/settings/snapshot/description/update`, param);
};
export const snapshotDelete = (param: { ids: number[]; deleteWithFile: boolean }) => {
return http.post(`/settings/snapshot/del`, param);
};
export const snapshotRecover = (param: Setting.SnapshotRecover) => {
return http.post(`/settings/snapshot/recover`, param);
};
export const snapshotRollback = (param: Setting.SnapshotRecover) => {
return http.post(`/settings/snapshot/rollback`, param);
};
export const searchSnapshotPage = (param: SearchWithPage) => {
return http.post<ResPage<Setting.SnapshotInfo>>(`/settings/snapshot/search`, param);
};
// upgrade
export const loadUpgradeInfo = () => {
return http.get<Setting.UpgradeInfo>(`/core/settings/upgrade`);
};
export const loadReleaseNotes = (version: string) => {
return http.post<string>(`/core/settings/upgrade/notes`, { version: version });
};
export const upgrade = (version: string) => {
return http.post(`/core/settings/upgrade`, { version: version });
};
// api config
export const generateApiKey = () => {
return http.post<string>(`/core/settings/api/config/generate/key`);
};
export const updateApiConfig = (param: Setting.ApiConfig) => {
return http.post(`/core/settings/api/config/update`, param);
};