-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
164 changed files
with
5,992 additions
and
5,658 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ dist | |
.vscode | ||
**/.DS_Store | ||
node_modules | ||
.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ module.exports = { | |
proseWrap: 'preserve', | ||
htmlWhitespaceSensitivity: 'css', | ||
endOfLine: 'lf' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,116 @@ | ||
import { V1Deployment, V1Pod, V1StatefulSet } from '@kubernetes/client-node' | ||
import { V1Deployment, V1Pod, V1StatefulSet } from '@kubernetes/client-node'; | ||
|
||
import { DELETE, GET, POST } from '@/services/request' | ||
import { GetDevboxByNameReturn } from '@/types/adapt' | ||
import { DELETE, GET, POST } from '@/services/request'; | ||
import { GetDevboxByNameReturn } from '@/types/adapt'; | ||
import { | ||
DevboxEditTypeV2, | ||
DevboxListItemTypeV2, | ||
DevboxPatchPropsType, | ||
DevboxVersionListItemType | ||
} from '@/types/devbox' | ||
import { KBDevboxReleaseType, KBDevboxTypeV2 } from '@/types/k8s' | ||
} from '@/types/devbox'; | ||
import { KBDevboxReleaseType, KBDevboxTypeV2 } from '@/types/k8s'; | ||
import { | ||
adaptAppListItem, | ||
adaptDevboxDetailV2, | ||
adaptDevboxListItemV2, | ||
adaptDevboxVersionListItem, | ||
adaptPod | ||
} from '@/utils/adapt' | ||
import { MonitorDataResult, MonitorQueryKey } from '@/types/monitor' | ||
import { AxiosProgressEvent } from 'axios' | ||
} from '@/utils/adapt'; | ||
import { MonitorDataResult, MonitorQueryKey } from '@/types/monitor'; | ||
import { AxiosProgressEvent } from 'axios'; | ||
|
||
export const getMyDevboxList = () => | ||
GET< | ||
[ | ||
KBDevboxTypeV2, | ||
{ | ||
templateRepository: { | ||
iconId: string | null | ||
} | ||
uid: string | ||
iconId: string | null; | ||
}; | ||
uid: string; | ||
} | ||
][] | ||
>('/api/getDevboxList').then((data): DevboxListItemTypeV2[] => | ||
data.map(adaptDevboxListItemV2).sort((a, b) => { | ||
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime() | ||
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime(); | ||
}) | ||
) | ||
); | ||
export const getDevboxByName = (devboxName: string) => | ||
GET<GetDevboxByNameReturn>('/api/getDevboxByName', { devboxName }).then(adaptDevboxDetailV2) | ||
GET<GetDevboxByNameReturn>('/api/getDevboxByName', { devboxName }).then(adaptDevboxDetailV2); | ||
|
||
export const applyYamlList = (yamlList: string[], type: 'create' | 'replace' | 'update') => | ||
POST('/api/applyYamlList', { yamlList, type }) | ||
POST('/api/applyYamlList', { yamlList, type }); | ||
|
||
export const createDevbox = (payload: { devboxForm: DevboxEditTypeV2 }) => | ||
POST(`/api/createDevbox`, payload) | ||
POST(`/api/createDevbox`, payload); | ||
|
||
export const updateDevbox = (payload: { patch: DevboxPatchPropsType; devboxName: string }) => | ||
POST(`/api/updateDevbox`, payload) | ||
POST(`/api/updateDevbox`, payload); | ||
|
||
export const delDevbox = (devboxName: string) => DELETE('/api/delDevbox', { devboxName }) | ||
export const delDevbox = (devboxName: string) => DELETE('/api/delDevbox', { devboxName }); | ||
|
||
export const restartDevbox = (data: { devboxName: string }) => POST('/api/restartDevbox', data) | ||
export const restartDevbox = (data: { devboxName: string }) => POST('/api/restartDevbox', data); | ||
|
||
export const startDevbox = (data: { devboxName: string }) => POST('/api/startDevbox', data) | ||
export const startDevbox = (data: { devboxName: string }) => POST('/api/startDevbox', data); | ||
|
||
export const pauseDevbox = (data: { devboxName: string }) => POST('/api/pauseDevbox', data) | ||
export const pauseDevbox = (data: { devboxName: string }) => POST('/api/pauseDevbox', data); | ||
|
||
export const getDevboxVersionList = (devboxName: string, devboxUid: string) => | ||
GET<KBDevboxReleaseType[]>('/api/getDevboxVersionList', { devboxName, devboxUid }).then( | ||
(data): DevboxVersionListItemType[] => | ||
data.map(adaptDevboxVersionListItem).sort((a, b) => { | ||
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime() | ||
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime(); | ||
}) | ||
) | ||
); | ||
|
||
export const releaseDevbox = (data: { | ||
devboxName: string | ||
tag: string | ||
releaseDes: string | ||
devboxUid: string | ||
}) => POST('/api/releaseDevbox', data) | ||
devboxName: string; | ||
tag: string; | ||
releaseDes: string; | ||
devboxUid: string; | ||
}) => POST('/api/releaseDevbox', data); | ||
|
||
export const editDevboxVersion = (data: { name: string; releaseDes: string }) => | ||
POST('/api/editDevboxVersion', data) | ||
POST('/api/editDevboxVersion', data); | ||
|
||
export const delDevboxVersionByName = (versionName: string) => | ||
DELETE('/api/delDevboxVersionByName', { versionName }) | ||
DELETE('/api/delDevboxVersionByName', { versionName }); | ||
|
||
export const getSSHConnectionInfo = (data: { devboxName: string }) => | ||
GET<{ | ||
base64PublicKey: string | ||
base64PrivateKey: string | ||
token: string | ||
userName: string | ||
workingDir: string | ||
releaseCommand: string | ||
releaseArgs: string | ||
}>('/api/getSSHConnectionInfo', data) | ||
base64PublicKey: string; | ||
base64PrivateKey: string; | ||
token: string; | ||
userName: string; | ||
workingDir: string; | ||
releaseCommand: string; | ||
releaseArgs: string; | ||
}>('/api/getSSHConnectionInfo', data); | ||
|
||
export const getDevboxPodsByDevboxName = (name: string) => | ||
GET<V1Pod[]>('/api/getDevboxPodsByDevboxName', { name }).then((item) => item.map(adaptPod)) | ||
GET<V1Pod[]>('/api/getDevboxPodsByDevboxName', { name }).then((item) => item.map(adaptPod)); | ||
|
||
export const getDevboxMonitorData = (payload: { | ||
queryName: string | ||
queryKey: keyof MonitorQueryKey | ||
step: string | ||
}) => GET<MonitorDataResult[]>(`/api/monitor/getMonitorData`, payload) | ||
queryName: string; | ||
queryKey: keyof MonitorQueryKey; | ||
step: string; | ||
}) => GET<MonitorDataResult[]>(`/api/monitor/getMonitorData`, payload); | ||
|
||
export const getAppsByDevboxId = (devboxId: string) => | ||
GET<V1Deployment & V1StatefulSet[]>('/api/getAppsByDevboxId', { devboxId }).then((res) => | ||
res.map(adaptAppListItem) | ||
) | ||
); | ||
|
||
export const execCommandInDevboxPod = (data: { | ||
devboxName: string | ||
command: string | ||
idePath: string | ||
onDownloadProgress: (progressEvent: AxiosProgressEvent) => void | ||
signal: AbortSignal | ||
devboxName: string; | ||
command: string; | ||
idePath: string; | ||
onDownloadProgress: (progressEvent: AxiosProgressEvent) => void; | ||
signal: AbortSignal; | ||
}) => | ||
POST('/api/execCommandInDevboxPod', data, { | ||
// responseType: 'stream', | ||
timeout: 0, | ||
onDownloadProgress: data.onDownloadProgress, | ||
signal: data.signal | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import { GET, POST } from '@/services/request' | ||
import type { UserQuotaItemType, UserTask } from '@/types/user' | ||
import type { Env } from '@/types/static' | ||
import { getDesktopSessionFromSessionStorage, getSessionFromSessionStorage } from '@/utils/user' | ||
export const getAppEnv = () => GET<Env>('/api/getEnv') | ||
import { GET, POST } from '@/services/request'; | ||
import type { UserQuotaItemType, UserTask } from '@/types/user'; | ||
import type { Env } from '@/types/static'; | ||
import { getDesktopSessionFromSessionStorage, getSessionFromSessionStorage } from '@/utils/user'; | ||
export const getAppEnv = () => GET<Env>('/api/getEnv'); | ||
|
||
export const getUserQuota = () => | ||
GET<{ | ||
quota: UserQuotaItemType[] | ||
}>('/api/platform/getQuota') | ||
quota: UserQuotaItemType[]; | ||
}>('/api/platform/getQuota'); | ||
|
||
export const getRuntime = () => GET('/api/platform/getRuntime') | ||
export const getRuntime = () => GET('/api/platform/getRuntime'); | ||
|
||
export const getResourcePrice = () => GET('/api/platform/resourcePrice') | ||
export const getResourcePrice = () => GET('/api/platform/resourcePrice'); | ||
|
||
export const postAuthCname = (data: { publicDomain: string; customDomain: string }) => | ||
POST('/api/platform/authCname', data) | ||
POST('/api/platform/authCname', data); | ||
|
||
export const getUserTasks = () => | ||
POST<{ needGuide: boolean; task: UserTask }>('/api/guide/getTasks', { | ||
desktopToAppToken: getDesktopSessionFromSessionStorage()?.token | ||
}) | ||
}); | ||
|
||
export const checkUserTask = () => | ||
POST('/api/guide/checkTask', { | ||
desktopToAppToken: getDesktopSessionFromSessionStorage()?.token | ||
}) | ||
}); |
Oops, something went wrong.