-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: update deploy * chore: deploy yaml add usw coin * chore: text adjust * style: release tag color * feat: add port column in detail * fix&style: adjust update modal style and some value * fix: next build bug
- Loading branch information
Showing
15 changed files
with
377 additions
and
26 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
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
54 changes: 54 additions & 0 deletions
54
frontend/providers/devbox/app/api/getAppsByDevboxId/route.ts
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import type { NextRequest } from 'next/server' | ||
|
||
import { devboxIdKey } from '@/constants/devbox' | ||
import { authSession } from '@/services/backend/auth' | ||
import { getK8s } from '@/services/backend/kubernetes' | ||
import { jsonRes } from '@/services/backend/response' | ||
|
||
export const dynamic = 'force-dynamic' | ||
|
||
export async function GET(req: NextRequest) { | ||
try { | ||
const apps = await getApps(req) | ||
return jsonRes({ data: apps }) | ||
} catch (err: any) { | ||
return jsonRes({ | ||
code: 500, | ||
error: err | ||
}) | ||
} | ||
} | ||
|
||
async function getApps(req: NextRequest) { | ||
const { searchParams } = req.nextUrl | ||
const devboxId = searchParams.get('devboxId') as string | ||
|
||
const { k8sApp, namespace } = await getK8s({ | ||
kubeconfig: await authSession(req.headers) | ||
}) | ||
|
||
const response = await Promise.allSettled([ | ||
k8sApp.listNamespacedDeployment( | ||
namespace, | ||
undefined, | ||
undefined, | ||
undefined, | ||
undefined, | ||
`${devboxIdKey}=${devboxId}` | ||
), | ||
k8sApp.listNamespacedStatefulSet( | ||
namespace, | ||
undefined, | ||
undefined, | ||
undefined, | ||
undefined, | ||
`${devboxIdKey}=${devboxId}` | ||
) | ||
]) | ||
const apps = response | ||
.filter((item) => item.status === 'fulfilled') | ||
.map((item: any) => item?.value?.body?.items) | ||
.filter((item) => item) | ||
.flat() | ||
return apps | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.