Skip to content

Commit 922a610

Browse files
authored
feat: jetbrain modal (#5253)
* feat: basic style and logic of modal * style: blue style * fix: hydro bug * style: copy hover style * fix: copy error bug * fix: workdir bug * style: space adjust * fix: download sshkey file bug * feat: cover css * feat: dymatic inject info to image and text * chore: text bug * fix: gateway url bug * fix: text i18n perf * chore: text adjust * chore: icon adjust to upperRight * feat: add close button * fix: ts lint bug * feat: jetbrain modal basic style * feat: basic style * feat: tab and code * feat: script feat * fix: modal scroll bug * fix: style bug * feat: copy code * feat: download function * feat: connect style * feat: detail sshconfig * feat: basic execCommand logic * feat: basic connection logic * fix: 无法解决,遂退一步 * fix: connect error * fix: macos script bug * fix: windows script test and fix * feat: default system * fix: powershell text bug * fix: show h bug * style: some transition * fix: macos script bug * fix: windows script re-test and fix * feat: verify connection * fix: webpack build error * fix: webpack build error return * feat: check connection * style: arrow style perf * fix: basic type bug * fix: runtimeType and runtimeVersion bug * style: idebutton style adjust * chore: build error * fix: 妥协之举 * fix: some style adjust and text adjust * feat: config confirm * chore: remove more action * fix: online code * feat: tabs style * fix: detail sshConnection bug * style: modal style fix * fix: style adjust * fix: build bug * fix: test deal bug * chore: prettier manual * style: another adjust * style: style minH perf * fix: again connect bug * style: hit box to right * feat: check bin script * fix: hard code to soft code * Revert "chore: prettier manual" This reverts commit 4c2ee5e. * chore: remove unused png * fix: ide basePath select * chore: i18n adjust * style: style perf * style: another perf * fix: i18n * fix: style * fix: style and some i18n * fix: bug
1 parent 21e0b36 commit 922a610

File tree

46 files changed

+2379
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2379
-381
lines changed

frontend/providers/devbox/api/devbox.ts

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,28 @@ import {
99
DevboxVersionListItemType
1010
} from '@/types/devbox'
1111
import { KBDevboxReleaseType, KBDevboxTypeV2 } from '@/types/k8s'
12-
import { MonitorDataResult, MonitorQueryKey } from '@/types/monitor'
1312
import {
1413
adaptAppListItem,
1514
adaptDevboxDetailV2,
1615
adaptDevboxListItemV2,
1716
adaptDevboxVersionListItem,
1817
adaptPod
1918
} from '@/utils/adapt'
19+
import { MonitorDataResult, MonitorQueryKey } from '@/types/monitor'
20+
import { AxiosProgressEvent } from 'axios'
2021

2122
export const getMyDevboxList = () =>
22-
GET<[KBDevboxTypeV2, {
23-
templateRepository: {
24-
iconId: string | null;
25-
};
26-
uid: string;
27-
}][]>('/api/getDevboxList').then((data): DevboxListItemTypeV2[] =>
23+
GET<
24+
[
25+
KBDevboxTypeV2,
26+
{
27+
templateRepository: {
28+
iconId: string | null
29+
}
30+
uid: string
31+
}
32+
][]
33+
>('/api/getDevboxList').then((data): DevboxListItemTypeV2[] =>
2834
data.map(adaptDevboxListItemV2).sort((a, b) => {
2935
return new Date(b.createTime).getTime() - new Date(a.createTime).getTime()
3036
})
@@ -35,9 +41,8 @@ export const getDevboxByName = (devboxName: string) =>
3541
export const applyYamlList = (yamlList: string[], type: 'create' | 'replace' | 'update') =>
3642
POST('/api/applyYamlList', { yamlList, type })
3743

38-
export const createDevbox = (payload: {
39-
devboxForm: DevboxEditTypeV2
40-
}) => POST(`/api/createDevbox`, payload)
44+
export const createDevbox = (payload: { devboxForm: DevboxEditTypeV2 }) =>
45+
POST(`/api/createDevbox`, payload)
4146

4247
export const updateDevbox = (payload: { patch: DevboxPatchPropsType; devboxName: string }) =>
4348
POST(`/api/updateDevbox`, payload)
@@ -73,14 +78,14 @@ export const delDevboxVersionByName = (versionName: string) =>
7378

7479
export const getSSHConnectionInfo = (data: { devboxName: string }) =>
7580
GET<{
76-
base64PublicKey: string;
77-
base64PrivateKey: string;
78-
token: string;
79-
userName: string;
80-
workingDir: string;
81-
releaseCommand: string;
82-
releaseArgs: string;
83-
}>('/api/getSSHConnectionInfo', data)
81+
base64PublicKey: string
82+
base64PrivateKey: string
83+
token: string
84+
userName: string
85+
workingDir: string
86+
releaseCommand: string
87+
releaseArgs: string
88+
}>('/api/getSSHConnectionInfo', data)
8489

8590
export const getDevboxPodsByDevboxName = (name: string) =>
8691
GET<V1Pod[]>('/api/getDevboxPodsByDevboxName', { name }).then((item) => item.map(adaptPod))
@@ -95,3 +100,17 @@ export const getAppsByDevboxId = (devboxId: string) =>
95100
GET<V1Deployment & V1StatefulSet[]>('/api/getAppsByDevboxId', { devboxId }).then((res) =>
96101
res.map(adaptAppListItem)
97102
)
103+
104+
export const execCommandInDevboxPod = (data: {
105+
devboxName: string
106+
command: string
107+
idePath: string
108+
onDownloadProgress: (progressEvent: AxiosProgressEvent) => void
109+
signal: AbortSignal
110+
}) =>
111+
POST('/api/execCommandInDevboxPod', data, {
112+
// responseType: 'stream',
113+
timeout: 0,
114+
onDownloadProgress: data.onDownloadProgress,
115+
signal: data.signal
116+
})
Lines changed: 108 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
import { Tag, TemplateRepositoryKind } from "@/prisma/generated/client";
2-
import { DELETE, GET, POST } from "@/services/request";
3-
import { CreateTemplateRepositoryType, UpdateTemplateRepositoryType, UpdateTemplateType } from "@/utils/vaildate";
1+
import { Tag, TemplateRepositoryKind } from '@/prisma/generated/client'
2+
import { DELETE, GET, POST } from '@/services/request'
3+
import {
4+
CreateTemplateRepositoryType,
5+
UpdateTemplateRepositoryType,
6+
UpdateTemplateType
7+
} from '@/utils/vaildate'
48

5-
export const listOfficialTemplateRepository = () => GET<{
6-
templateRepositoryList: {
7-
uid: string;
8-
name: string;
9-
kind: TemplateRepositoryKind;
10-
iconId: string;
11-
description: string | null;
12-
}[]
13-
}>(`/api/templateRepository/listOfficial`)
14-
export const listTemplateRepository = (page: {
15-
page: number,
16-
pageSize: number,
17-
}, tags?: string[], search?: string) => {
9+
export const listOfficialTemplateRepository = () =>
10+
GET<{
11+
templateRepositoryList: {
12+
uid: string
13+
name: string
14+
kind: TemplateRepositoryKind
15+
iconId: string
16+
description: string | null
17+
}[]
18+
}>(`/api/templateRepository/listOfficial`)
19+
export const listTemplateRepository = (
20+
page: {
21+
page: number
22+
pageSize: number
23+
},
24+
tags?: string[],
25+
search?: string
26+
) => {
1827
const searchParams = new URLSearchParams()
1928
if (tags && tags.length > 0) {
2029
tags.forEach((tag) => {
@@ -26,35 +35,34 @@ export const listTemplateRepository = (page: {
2635
if (search) searchParams.append('search', search)
2736
return GET<{
2837
templateRepositoryList: {
29-
uid: string;
30-
name: string;
31-
description: string | null;
32-
iconId: string | null;
38+
uid: string
39+
name: string
40+
description: string | null
41+
iconId: string | null
3342
templates: {
34-
uid: string;
35-
name: string;
36-
}[];
43+
uid: string
44+
name: string
45+
}[]
3746
templateRepositoryTags: {
38-
tag: Tag;
39-
}[];
40-
}[],
47+
tag: Tag
48+
}[]
49+
}[]
4150
page: {
42-
page: number,
43-
pageSize: number,
44-
totalItems: number,
45-
totalPage: number,
51+
page: number
52+
pageSize: number
53+
totalItems: number
54+
totalPage: number
4655
}
4756
}>(`/api/templateRepository/list?${searchParams.toString()}`)
48-
4957
}
5058
export const listPrivateTemplateRepository = ({
5159
search,
5260
page,
53-
pageSize,
61+
pageSize
5462
}: {
55-
search?: string,
56-
page?: number,
57-
pageSize?: number,
63+
search?: string
64+
page?: number
65+
pageSize?: number
5866
} = {}) => {
5967
const searchParams = new URLSearchParams()
6068

@@ -63,70 +71,79 @@ export const listPrivateTemplateRepository = ({
6371
if (pageSize) searchParams.append('pageSize', pageSize.toString())
6472
return GET<{
6573
templateRepositoryList: {
66-
uid: string;
67-
name: string;
68-
description: string | null;
69-
iconId: string | null;
74+
uid: string
75+
name: string
76+
description: string | null
77+
iconId: string | null
7078
templates: {
71-
uid: string;
72-
name: string;
73-
}[];
74-
isPublic: boolean;
79+
uid: string
80+
name: string
81+
}[]
82+
isPublic: boolean
7583
templateRepositoryTags: {
76-
tag: Tag;
77-
}[];
78-
}[],
84+
tag: Tag
85+
}[]
86+
}[]
7987
page: {
80-
page: number,
81-
pageSize: number,
82-
totalItems: number,
83-
totalPage: number,
88+
page: number
89+
pageSize: number
90+
totalItems: number
91+
totalPage: number
8492
}
8593
}>(`/api/templateRepository/listPrivate?${searchParams.toString()}`)
8694
}
8795

88-
export const getTemplateRepository = (uid: string) => GET<{
89-
templateRepository: {
90-
templates: {
91-
name: string;
92-
uid: string;
93-
}[];
94-
uid: string;
95-
isPublic: true;
96-
name: string;
97-
description: string | null;
98-
iconId: string | null;
99-
templateRepositoryTags: {
100-
tag: Tag;
101-
}[];
102-
}
103-
}>(`/api/templateRepository/get?uid=${uid}`)
104-
export const getTemplateConfig = (uid: string) => GET<{
105-
template: {
106-
name: string;
107-
uid: string;
108-
config: string;
109-
}
110-
}>(`/api/templateRepository/template/getConfig?uid=${uid}`)
111-
export const listTemplate = (templateRepositoryUid: string) => GET<{
112-
templateList: {
113-
uid: string;
114-
name: string;
115-
config: string;
116-
image: string;
117-
createAt: Date;
118-
updateAt: Date;
119-
}[]
120-
}>(`/api/templateRepository/template/list?templateRepositoryUid=${templateRepositoryUid}`)
121-
export const listTag = () => GET<{
122-
tagList: Tag[]
123-
}>(`/api/templateRepository/tag/list`)
96+
export const getTemplateRepository = (uid: string) =>
97+
GET<{
98+
templateRepository: {
99+
templates: {
100+
name: string
101+
uid: string
102+
}[]
103+
uid: string
104+
isPublic: true
105+
name: string
106+
description: string | null
107+
iconId: string | null
108+
templateRepositoryTags: {
109+
tag: Tag
110+
}[]
111+
}
112+
}>(`/api/templateRepository/get?uid=${uid}`)
113+
export const getTemplateConfig = (uid: string) =>
114+
GET<{
115+
template: {
116+
name: string
117+
uid: string
118+
config: string
119+
}
120+
}>(`/api/templateRepository/template/getConfig?uid=${uid}`)
121+
export const listTemplate = (templateRepositoryUid: string) =>
122+
GET<{
123+
templateList: {
124+
uid: string
125+
name: string
126+
config: string
127+
image: string
128+
createAt: Date
129+
updateAt: Date
130+
}[]
131+
}>(`/api/templateRepository/template/list?templateRepositoryUid=${templateRepositoryUid}`)
132+
export const listTag = () =>
133+
GET<{
134+
tagList: Tag[]
135+
}>(`/api/templateRepository/tag/list`)
124136

125-
export const createTemplateReposistory = (data: CreateTemplateRepositoryType) => POST(`/api/templateRepository/withTemplate/create`, data)
137+
export const createTemplateReposistory = (data: CreateTemplateRepositoryType) =>
138+
POST(`/api/templateRepository/withTemplate/create`, data)
126139
export const initUser = () => POST<string>(`/api/auth/init`)
127140

128-
export const deleteTemplateRepository = (templateRepositoryUid: string) => DELETE(`/api/templateRepository/delete?templateRepositoryUid=${templateRepositoryUid}`)
141+
export const deleteTemplateRepository = (templateRepositoryUid: string) =>
142+
DELETE(`/api/templateRepository/delete?templateRepositoryUid=${templateRepositoryUid}`)
129143

130-
export const updateTemplateReposistory = (data: UpdateTemplateRepositoryType) => POST(`/api/templateRepository/update`, data)
131-
export const updateTemplate = (data: UpdateTemplateType) => POST(`/api/templateRepository/withTemplate/update`, data)
132-
export const deleteTemplate = (templateUid: string) => DELETE(`/api/templateRepository/template/delete?uid=${templateUid}`)
144+
export const updateTemplateReposistory = (data: UpdateTemplateRepositoryType) =>
145+
POST(`/api/templateRepository/update`, data)
146+
export const updateTemplate = (data: UpdateTemplateType) =>
147+
POST(`/api/templateRepository/withTemplate/update`, data)
148+
export const deleteTemplate = (templateUid: string) =>
149+
DELETE(`/api/templateRepository/template/delete?uid=${templateUid}`)

frontend/providers/devbox/app/[lang]/(platform)/(home)/components/DevboxList.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import { useRouter } from '@/i18n';
1010
import { useGlobalStore } from '@/stores/global';
1111
import { DevboxListItemTypeV2 } from '@/types/devbox';
1212

13-
import DevboxStatusTag from '@/components/DevboxStatusTag';
1413
import MyIcon from '@/components/Icon';
1514
import IDEButton from '@/components/IDEButton';
16-
import ReleaseModal from '@/components/modals/releaseModal';
1715
import PodLineChart from '@/components/PodLineChart';
1816
import { AdvancedTable } from '@/components/AdvancedTable';
17+
import DevboxStatusTag from '@/components/DevboxStatusTag';
18+
import ReleaseModal from '@/components/modals/ReleaseModal';
1919

2020
const DelModal = dynamic(() => import('@/components/modals/DelModal'));
2121

@@ -29,9 +29,6 @@ const DevboxList = ({
2929
const router = useRouter();
3030
const t = useTranslations();
3131
const { message: toast } = useMessage();
32-
const duplicatedDevboxList = Array(20)
33-
.fill(0)
34-
.flatMap(() => [...devboxList]);
3532

3633
// TODO: Unified Loading Behavior
3734
const { setLoading } = useGlobalStore();
@@ -224,6 +221,7 @@ const DevboxList = ({
224221
sshPort={item.sshPort}
225222
status={item.status}
226223
mr={'8px'}
224+
runtimeType={item.template.templateRepository.iconId as string}
227225
/>
228226
<Button
229227
mr={'8px'}
@@ -347,7 +345,7 @@ const DevboxList = ({
347345
];
348346
return (
349347
<>
350-
<AdvancedTable columns={columns} data={duplicatedDevboxList} itemClass="devboxListItem" />
348+
<AdvancedTable columns={columns} data={devboxList} itemClass="devboxListItem" />
351349
{!!delDevbox && (
352350
<DelModal
353351
devbox={delDevbox}

frontend/providers/devbox/app/[lang]/(platform)/devbox/create/components/Yaml.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { useTranslations } from 'next-intl'
44
import { useSearchParams } from 'next/navigation'
55
import { Box, Center, Flex, Grid, useTheme } from '@chakra-ui/react'
66

7-
import { useRouter } from '@/i18n'
7+
import Code from '@/components/Code'
88
import MyIcon from '@/components/Icon'
9+
10+
import { useRouter } from '@/i18n'
911
import { obj2Query } from '@/utils/tools'
1012
import type { YamlItemType } from '@/types'
1113
import { useCopyData } from '@/utils/tools'
12-
import YamlCode from '@/components/YamlCode/index'
1314

1415
import styles from './index.module.scss'
1516

@@ -111,7 +112,7 @@ const Yaml = ({ yamlList = [], pxVal }: { yamlList: YamlItemType[]; pxVal: numbe
111112
</Center>
112113
</Flex>
113114
<Box flex={1} h={0} overflow={'auto'} bg={'#ffffff'} p={4}>
114-
<YamlCode className={styles.code} content={yamlList[selectedIndex].value} />
115+
<Code className={styles.code} content={yamlList[selectedIndex].value} language="yaml" />
115116
</Box>
116117
</Flex>
117118
)}

0 commit comments

Comments
 (0)