Skip to content

Commit

Permalink
add: draft for model player UI derived from WebUI
Browse files Browse the repository at this point in the history
  • Loading branch information
lizable committed Nov 25, 2024
1 parent 3f18c86 commit f419121
Show file tree
Hide file tree
Showing 27 changed files with 188 additions and 64 deletions.
6 changes: 3 additions & 3 deletions react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ const router = createBrowserRouter([
children: [
{
path: '/',
element: <WebUINavigate to="/summary" replace />,
element: <WebUINavigate to="/serving" replace />,
},
{
//for electron dev mode
path: '/build/electron-app/app/index.html',
element: <WebUINavigate to="/summary" replace />,
element: <WebUINavigate to="/serving" replace />,
},
{
//for electron prod mode
path: '/app/index.html',
element: <WebUINavigate to="/summary" replace />,
element: <WebUINavigate to="/serving" replace />,
},
{
path: '/summary',
Expand Down
108 changes: 57 additions & 51 deletions react/src/components/MainLayout/WebUISider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,64 +85,70 @@ const WebUISider: React.FC<WebUISiderProps> = (props) => {
const primaryColors = usePrimaryColors();

const generalMenu = filterEmptyItem<ItemType>([
{
label: <WebUILink to="/summary">{t('webui.menu.Summary')}</WebUILink>,
icon: <DashboardOutlined style={{ color: token.colorPrimary }} />,
key: 'summary',
},
{
label: <WebUILink to="/job">{t('webui.menu.Sessions')}</WebUILink>,
icon: <SessionsIcon style={{ color: token.colorPrimary }} />,
key: 'job',
},
// {
// label: <WebUILink to="/summary">{t('webui.menu.Summary')}</WebUILink>,
// icon: <DashboardOutlined style={{ color: token.colorPrimary }} />,
// key: 'summary',
// },
// {
// label: <WebUILink to="/job">{t('webui.menu.Sessions')}</WebUILink>,
// icon: <SessionsIcon style={{ color: token.colorPrimary }} />,
// key: 'job',
// },
supportServing && {
label: <WebUILink to="/serving">{t('webui.menu.Serving')}</WebUILink>,
icon: <EndpointsIcon style={{ color: token.colorPrimary }} />,
key: 'serving',
},
{
label: <WebUILink to="/import">{t('webui.menu.Import&Run')}</WebUILink>,
icon: <PlayIcon style={{ color: token.colorPrimary }} />,
key: 'import',
},
{
label: <WebUILink to="/data">{t('webui.menu.Data&Storage')}</WebUILink>,
icon: <CloudUploadOutlined style={{ color: token.colorPrimary }} />,
key: 'data',
},
supportUserCommittedImage && {
label: (
<WebUILink to="/my-environment">
{t('webui.menu.MyEnvironments')}
</WebUILink>
),
icon: <MyEnvironmentsIcon style={{ color: token.colorPrimary }} />,
key: 'my-environment',
},
!isHideAgents && {
label: (
<WebUILink to="/agent-summary">
{t('webui.menu.AgentSummary')}
<WebUILink to="/serving">
{t('modelserving.menu.ModelServices')}
</WebUILink>
),
icon: <HddOutlined style={{ color: token.colorPrimary }} />,
key: 'agent-summary',
icon: <EndpointsIcon style={{ color: token.colorPrimary }} />,
key: 'serving',
},
// {
// label: <WebUILink to="/import">{t('webui.menu.Import&Run')}</WebUILink>,
// icon: <PlayIcon style={{ color: token.colorPrimary }} />,
// key: 'import',
// },
{
label: (
<WebUILink to="/statistics">{t('webui.menu.Statistics')}</WebUILink>
<WebUILink to="/data">{t('modelserving.menu.ModelList')}</WebUILink>
),
icon: <BarChartOutlined style={{ color: token.colorPrimary }} />,
key: 'statistics',
},
!!fasttrackEndpoint && {
label: t('webui.menu.FastTrack'),
icon: <ExportOutlined style={{ color: token.colorPrimary }} />,
key: 'pipeline',
onClick: () => {
window.open(fasttrackEndpoint, '_blank', 'noopener noreferrer');
},
icon: <CloudUploadOutlined style={{ color: token.colorPrimary }} />,
key: 'data',
},
// supportUserCommittedImage && {
// label: (
// <WebUILink to="/my-environment">
// {t('webui.menu.MyEnvironments')}
// </WebUILink>
// ),
// icon: <MyEnvironmentsIcon style={{ color: token.colorPrimary }} />,
// key: 'my-environment',
// },
// !isHideAgents && {
// label: (
// <WebUILink to="/agent-summary">
// {t('webui.menu.AgentSummary')}
// </WebUILink>
// ),
// icon: <HddOutlined style={{ color: token.colorPrimary }} />,
// key: 'agent-summary',
// },
// {
// label: (
// <WebUILink to="/statistics">{t('webui.menu.Statistics')}</WebUILink>
// ),
// icon: <BarChartOutlined style={{ color: token.colorPrimary }} />,
// key: 'statistics',
// },
// !!fasttrackEndpoint && {
// label: t('webui.menu.FastTrack'),
// icon: <ExportOutlined style={{ color: token.colorPrimary }} />,
// key: 'pipeline',
// onClick: () => {
// window.open(fasttrackEndpoint, '_blank', 'noopener noreferrer');
// },
// },
]);

const adminMenu: MenuProps['items'] = [
Expand Down Expand Up @@ -255,7 +261,7 @@ const WebUISider: React.FC<WebUISiderProps> = (props) => {
height: themeConfig?.logo?.size?.height || 24,
cursor: 'pointer',
}}
onClick={() => webuiNavigate(themeConfig?.logo?.href || '/summary')}
onClick={() => webuiNavigate(themeConfig?.logo?.href || '/serving')}
/>
}
theme={currentSiderTheme}
Expand All @@ -275,7 +281,7 @@ const WebUISider: React.FC<WebUISiderProps> = (props) => {
height: themeConfig?.logo.sizeCollapsed?.height ?? 24,
cursor: 'pointer',
}}
onClick={() => webuiNavigate(themeConfig?.logo?.href || '/summary')}
onClick={() => webuiNavigate(themeConfig?.logo?.href || '/serving')}
/>
}
logoTitle={themeConfig?.logo?.logoTitle || siteDescription || 'WebUI'}
Expand Down
2 changes: 1 addition & 1 deletion react/src/pages/Page401.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Page401 = () => {
<Button
size="large"
type="primary"
onClick={() => webuiNavigate('/summary')}
onClick={() => webuiNavigate('/data')}
>
{t('button.GoBackToSummaryPage')}
</Button>
Expand Down
2 changes: 1 addition & 1 deletion react/src/pages/Page404.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Page404 = () => {
<Button
size="large"
type="primary"
onClick={() => webuiNavigate('/summary')}
onClick={() => webuiNavigate('/data')}
>
{t('button.GoBackToSummaryPage')}
</Button>
Expand Down
6 changes: 6 additions & 0 deletions resources/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "Stunde",
"day": "day",
"week": "Woche"
},
"modelserving": {
"menu": {
"ModelServices": "Modelldienstleistungen",
"ModelList": "Modellliste"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "ώρα",
"day": "day",
"week": "εβδομάδα"
},
"modelserving": {
"menu": {
"ModelServices": "Υπηρεσίες μοντέλου",
"ModelList": "Λίστα μοντέλων"
}
}
}
9 changes: 8 additions & 1 deletion resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@
"Expand": "Expand",
"Clear": "Clear",
"Apply": "Apply",
"CopySomething": "Copy {{name}}"
"CopySomething": "Copy {{name}}",
"GoBackToModelServicesPage": "Go back to model services page"
},
"agent": {
"Endpoint": "Endpoint",
Expand Down Expand Up @@ -1774,5 +1775,11 @@
"hour": "hour",
"day": "day",
"week": "week"
},
"modelserving": {
"menu": {
"ModelServices": "Model Services",
"ModelList": "Model List"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1771,5 +1771,11 @@
"hour": "hora",
"day": "day",
"week": "semana"
},
"modelserving": {
"menu": {
"ModelServices": "Servicios modelo",
"ModelList": "Lista de modelos"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1767,5 +1767,11 @@
"hour": "tunnin",
"day": "day",
"week": "viikko"
},
"modelserving": {
"menu": {
"ModelServices": "Mallipalvelut",
"ModelList": "Malliluettelo"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "heure",
"day": "day",
"week": "semaine"
},
"modelserving": {
"menu": {
"ModelServices": "Services de modèles",
"ModelList": "Liste des modèles"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "jam",
"day": "day",
"week": "pekan"
},
"modelserving": {
"menu": {
"ModelServices": "Layanan Model",
"ModelList": "Daftar Model"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "ora",
"day": "day",
"week": "settimana"
},
"modelserving": {
"menu": {
"ModelServices": "Servizi modello",
"ModelList": "Elenco dei modelli"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "時間",
"day": "",
"week": ""
},
"modelserving": {
"menu": {
"ModelServices": "モデルサービス",
"ModelList": "機種一覧"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1771,5 +1771,11 @@
"hour": "시간",
"day": "",
"week": ""
},
"modelserving": {
"menu": {
"ModelServices": "모델 서비스",
"ModelList": "모델 리스트"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/mn.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "цаг",
"day": "day",
"week": "долоо хоног"
},
"modelserving": {
"menu": {
"ModelServices": "Загвар үйлчилгээ",
"ModelList": "Загварын жагсаалт"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/ms.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "jam",
"day": "day",
"week": "minggu"
},
"modelserving": {
"menu": {
"ModelServices": "Perkhidmatan Model",
"ModelList": "Senarai Model"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "godzina",
"day": "day",
"week": "tydzień"
},
"modelserving": {
"menu": {
"ModelServices": "Usługi modelarskie",
"ModelList": "Lista modeli"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "hora",
"day": "day",
"week": "semana"
},
"modelserving": {
"menu": {
"ModelServices": "Serviços de modelo",
"ModelList": "Lista de modelos"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "hora",
"day": "day",
"week": "semana"
},
"modelserving": {
"menu": {
"ModelServices": "Serviços de modelo",
"ModelList": "Lista de modelos"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,11 @@
"hour": "час",
"day": "day",
"week": "неделя"
},
"modelserving": {
"menu": {
"ModelServices": "Модельные услуги",
"ModelList": "Список моделей"
}
}
}
6 changes: 6 additions & 0 deletions resources/i18n/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -1749,5 +1749,11 @@
"hour": "ชั่วโมง",
"day": "day",
"week": "สัปดาห์"
},
"modelserving": {
"menu": {
"ModelServices": "บริการโมเดล",
"ModelList": "รายการรุ่น"
}
}
}
Loading

0 comments on commit f419121

Please sign in to comment.