Skip to content

Commit

Permalink
fix: detail sshConnection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhiter committed Jan 13, 2025
1 parent 549e9b6 commit 2e54d3b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 65 deletions.
7 changes: 0 additions & 7 deletions frontend/providers/devbox/api/devbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,3 @@ export const execCommandInDevboxPod = (data: {
onDownloadProgress: data.onDownloadProgress,
signal: data.signal
})

export const getSSHRuntimeInfo = (data: { devboxName: string; runtimeName: string }) =>
GET<{
workingDir: string
releaseCommand: string
releaseArgs: string
}>('/api/getSSHRuntimeInfo', data)
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import { Box, Text, Flex, Image, Spinner, Tooltip, Button } from '@chakra-ui/rea

import MyIcon from '@/components/Icon'
import { useEnvStore } from '@/stores/env'
import { downLoadBlob } from '@/utils/tools'
import { useDevboxStore } from '@/stores/devbox'
import { getTemplateConfig } from '@/api/template'
import { getSSHConnectionInfo } from '@/api/devbox'
import { JetBrainsGuideData } from '@/components/IDEButton'
import { downLoadBlob, parseTemplateConfig } from '@/utils/tools'
import SshConnectModal from '@/components/modals/SshConnectModal'
import { getSSHConnectionInfo, getSSHRuntimeInfo } from '@/api/devbox'

const BasicInfo = () => {
const t = useTranslations()
Expand All @@ -26,34 +27,35 @@ const BasicInfo = () => {
const { base64PrivateKey, userName, token } = await getSSHConnectionInfo({
devboxName: devboxDetail?.name as string
})
const { workingDir } = await getSSHRuntimeInfo({
devboxName: devboxDetail?.name as string,
runtimeName: devboxDetail?.templateName as string
})

const result = await getTemplateConfig(devboxDetail?.templateUid as string)
const config = parseTemplateConfig(result.template.config)
console.log('config', config)

const sshPrivateKey = Buffer.from(base64PrivateKey, 'base64').toString('utf-8')

if (!devboxDetail?.sshPort) return

setSshConfigData({
devboxName: devboxDetail?.name,
runtimeType: devboxDetail?.iconId,
runtimeType: devboxDetail?.templateRepositoryName,
privateKey: sshPrivateKey,
userName,
token,
workingDir,
workingDir: config.workingDir,
host: env.sealosDomain,
port: devboxDetail?.sshPort.toString(),
configHost: `${env.sealosDomain}_${env.namespace}_${devboxDetail?.name}`
})

setOnOpenSsHConnect(true)
}, [
devboxDetail?.iconId,
devboxDetail?.name,
devboxDetail?.templateUid,
devboxDetail?.sshPort,
devboxDetail?.templateName,
env.namespace,
env.sealosDomain
devboxDetail?.templateRepositoryName,
env.sealosDomain,
env.namespace
])

const handleCopySSHCommand = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const Version = () => {
listPrivateTemplateRepositoryQuery.data?.templateRepositoryList || []
const handleDeploy = useCallback(
async (version: DevboxVersionListItemType) => {
// const { releaseCommand, releaseArgs } = await getSSHRuntimeInfo(devbox.runtimeVersion)
if (!devbox) return
const result = await getTemplateConfig(devbox.templateUid)
const config = parseTemplateConfig(result.template.config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export async function GET(req: NextRequest) {

const headerList = req.headers

const { ROOT_RUNTIME_NAMESPACE } = process.env

const { k8sCore, namespace, k8sCustomObjects } = await getK8s({
kubeconfig: await authSession(headerList)
})
Expand Down
43 changes: 0 additions & 43 deletions frontend/providers/devbox/app/api/getSSHRuntimeInfo/route.ts

This file was deleted.

0 comments on commit 2e54d3b

Please sign in to comment.