Skip to content

Commit 3428069

Browse files
authored
update instruction for push new bento version in UI (#207)
1 parent b3fce3c commit 3428069

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

dashboard/src/components/BentoListCard.tsx

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,38 @@
1-
import { useCallback, useState } from 'react'
1+
import { useState } from 'react'
22
import { useQuery } from 'react-query'
33
import Card from '@/components/Card'
4-
import { createBento, listBentos } from '@/services/bento'
4+
import { listBentos } from '@/services/bento'
55
import { usePage } from '@/hooks/usePage'
6-
import { ICreateBentoSchema } from '@/schemas/bento'
7-
import BentoForm from '@/components/BentoForm'
86
import useTranslation from '@/hooks/useTranslation'
7+
import { useCurrentThemeType } from '@/hooks/useCurrentThemeType'
98
import { Button, SIZE as ButtonSize } from 'baseui/button'
109
import User from '@/components/User'
1110
import { Modal, ModalHeader, ModalBody } from 'baseui/modal'
11+
import SyntaxHighlighter from 'react-syntax-highlighter'
12+
import { dark, docco } from 'react-syntax-highlighter/dist/esm/styles/hljs'
1213
import { resourceIconMapping } from '@/consts'
1314
import qs from 'qs'
1415
import { useQ } from '@/hooks/useQ'
1516
import { useFetchOrganizationMembers } from '@/hooks/useFetchOrganizationMembers'
1617
import FilterInput from './FilterInput'
1718
import FilterBar from './FilterBar'
1819
import BentoList from './BentoList'
20+
import Link from './Link'
1921

2022
export interface IBentoListCardProps {
2123
bentoRepositoryName: string
2224
}
2325

2426
export default function BentoListCard({ bentoRepositoryName }: IBentoListCardProps) {
2527
const [page] = usePage()
28+
const themeType = useCurrentThemeType()
2629
const { q, updateQ } = useQ()
2730
const membersInfo = useFetchOrganizationMembers()
2831
const queryKey = `fetchBentos:${bentoRepositoryName}:${qs.stringify(page)}`
2932
const bentosInfo = useQuery(queryKey, () => listBentos(bentoRepositoryName, page))
3033
const [isCreateBentoVersionOpen, setIsCreateBentoVersionOpen] = useState(false)
31-
const handleCreateBentoVersion = useCallback(
32-
async (data: ICreateBentoSchema) => {
33-
await createBento(bentoRepositoryName, data)
34-
await bentosInfo.refetch()
35-
setIsCreateBentoVersionOpen(false)
36-
},
37-
[bentoRepositoryName, bentosInfo]
38-
)
3934
const [t] = useTranslation()
35+
const highlightTheme = themeType === 'dark' ? dark : docco
4036

4137
return (
4238
<Card
@@ -153,7 +149,30 @@ export default function BentoListCard({ bentoRepositoryName }: IBentoListCardPro
153149
>
154150
<ModalHeader>{t('create sth', [t('version')])}</ModalHeader>
155151
<ModalBody>
156-
<BentoForm onSubmit={handleCreateBentoVersion} />
152+
<div>
153+
<p>
154+
1. {t('Create an [API-token] and login your BentoML CLI. prefix')}
155+
<Link href='/api_tokens' target='_blank'>
156+
{t('api token')}
157+
</Link>
158+
{t('Create an [API-token] and login your BentoML CLI. suffix')}
159+
</p>
160+
<p>
161+
2. {t('Push new Bento to Yatai with the `bentoml push` CLI command. prefix')}
162+
<SyntaxHighlighter
163+
language='bash'
164+
style={highlightTheme}
165+
customStyle={{
166+
margin: 0,
167+
display: 'inline',
168+
padding: 2,
169+
}}
170+
>
171+
bentoml push
172+
</SyntaxHighlighter>
173+
{t('Push new Bento to Yatai with the `bentoml push` CLI command. suffix')}
174+
</p>
175+
</div>
157176
</ModalBody>
158177
</Modal>
159178
</Card>

0 commit comments

Comments
 (0)