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 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 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
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
62 changes: 44 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,24 @@ 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
})

export const getSSHRuntimeInfo = (data: { devboxName: string; runtimeName: string }) =>
GET<{
workingDir: string
releaseCommand: string
releaseArgs: string
}>('/api/getSSHRuntimeInfo', data)
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}`)
Loading
Loading