Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: jetbrain modal #5253

Open
wants to merge 79 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
7a506a3
feat: basic style and logic of modal
mlhiter Nov 29, 2024
cdab0f1
style: blue style
mlhiter Nov 29, 2024
5253b1e
fix: hydro bug
mlhiter Nov 29, 2024
c50588a
style: copy hover style
mlhiter Nov 29, 2024
b218461
fix: copy error bug
mlhiter Nov 29, 2024
5b81255
fix: workdir bug
mlhiter Nov 29, 2024
1d5ef5f
style: space adjust
mlhiter Nov 29, 2024
eed0826
fix: download sshkey file bug
mlhiter Nov 29, 2024
8b63bed
feat: cover css
mlhiter Nov 29, 2024
6385e12
feat: dymatic inject info to image and text
mlhiter Dec 2, 2024
726f1cc
chore: text bug
mlhiter Dec 2, 2024
f7b7072
fix: gateway url bug
mlhiter Dec 2, 2024
6a6c107
fix: text i18n perf
mlhiter Dec 2, 2024
0d19341
chore: text adjust
mlhiter Dec 3, 2024
3ef6be7
chore: icon adjust to upperRight
mlhiter Dec 3, 2024
cac8b3e
feat: add close button
mlhiter Dec 3, 2024
b5b9ab7
fix: ts lint bug
mlhiter Dec 11, 2024
10371a3
feat: jetbrain modal basic style
mlhiter Dec 11, 2024
fdf44f8
feat: basic style
mlhiter Dec 12, 2024
0fa6f24
feat: tab and code
mlhiter Dec 12, 2024
ab314fc
feat: script feat
mlhiter Dec 12, 2024
b2d385d
fix: modal scroll bug
mlhiter Dec 12, 2024
7abea0e
fix: style bug
mlhiter Dec 12, 2024
53dea53
feat: copy code
mlhiter Dec 12, 2024
a375974
feat: download function
mlhiter Dec 12, 2024
fd7729a
feat: connect style
mlhiter Dec 12, 2024
8217149
feat: detail sshconfig
mlhiter Dec 12, 2024
cbae1e8
feat: basic execCommand logic
mlhiter Dec 12, 2024
bdb3bb3
feat: basic connection logic
mlhiter Dec 17, 2024
bb370d7
fix: 无法解决,遂退一步
mlhiter Dec 17, 2024
c330992
fix: connect error
mlhiter Dec 18, 2024
0167aa7
fix: macos script bug
mlhiter Dec 18, 2024
79300b3
fix: windows script test and fix
mlhiter Dec 18, 2024
778c46d
feat: default system
mlhiter Dec 20, 2024
eff6651
fix: powershell text bug
mlhiter Dec 20, 2024
eb057f6
fix: show h bug
mlhiter Dec 20, 2024
b086bcb
style: some transition
mlhiter Dec 20, 2024
7c8978e
fix: macos script bug
mlhiter Dec 20, 2024
9366ec7
fix: windows script re-test and fix
mlhiter Dec 20, 2024
da76b56
feat: verify connection
mlhiter Dec 20, 2024
80d19b8
fix: webpack build error
mlhiter Dec 20, 2024
1120c36
fix: webpack build error return
mlhiter Dec 20, 2024
f410456
feat: check connection
mlhiter Dec 20, 2024
d2e0589
style: arrow style perf
mlhiter Dec 20, 2024
139ae46
Merge branch 'main' into feature/jetbrain-modal
mlhiter Dec 27, 2024
8a914a3
fix: basic type bug
mlhiter Dec 27, 2024
356ccbf
fix: runtimeType and runtimeVersion bug
mlhiter Dec 30, 2024
6e18e43
style: idebutton style adjust
mlhiter Jan 2, 2025
20655e9
chore: build error
mlhiter Jan 3, 2025
9920c7b
fix: 妥协之举
mlhiter Jan 3, 2025
a877df5
fix: some style adjust and text adjust
mlhiter Jan 9, 2025
fa8f40f
feat: config confirm
mlhiter Jan 9, 2025
f67324e
chore: remove more action
mlhiter Jan 9, 2025
10eae68
fix: online code
mlhiter Jan 10, 2025
549e9b6
feat: tabs style
mlhiter Jan 10, 2025
2e54d3b
fix: detail sshConnection bug
mlhiter Jan 13, 2025
40d2b1f
style: modal style fix
mlhiter Jan 13, 2025
84cc497
Merge branch 'main' into feature/jetbrain-modal
mlhiter Jan 13, 2025
e77c8ef
fix: style adjust
mlhiter Jan 13, 2025
58f80d4
Merge branch 'main' into feature/jetbrain-modal
mlhiter Jan 13, 2025
fca6629
fix: build bug
mlhiter Jan 13, 2025
2f69ac3
fix: test deal bug
mlhiter Jan 13, 2025
4c2ee5e
chore: prettier manual
mlhiter Jan 13, 2025
ecf01d6
style: another adjust
mlhiter Jan 13, 2025
63b1ad0
style: style minH perf
mlhiter Jan 13, 2025
1ca7f62
fix: again connect bug
mlhiter Jan 14, 2025
29708b2
style: hit box to right
mlhiter Jan 14, 2025
2a89a78
feat: check bin script
mlhiter Jan 15, 2025
c3a3a30
fix: hard code to soft code
mlhiter Jan 15, 2025
27587f9
Revert "chore: prettier manual"
mlhiter Jan 15, 2025
ae0164f
chore: remove unused png
mlhiter Jan 15, 2025
25793df
fix: ide basePath select
mlhiter Jan 15, 2025
d50b5d9
chore: i18n adjust
mlhiter Jan 15, 2025
49b7323
style: style perf
mlhiter Jan 15, 2025
cdd0418
style: another perf
mlhiter Jan 15, 2025
3507131
fix: i18n
mlhiter Jan 15, 2025
c9d766d
fix: style
mlhiter Jan 15, 2025
1b4683c
fix: style and some i18n
mlhiter Jan 15, 2025
48c1173
fix: bug
mlhiter Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 37 additions & 18 deletions frontend/providers/devbox/api/devbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,28 @@ import {
DevboxVersionListItemType
} from '@/types/devbox'
import { KBDevboxReleaseType, KBDevboxTypeV2 } from '@/types/k8s'
import { MonitorDataResult, MonitorQueryKey } from '@/types/monitor'
import {
adaptAppListItem,
adaptDevboxDetailV2,
adaptDevboxListItemV2,
adaptDevboxVersionListItem,
adaptPod
} from '@/utils/adapt'
import { MonitorDataResult, MonitorQueryKey } from '@/types/monitor'
import { AxiosProgressEvent } from 'axios'

export const getMyDevboxList = () =>
GET<[KBDevboxTypeV2, {
templateRepository: {
iconId: string | null;
};
uid: string;
}][]>('/api/getDevboxList').then((data): DevboxListItemTypeV2[] =>
GET<
[
KBDevboxTypeV2,
{
templateRepository: {
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()
})
Expand All @@ -35,9 +41,8 @@ export const getDevboxByName = (devboxName: string) =>
export const applyYamlList = (yamlList: string[], type: 'create' | 'replace' | 'update') =>
POST('/api/applyYamlList', { yamlList, type })

export const createDevbox = (payload: {
devboxForm: DevboxEditTypeV2
}) => POST(`/api/createDevbox`, payload)
export const createDevbox = (payload: { devboxForm: DevboxEditTypeV2 }) =>
POST(`/api/createDevbox`, payload)

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

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))
Expand All @@ -95,3 +100,17 @@ 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
}) =>
POST('/api/execCommandInDevboxPod', data, {
// responseType: 'stream',
timeout: 0,
onDownloadProgress: data.onDownloadProgress,
signal: data.signal
})
199 changes: 108 additions & 91 deletions frontend/providers/devbox/api/template.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import { Tag, TemplateRepositoryKind } from "@/prisma/generated/client";
import { DELETE, GET, POST } from "@/services/request";
import { CreateTemplateRepositoryType, UpdateTemplateRepositoryType, UpdateTemplateType } from "@/utils/vaildate";
import { Tag, TemplateRepositoryKind } from '@/prisma/generated/client'
import { DELETE, GET, POST } from '@/services/request'
import {
CreateTemplateRepositoryType,
UpdateTemplateRepositoryType,
UpdateTemplateType
} from '@/utils/vaildate'

export const listOfficialTemplateRepository = () => GET<{
templateRepositoryList: {
uid: string;
name: string;
kind: TemplateRepositoryKind;
iconId: string;
description: string | null;
}[]
}>(`/api/templateRepository/listOfficial`)
export const listTemplateRepository = (page: {
page: number,
pageSize: number,
}, tags?: string[], search?: string) => {
export const listOfficialTemplateRepository = () =>
GET<{
templateRepositoryList: {
uid: string
name: string
kind: TemplateRepositoryKind
iconId: string
description: string | null
}[]
}>(`/api/templateRepository/listOfficial`)
export const listTemplateRepository = (
page: {
page: number
pageSize: number
},
tags?: string[],
search?: string
) => {
const searchParams = new URLSearchParams()
if (tags && tags.length > 0) {
tags.forEach((tag) => {
Expand All @@ -26,35 +35,34 @@ export const listTemplateRepository = (page: {
if (search) searchParams.append('search', search)
return GET<{
templateRepositoryList: {
uid: string;
name: string;
description: string | null;
iconId: string | null;
uid: string
name: string
description: string | null
iconId: string | null
templates: {
uid: string;
name: string;
}[];
uid: string
name: string
}[]
templateRepositoryTags: {
tag: Tag;
}[];
}[],
tag: Tag
}[]
}[]
page: {
page: number,
pageSize: number,
totalItems: number,
totalPage: number,
page: number
pageSize: number
totalItems: number
totalPage: number
}
}>(`/api/templateRepository/list?${searchParams.toString()}`)

}
export const listPrivateTemplateRepository = ({
search,
page,
pageSize,
pageSize
}: {
search?: string,
page?: number,
pageSize?: number,
search?: string
page?: number
pageSize?: number
} = {}) => {
const searchParams = new URLSearchParams()

Expand All @@ -63,70 +71,79 @@ export const listPrivateTemplateRepository = ({
if (pageSize) searchParams.append('pageSize', pageSize.toString())
return GET<{
templateRepositoryList: {
uid: string;
name: string;
description: string | null;
iconId: string | null;
uid: string
name: string
description: string | null
iconId: string | null
templates: {
uid: string;
name: string;
}[];
isPublic: boolean;
uid: string
name: string
}[]
isPublic: boolean
templateRepositoryTags: {
tag: Tag;
}[];
}[],
tag: Tag
}[]
}[]
page: {
page: number,
pageSize: number,
totalItems: number,
totalPage: number,
page: number
pageSize: number
totalItems: number
totalPage: number
}
}>(`/api/templateRepository/listPrivate?${searchParams.toString()}`)
}

export const getTemplateRepository = (uid: string) => GET<{
templateRepository: {
templates: {
name: string;
uid: string;
}[];
uid: string;
isPublic: true;
name: string;
description: string | null;
iconId: string | null;
templateRepositoryTags: {
tag: Tag;
}[];
}
}>(`/api/templateRepository/get?uid=${uid}`)
export const getTemplateConfig = (uid: string) => GET<{
template: {
name: string;
uid: string;
config: string;
}
}>(`/api/templateRepository/template/getConfig?uid=${uid}`)
export const listTemplate = (templateRepositoryUid: string) => GET<{
templateList: {
uid: string;
name: string;
config: string;
image: string;
createAt: Date;
updateAt: Date;
}[]
}>(`/api/templateRepository/template/list?templateRepositoryUid=${templateRepositoryUid}`)
export const listTag = () => GET<{
tagList: Tag[]
}>(`/api/templateRepository/tag/list`)
export const getTemplateRepository = (uid: string) =>
GET<{
templateRepository: {
templates: {
name: string
uid: string
}[]
uid: string
isPublic: true
name: string
description: string | null
iconId: string | null
templateRepositoryTags: {
tag: Tag
}[]
}
}>(`/api/templateRepository/get?uid=${uid}`)
export const getTemplateConfig = (uid: string) =>
GET<{
template: {
name: string
uid: string
config: string
}
}>(`/api/templateRepository/template/getConfig?uid=${uid}`)
export const listTemplate = (templateRepositoryUid: string) =>
GET<{
templateList: {
uid: string
name: string
config: string
image: string
createAt: Date
updateAt: Date
}[]
}>(`/api/templateRepository/template/list?templateRepositoryUid=${templateRepositoryUid}`)
export const listTag = () =>
GET<{
tagList: Tag[]
}>(`/api/templateRepository/tag/list`)

export const createTemplateReposistory = (data: CreateTemplateRepositoryType) => POST(`/api/templateRepository/withTemplate/create`, data)
export const createTemplateReposistory = (data: CreateTemplateRepositoryType) =>
POST(`/api/templateRepository/withTemplate/create`, data)
export const initUser = () => POST<string>(`/api/auth/init`)

export const deleteTemplateRepository = (templateRepositoryUid: string) => DELETE(`/api/templateRepository/delete?templateRepositoryUid=${templateRepositoryUid}`)
export const deleteTemplateRepository = (templateRepositoryUid: string) =>
DELETE(`/api/templateRepository/delete?templateRepositoryUid=${templateRepositoryUid}`)

export const updateTemplateReposistory = (data: UpdateTemplateRepositoryType) => POST(`/api/templateRepository/update`, data)
export const updateTemplate = (data: UpdateTemplateType) => POST(`/api/templateRepository/withTemplate/update`, data)
export const deleteTemplate = (templateUid: string) => DELETE(`/api/templateRepository/template/delete?uid=${templateUid}`)
export const updateTemplateReposistory = (data: UpdateTemplateRepositoryType) =>
POST(`/api/templateRepository/update`, data)
export const updateTemplate = (data: UpdateTemplateType) =>
POST(`/api/templateRepository/withTemplate/update`, data)
export const deleteTemplate = (templateUid: string) =>
DELETE(`/api/templateRepository/template/delete?uid=${templateUid}`)
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { useRouter } from '@/i18n';
import { useGlobalStore } from '@/stores/global';
import { DevboxListItemTypeV2 } from '@/types/devbox';

import DevboxStatusTag from '@/components/DevboxStatusTag';
import MyIcon from '@/components/Icon';
import IDEButton from '@/components/IDEButton';
import ReleaseModal from '@/components/modals/releaseModal';
import PodLineChart from '@/components/PodLineChart';
import { AdvancedTable } from '@/components/AdvancedTable';
import DevboxStatusTag from '@/components/DevboxStatusTag';
import ReleaseModal from '@/components/modals/ReleaseModal';

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

Expand All @@ -29,9 +29,6 @@ const DevboxList = ({
const router = useRouter();
const t = useTranslations();
const { message: toast } = useMessage();
const duplicatedDevboxList = Array(20)
.fill(0)
.flatMap(() => [...devboxList]);

// TODO: Unified Loading Behavior
const { setLoading } = useGlobalStore();
Expand Down Expand Up @@ -224,6 +221,7 @@ const DevboxList = ({
sshPort={item.sshPort}
status={item.status}
mr={'8px'}
runtimeType={item.template.templateRepository.iconId as string}
/>
<Button
mr={'8px'}
Expand Down Expand Up @@ -347,7 +345,7 @@ const DevboxList = ({
];
return (
<>
<AdvancedTable columns={columns} data={duplicatedDevboxList} itemClass="devboxListItem" />
<AdvancedTable columns={columns} data={devboxList} itemClass="devboxListItem" />
{!!delDevbox && (
<DelModal
devbox={delDevbox}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { useTranslations } from 'next-intl'
import { useSearchParams } from 'next/navigation'
import { Box, Center, Flex, Grid, useTheme } from '@chakra-ui/react'

import { useRouter } from '@/i18n'
import Code from '@/components/Code'
import MyIcon from '@/components/Icon'

import { useRouter } from '@/i18n'
import { obj2Query } from '@/utils/tools'
import type { YamlItemType } from '@/types'
import { useCopyData } from '@/utils/tools'
import YamlCode from '@/components/YamlCode/index'

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

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