diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 84db80ca..3ed73779 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -206,7 +206,8 @@ export default (props: any) => { runtimeConfig, loading, initialState, - setInitialState + setInitialState, + intl }); if (runtimeConfig.rightContentRender) { return runtimeConfig.rightContentRender(layoutProps, dom, { @@ -215,7 +216,8 @@ export default (props: any) => { runtimeConfig, loading, initialState, - setInitialState + setInitialState, + intl }); } return dom; diff --git a/src/layouts/rightRender.tsx b/src/layouts/rightRender.tsx index b9905f69..949b0aac 100644 --- a/src/layouts/rightRender.tsx +++ b/src/layouts/rightRender.tsx @@ -14,9 +14,9 @@ export function getRightRenderContent(opts: { loading: boolean; initialState: any; setInitialState: any; + intl: any; }) { - console.log('runtimeConfig==', opts.runtimeConfig, opts); - // const intl = useIntl(); + const { intl } = opts; if (opts.runtimeConfig.rightRender) { return opts.runtimeConfig.rightRender( opts.initialState, @@ -66,8 +66,7 @@ export function getRightRenderContent(opts: { - {/* {FormattedMessage({ id: 'common.settings.language' })} */} - Language + {intl?.formatMessage?.({ id: 'common.settings.language' })} } @@ -87,8 +86,7 @@ export function getRightRenderContent(opts: { label: ( <> - {/* {intl.formatMessage({ id: 'common.button.settings' })} */} - Settings + {intl?.formatMessage?.({ id: 'common.button.settings' })} ), onClick: () => { @@ -112,8 +110,7 @@ export function getRightRenderContent(opts: { label: ( <> - {/* {intl.formatMessage({ id: 'common.button.logout' })} */} - Logout + {intl?.formatMessage?.({ id: 'common.button.logout' })} ), onClick: () => { diff --git a/src/pages/resources/components/nodes.tsx b/src/pages/resources/components/workers.tsx similarity index 75% rename from src/pages/resources/components/nodes.tsx rename to src/pages/resources/components/workers.tsx index 0502b6e4..cfa09811 100644 --- a/src/pages/resources/components/nodes.tsx +++ b/src/pages/resources/components/workers.tsx @@ -174,14 +174,30 @@ const Models: React.FC = () => { key="GPU" render={(text, record: ListItem) => { return ( - + + {record?.status?.gpu.map((item) => { + return ( + + + + {' '} + {`${item.core.total}C`} /{' '} + {item.core.utilization_rate + ? `${item.core.utilization_rate}%` + : 0} + + + ); + })} + ); }} /> @@ -198,7 +214,30 @@ const Models: React.FC = () => { dataIndex="VRAM" key="VRAM" render={(text, record: ListItem) => { - return ; + return ( + + {record?.status?.gpu.map((item) => { + return ( + + + + {item.memory.allocated + ? `${formateUtilazation(item.memory.allocated, item.memory.total)}%` + : 0} + + + ); + })} + + ); }} /> diff --git a/src/pages/resources/config/types.ts b/src/pages/resources/config/types.ts index eb663d19..74a1b1a3 100644 --- a/src/pages/resources/config/types.ts +++ b/src/pages/resources/config/types.ts @@ -3,12 +3,17 @@ export interface Gpu { name: string; vendor: string; index: number; - core_total: number; - core_allocated: number; - core_utilization_rate: number; - memory_total: number; - memory_allocated: number; - memory_used: number; + core: { + total: number; + allocated: number; + utilization_rate: number; + }; + memory: { + total: number; + allocated: number; + used: number; + utilization_rate: number; + }; temperature: number; } diff --git a/src/pages/resources/index.tsx b/src/pages/resources/index.tsx index 2f420eef..77d07056 100644 --- a/src/pages/resources/index.tsx +++ b/src/pages/resources/index.tsx @@ -4,13 +4,13 @@ import type { TabsProps } from 'antd'; import { Tabs } from 'antd'; import { useState } from 'react'; import GPUs from './components/gpus'; -import Nodes from './components/nodes'; +import Workers from './components/workers'; const items: TabsProps['items'] = [ { key: 'workers', label: 'Workers', - children: + children: }, { key: 'gpus',