refactor: add script install command

This commit is contained in:
moonrailgun 2023-11-07 22:36:07 +08:00
parent 2967fcd05d
commit c41994879a
2 changed files with 45 additions and 7 deletions

View File

@ -9,6 +9,7 @@ import {
Steps,
Switch,
Table,
Tabs,
Tooltip,
Typography,
} from 'antd';
@ -71,7 +72,20 @@ export const Servers: React.FC = React.memo(() => {
onCancel={() => setIsModalOpen(false)}
>
<div>
<AddServerStep />
<Tabs
items={[
{
key: 'script',
label: 'Script',
children: <InstallScript />,
},
{
key: 'manual',
label: 'Manual',
children: <AddServerStep />,
},
]}
/>
</div>
</Modal>
</div>
@ -218,6 +232,27 @@ export const ServerList: React.FC<{
});
ServerList.displayName = 'ServerList';
export const InstallScript: React.FC = React.memo(() => {
const workspaceId = useCurrentWorkspaceId();
const command = `curl -o- ${window.location.origin}/serverStatus/${workspaceId}/install.sh | bash`;
return (
<div>
<div>Run this command in your linux machine</div>
<Typography.Paragraph
copyable={{
format: 'text/plain',
text: command,
}}
className="h-[96px] flex p-2 rounded bg-black bg-opacity-5 border border-black border-opacity-10 overflow-auto"
>
<span>{command}</span>
</Typography.Paragraph>
</div>
);
});
export const AddServerStep: React.FC = React.memo(() => {
const workspaceId = useCurrentWorkspaceId();
const [current, setCurrent] = useState(0);
@ -272,7 +307,10 @@ export const AddServerStep: React.FC = React.memo(() => {
description: (
<div>
run reporter with:{' '}
<Typography.Text code={true} copyable={{ text: command }}>
<Typography.Text
code={true}
copyable={{ format: 'text/plain', text: command }}
>
{command}
</Typography.Text>
<Button

View File

@ -26,16 +26,16 @@ export const Profile: React.FC = React.memo(() => {
<Card>
<Form layout="vertical">
<Form.Item label="User Id">
<Typography.Text copyable={true} code={true}>
{userInfo?.id}
</Typography.Text>
</Form.Item>
<Form.Item label="Current Workspace Id">
<Typography.Text copyable={true} code={true}>
{userInfo?.currentWorkspace?.id}
</Typography.Text>
</Form.Item>
<Form.Item label="User Id">
<Typography.Text copyable={true} code={true}>
{userInfo?.id}
</Typography.Text>
</Form.Item>
<Form.Item label="Password">
<Button danger={true} onClick={() => setOpenChangePassword(true)}>
Change Password