chore: create cluster ux

This commit is contained in:
jialin
2025-09-16 11:26:17 +08:00
parent 55b0a20a4a
commit 62dbd18ef8
26 changed files with 690 additions and 392 deletions
+2 -49
View File
@@ -1,64 +1,17 @@
import ScrollerModal from '@/components/scroller-modal';
import {
AppleOutlined,
LinuxOutlined,
WindowsOutlined
} from '@ant-design/icons';
import { useIntl } from '@umijs/max';
import { TabsProps } from 'antd';
import React from 'react';
import MacOS from './add-worker-macos';
import ContainerInstall from './container-install';
type ViewModalProps = {
open: boolean;
token: string;
onCancel: () => void;
};
const AddWorker: React.FC<ViewModalProps> = (props) => {
const { open, onCancel } = props || {};
const { open, onCancel, token = '${token}' } = props || {};
const intl = useIntl();
const [token, setToken] = React.useState('');
const [activeKey, setActiveKey] = React.useState('container');
const items: TabsProps['items'] = [
{
key: 'container',
label: 'Linux',
icon: <LinuxOutlined />,
children: <ContainerInstall token={token} />
},
{
key: 'macos',
label: 'macOS',
icon: <AppleOutlined />,
children: (
<MacOS
token={token}
platform={{
os: 'macOS',
downloadurl: 'https://gpustack.ai/',
supportVersions: 'resource.register.maos.support'
}}
/>
)
},
{
key: 'windows',
label: 'Windows',
icon: <WindowsOutlined />,
children: (
<MacOS
token={token}
platform={{
os: 'Windows',
downloadurl: 'https://gpustack.ai/',
supportVersions: 'resource.register.windows.support'
}}
/>
)
}
];
return (
<ScrollerModal
@@ -42,7 +42,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
return commandCode?.registerWorker({
server: origin,
tag: tag,
token: '${token}',
token: props.token || '${token}',
workerip: '${workerip}'
});
}, [versionInfo, activeKey, props.token, npuKey]);
@@ -53,38 +53,8 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
return (
<div className="container-install">
<ul className="notes">
<li>
{intl.formatMessage(
{ id: 'resources.worker.current.version' },
{ version: versionInfo.version }
)}
</li>
<li>
<span
dangerouslySetInnerHTML={{
__html: intl.formatMessage({
id: 'resources.worker.driver.install'
})
}}
></span>
</li>
</ul>
<h3 className="font-size-14 font-600">
1.{' '}
<span
dangerouslySetInnerHTML={{
__html: intl.formatMessage({ id: 'resources.worker.add.step1' })
}}
></span>
</h3>
<HighlightCode
code={addWorkerGuide.container.getToken}
theme="dark"
lang="bash"
></HighlightCode>
<h3 className="m-t-10 font-size-14 font-600">
2. {intl.formatMessage({ id: 'resources.worker.add.step2' })}{' '}
1. {intl.formatMessage({ id: 'resources.worker.add.step2' })}{' '}
<span
className="font-size-12"
style={{ color: 'var(--ant-color-text-tertiary)' }}
@@ -146,7 +116,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
></HighlightCode>
)}
<h3 className="m-b-0 m-t-10 font-size-14 font-600">
3. {intl.formatMessage({ id: 'resources.worker.add.step3' })}
2. {intl.formatMessage({ id: 'resources.worker.add.step3' })}
</h3>
</div>
);