-
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.
* add-runtime feat:devbox template * fix:devbox template merge * fix:devbox style & add migrations * feat: add version manage * fix(devbox):fix network update * fix(devbox):show cname error * chore(devbox): add postinstall for prisma * fix(devbox): image build error * chore(devbox):remove comment
- Loading branch information
1 parent
f365048
commit dade357
Showing
137 changed files
with
7,687 additions
and
2,134 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,5 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
prisma/generated |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
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) => { | ||
const searchParams = new URLSearchParams() | ||
if (tags && tags.length > 0) { | ||
tags.forEach((tag) => { | ||
searchParams.append('tags', tag) | ||
}) | ||
} | ||
searchParams.append('page', page.page.toString()) | ||
searchParams.append('pageSize', page.pageSize.toString()) | ||
if (search) searchParams.append('search', search) | ||
return GET<{ | ||
templateRepositoryList: { | ||
uid: string; | ||
name: string; | ||
description: string | null; | ||
iconId: string | null; | ||
templates: { | ||
uid: string; | ||
name: string; | ||
}[]; | ||
templateRepositoryTags: { | ||
tag: Tag; | ||
}[]; | ||
}[], | ||
page: { | ||
page: number, | ||
pageSize: number, | ||
totalItems: number, | ||
totalPage: number, | ||
} | ||
}>(`/api/templateRepository/list?${searchParams.toString()}`) | ||
|
||
} | ||
export const listPrivateTemplateRepository = ({ | ||
search, | ||
page, | ||
pageSize, | ||
}: { | ||
search?: string, | ||
page?: number, | ||
pageSize?: number, | ||
} = {}) => { | ||
const searchParams = new URLSearchParams() | ||
|
||
if (search) searchParams.append('search', search) | ||
if (page) searchParams.append('page', page.toString()) | ||
if (pageSize) searchParams.append('pageSize', pageSize.toString()) | ||
return GET<{ | ||
templateRepositoryList: { | ||
uid: string; | ||
name: string; | ||
description: string | null; | ||
iconId: string | null; | ||
templates: { | ||
uid: string; | ||
name: string; | ||
}[]; | ||
isPublic: boolean; | ||
templateRepositoryTags: { | ||
tag: Tag; | ||
}[]; | ||
}[], | ||
page: { | ||
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 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 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}`) |
90 changes: 90 additions & 0 deletions
90
frontend/providers/devbox/app/[lang]/(platform)/(home)/components/DevboxHeader.tsx
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,90 @@ | ||
import MyIcon from "@/components/Icon"; | ||
import { TemplateState } from "@/constants/template"; | ||
import { usePathname, useRouter } from "@/i18n"; | ||
import { useTemplateStore } from "@/stores/template"; | ||
import { Box, Button, Center, Flex, Text, useTheme } from "@chakra-ui/react"; | ||
import { useTranslations } from "next-intl"; | ||
import { useEffect } from "react"; | ||
|
||
export default function DevboxHeader({ listLength }: { listLength: number }) { | ||
const { openTemplateModal, config, updateTemplateModalConfig } = useTemplateStore() | ||
const theme = useTheme() | ||
const router = useRouter() | ||
const t = useTranslations() | ||
const pathname = usePathname() | ||
const lastRoute = '/?openTemplate=publicTemplate' | ||
useEffect(() => { | ||
const refreshLastRoute = '/' | ||
if (config.lastRoute.includes('openTemplate')) { | ||
openTemplateModal({ | ||
...config, | ||
lastRoute: refreshLastRoute | ||
}) | ||
} else { | ||
updateTemplateModalConfig({ | ||
...config, | ||
lastRoute: refreshLastRoute | ||
}) | ||
} | ||
}, []) | ||
return <Flex h={'90px'} alignItems={'center'}> | ||
<Center | ||
mr={'16px'} | ||
width={'46px'} | ||
bg={'#FFF'} | ||
height={'46px'} | ||
border={theme.borders.base} | ||
borderRadius={'md'}> | ||
<MyIcon name="logo" w={'30px'} h={'30px'} /> | ||
</Center> | ||
<Box fontSize={'xl'} color={'grayModern.900'} fontWeight={'bold'}> | ||
{t('devbox_list')} | ||
</Box> | ||
<Box ml={'8px'} fontSize={'md'} fontWeight={'bold'} color={'grayModern.500'}> | ||
( {listLength} ) | ||
</Box> | ||
<Flex | ||
alignItems="center" | ||
justifyContent="center" | ||
height="18px" | ||
borderRadius="6px" | ||
gap="4px" | ||
mr={'20px'} | ||
ml={'auto'} | ||
cursor="pointer" | ||
onClick={() => { | ||
// setLastRoute(pathname) | ||
openTemplateModal({ | ||
'templateState': TemplateState.publicTemplate, | ||
lastRoute, | ||
}) | ||
}} | ||
> | ||
<MyIcon | ||
name={'templateTitle'} | ||
width="18px" | ||
height="18px" | ||
color='brightBlue.600' | ||
fill={"currentColor"} | ||
/> | ||
<Text | ||
fontFamily="PingFang SC" | ||
fontSize="12px" | ||
fontWeight="500" | ||
lineHeight="16px" | ||
letterSpacing="0.5px" | ||
color='brightBlue.600' | ||
> | ||
{t("scan_templates")} | ||
</Text> | ||
</Flex> | ||
<Button | ||
minW={'156px'} | ||
h={'40px'} | ||
variant={'solid'} | ||
leftIcon={<MyIcon name={'plus'} w={'20px'} fill={'#ffffff'} />} | ||
onClick={() => router.push('/devbox/create')}> | ||
{t('create_devbox')} | ||
</Button> | ||
</Flex>; | ||
} |
Oops, something went wrong.