fix(style): model status
This commit is contained in:
@@ -22,6 +22,9 @@ export default {
|
|||||||
Progress: {
|
Progress: {
|
||||||
lineBorderRadius: 4
|
lineBorderRadius: 4
|
||||||
},
|
},
|
||||||
|
Select: {
|
||||||
|
itemSelectedBg: 'rgba(0,0,0,0.06)'
|
||||||
|
},
|
||||||
Slider: {
|
Slider: {
|
||||||
handleSize: 8,
|
handleSize: 8,
|
||||||
handleSizeHover: 8,
|
handleSizeHover: 8,
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { createFromIconfontCN } from '@ant-design/icons';
|
||||||
|
|
||||||
|
const IconFont = createFromIconfontCN({
|
||||||
|
scriptUrl: '//at.alicdn.com/t/c/font_4613488_clxjnjvlf6m.js'
|
||||||
|
});
|
||||||
|
|
||||||
|
export default IconFont;
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
&.download {
|
&.download {
|
||||||
background-color: var(--ant-blue-2);
|
border: 1px solid var(--ant-color-border) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.download {
|
.download {
|
||||||
@@ -24,12 +24,12 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: var(--ant-color-primary);
|
background-color: rgba(0, 0, 0, 15%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress {
|
.progress {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
color: var(--color-white-1);
|
color: var(--ant-color-text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,17 +51,10 @@ const StatusTag: React.FC<StatusTagProps> = ({ statusValue, download }) => {
|
|||||||
className={classNames('status-tag', {
|
className={classNames('status-tag', {
|
||||||
download: download?.percent
|
download: download?.percent
|
||||||
})}
|
})}
|
||||||
style={
|
style={{
|
||||||
download
|
color: statusColor?.text,
|
||||||
? {
|
border: `1px solid ${statusColor?.text}`
|
||||||
color: StatusColorMap['success']['text'],
|
}}
|
||||||
border: `1px solid ${StatusColorMap['success']['text']}`
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
color: statusColor?.text,
|
|
||||||
border: `1px solid ${statusColor?.text}`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{renderContent()}
|
{renderContent()}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
.transition-content-wrapper {
|
.transition-content-wrapper {
|
||||||
background-color: var(--color-fill-1);
|
background-color: var(--color-fill-1);
|
||||||
padding: 8px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ const TransitionWrapper: React.FC<TransitionWrapProps> = forwardRef(
|
|||||||
className="transition-content-wrapper"
|
className="transition-content-wrapper"
|
||||||
style={{
|
style={{
|
||||||
minHeight: isOpen ? height : 0,
|
minHeight: isOpen ? height : 0,
|
||||||
height: isOpen ? 'auto' : 0
|
height: isOpen ? 'auto' : 0,
|
||||||
|
padding: isOpen ? '8px' : '0 8px'
|
||||||
}}
|
}}
|
||||||
ref={contentRef}
|
ref={contentRef}
|
||||||
>
|
>
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ export const StatusColorMap: Record<StatusType, { text: string; bg: string }> =
|
|||||||
bg: `var(--ant-green-1)`
|
bg: `var(--ant-green-1)`
|
||||||
},
|
},
|
||||||
inactive: {
|
inactive: {
|
||||||
text: `var(--ant-color-border)`,
|
text: `var(--ant-color-text-secondary)`,
|
||||||
bg: `var(--ant-color-fill)`
|
bg: `var(--ant-color-fill)`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -117,7 +117,8 @@ export function getRightRenderContent(opts: {
|
|||||||
<Avatar
|
<Avatar
|
||||||
size={28}
|
size={28}
|
||||||
style={{
|
style={{
|
||||||
color: 'var(--ant-color-text)'
|
color: 'var(--ant-color-text)',
|
||||||
|
fontSize: 16
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{_.toUpper(opts.initialState?.currentUser?.username?.charAt(0))}
|
{_.toUpper(opts.initialState?.currentUser?.username?.charAt(0))}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export default {
|
export default {
|
||||||
'playground.system.tips': 'Enter system message here...',
|
'playground.system.tips': 'Enter system message here',
|
||||||
'playground.title': 'Playground',
|
'playground.title': 'Playground',
|
||||||
'playground.system': 'System',
|
'playground.system': 'System',
|
||||||
'playground.user': 'User',
|
'playground.user': 'User',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export default {
|
export default {
|
||||||
'playground.system.tips': '在这里输入系统消息...',
|
'playground.system.tips': '在这里输入系统消息',
|
||||||
'playground.title': '试验场',
|
'playground.title': '试验场',
|
||||||
'playground.system': '系统',
|
'playground.system': '系统',
|
||||||
'playground.user': '用户',
|
'playground.user': '用户',
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ const AddModal: React.FC<AddModalProps> = ({
|
|||||||
<Modal
|
<Modal
|
||||||
title={title}
|
title={title}
|
||||||
open={open}
|
open={open}
|
||||||
|
centered={true}
|
||||||
onOk={handleSumit}
|
onOk={handleSumit}
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
afterOpenChange={handleAfterOpenChange}
|
afterOpenChange={handleAfterOpenChange}
|
||||||
|
|||||||
@@ -259,6 +259,14 @@ const Models: React.FC = () => {
|
|||||||
return dayjs(text).format('YYYY-MM-DD HH:mm:ss');
|
return dayjs(text).format('YYYY-MM-DD HH:mm:ss');
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Column
|
||||||
|
title={intl.formatMessage({ id: 'common.table.description' })}
|
||||||
|
dataIndex="description"
|
||||||
|
key="description"
|
||||||
|
ellipsis={{
|
||||||
|
showTitle: true
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<Column
|
<Column
|
||||||
title={intl.formatMessage({ id: 'common.table.createTime' })}
|
title={intl.formatMessage({ id: 'common.table.createTime' })}
|
||||||
dataIndex="created_at"
|
dataIndex="created_at"
|
||||||
|
|||||||
@@ -276,6 +276,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
<Modal
|
<Modal
|
||||||
title={title}
|
title={title}
|
||||||
open={open}
|
open={open}
|
||||||
|
centered={true}
|
||||||
onOk={handleSumit}
|
onOk={handleSumit}
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Col, Row, Space } from 'antd';
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { status } from '../config';
|
import { InstanceStatusMap, status } from '../config';
|
||||||
import { ModelInstanceListItem } from '../config/types';
|
import { ModelInstanceListItem } from '../config/types';
|
||||||
|
|
||||||
interface InstanceItemProps {
|
interface InstanceItemProps {
|
||||||
@@ -33,6 +33,15 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
|
|||||||
icon: <DeleteOutlined />
|
icon: <DeleteOutlined />
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
const testStatus = {
|
||||||
|
state: InstanceStatusMap.Scheduled
|
||||||
|
};
|
||||||
|
const getWorkerIp = (item: ModelInstanceListItem) => {
|
||||||
|
if (item.worker_ip) {
|
||||||
|
return item.port ? `${item.worker_ip}:${item.port}` : item.worker_ip;
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<Space size={16} direction="vertical" style={{ width: '100%' }}>
|
<Space size={16} direction="vertical" style={{ width: '100%' }}>
|
||||||
{_.map(list, (item: ModelInstanceListItem, index: number) => {
|
{_.map(list, (item: ModelInstanceListItem, index: number) => {
|
||||||
@@ -40,18 +49,11 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
|
|||||||
<div
|
<div
|
||||||
key={`${item.id}`}
|
key={`${item.id}`}
|
||||||
style={{ borderRadius: 'var(--ant-table-header-border-radius)' }}
|
style={{ borderRadius: 'var(--ant-table-header-border-radius)' }}
|
||||||
className={
|
|
||||||
item.download_progress !== 100 && item.state !== 'Running'
|
|
||||||
? 'skeleton-loading'
|
|
||||||
: ''
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<RowChildren key={`${item.id}_row`}>
|
<RowChildren key={`${item.id}_row`}>
|
||||||
<Row style={{ width: '100%' }} align="middle">
|
<Row style={{ width: '100%' }} align="middle">
|
||||||
<Col span={4}>{item.name}</Col>
|
<Col span={4}>{item.name}</Col>
|
||||||
<Col span={3}>
|
<Col span={3}>{getWorkerIp(item)}</Col>
|
||||||
{item.worker_ip ? `${item.worker_ip}:${item.port}` : '-'}
|
|
||||||
</Col>
|
|
||||||
<Col span={4}>
|
<Col span={4}>
|
||||||
<span>
|
<span>
|
||||||
{item.source === 'huggingface'
|
{item.source === 'huggingface'
|
||||||
@@ -68,7 +70,7 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
|
|||||||
{item.state && (
|
{item.state && (
|
||||||
<StatusTag
|
<StatusTag
|
||||||
download={
|
download={
|
||||||
item.state !== 'Running'
|
item.state === InstanceStatusMap.Downloading
|
||||||
? { percent: item.download_progress }
|
? { percent: item.download_progress }
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
<Modal
|
<Modal
|
||||||
title={intl.formatMessage({ id: 'common.button.viewlog' })}
|
title={intl.formatMessage({ id: 'common.button.viewlog' })}
|
||||||
open={open}
|
open={open}
|
||||||
|
centered={true}
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
closeIcon={true}
|
closeIcon={true}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
keyboard={false}
|
keyboard={false}
|
||||||
width={'max(50%, 600px)'}
|
width={600}
|
||||||
style={{ top: '80px' }}
|
|
||||||
footer={null}
|
footer={null}
|
||||||
>
|
>
|
||||||
<LogsViewer
|
<LogsViewer
|
||||||
|
|||||||
@@ -18,9 +18,24 @@ export const modelSourceMap: Record<string, string> = {
|
|||||||
s3: 'S3'
|
s3: 'S3'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const InstanceStatusMap = {
|
||||||
|
Initializing: 'Initializing',
|
||||||
|
Pending: 'Pending',
|
||||||
|
Running: 'Running',
|
||||||
|
Scheduled: 'Scheduled',
|
||||||
|
Error: 'Error',
|
||||||
|
Downloading: 'Downloading',
|
||||||
|
Unknown: 'Unknown'
|
||||||
|
};
|
||||||
|
|
||||||
export const status: any = {
|
export const status: any = {
|
||||||
Running: StatusMaps.success,
|
[InstanceStatusMap.Running]: StatusMaps.success,
|
||||||
Pending: StatusMaps.transitioning
|
[InstanceStatusMap.Pending]: StatusMaps.transitioning,
|
||||||
|
[InstanceStatusMap.Initializing]: StatusMaps.transitioning,
|
||||||
|
[InstanceStatusMap.Scheduled]: StatusMaps.success,
|
||||||
|
[InstanceStatusMap.Error]: StatusMaps.error,
|
||||||
|
[InstanceStatusMap.Downloading]: StatusMaps.transitioning,
|
||||||
|
[InstanceStatusMap.Unknown]: StatusMaps.inactive
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ActionList = [
|
export const ActionList = [
|
||||||
@@ -40,12 +55,3 @@ export const ActionList = [
|
|||||||
icon: EditOutlined
|
icon: EditOutlined
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export const InstanceStatusMap = {
|
|
||||||
Initializing: 'Initializing',
|
|
||||||
Pending: 'Pending',
|
|
||||||
Running: 'Running',
|
|
||||||
Scheduled: 'Scheduled',
|
|
||||||
Error: 'Error',
|
|
||||||
Downloading: 'Downloading'
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
import IconFont from '@/components/icon-font';
|
||||||
import HotKeys from '@/config/hotkeys';
|
import HotKeys from '@/config/hotkeys';
|
||||||
import {
|
import {
|
||||||
CodeOutlined,
|
CodeOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
EnterOutlined,
|
EnterOutlined,
|
||||||
MacCommandOutlined,
|
|
||||||
PlusOutlined
|
PlusOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
@@ -74,7 +74,7 @@ const ChatFooter: React.FC<ChatFooterProps> = (props) => {
|
|||||||
<Button disabled={disabled} type="primary" onClick={onSubmit}>
|
<Button disabled={disabled} type="primary" onClick={onSubmit}>
|
||||||
{intl.formatMessage({ id: 'common.button.submit' })}
|
{intl.formatMessage({ id: 'common.button.submit' })}
|
||||||
<span className="m-l-5 opct-7">
|
<span className="m-l-5 opct-7">
|
||||||
<MacCommandOutlined /> + <EnterOutlined />
|
<IconFont type="icon-command"></IconFont> + <EnterOutlined />
|
||||||
</span>
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ const MessageList: React.FC<MessageProps> = (props) => {
|
|||||||
uid: messageId.current
|
uid: messageId.current
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
console.log('messageList=====', messageList, messageId.current, chunk);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
const submitMessage = async () => {
|
const submitMessage = async () => {
|
||||||
@@ -115,7 +116,6 @@ const MessageList: React.FC<MessageProps> = (props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { reader, decoder } = result;
|
const { reader, decoder } = result;
|
||||||
|
|
||||||
await readStreamData(reader, decoder, (chunk: any) => {
|
await readStreamData(reader, decoder, (chunk: any) => {
|
||||||
joinMessage(chunk);
|
joinMessage(chunk);
|
||||||
});
|
});
|
||||||
@@ -207,7 +207,10 @@ const MessageList: React.FC<MessageProps> = (props) => {
|
|||||||
autoSize={true}
|
autoSize={true}
|
||||||
onFocus={handleFocus}
|
onFocus={handleFocus}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
placeholder={intl.formatMessage({ id: 'playground.system.tips' })}
|
style={{ minHeight: 40 }}
|
||||||
|
placeholder={intl.formatMessage({
|
||||||
|
id: 'playground.system.tips'
|
||||||
|
})}
|
||||||
onChange={handleSystemMessageChange}
|
onChange={handleSystemMessageChange}
|
||||||
></Input.TextArea>
|
></Input.TextArea>
|
||||||
</TransitionWrapper>
|
</TransitionWrapper>
|
||||||
|
|||||||
@@ -31,18 +31,6 @@ const MessageItem: React.FC<{
|
|||||||
const [currentIsFocus, setCurrentIsFocus] = useState(isFocus);
|
const [currentIsFocus, setCurrentIsFocus] = useState(isFocus);
|
||||||
const inputRef = useRef<any>(null);
|
const inputRef = useRef<any>(null);
|
||||||
|
|
||||||
useHotkeys(
|
|
||||||
HotKeys.SUBMIT,
|
|
||||||
() => {
|
|
||||||
onSubmit();
|
|
||||||
},
|
|
||||||
{
|
|
||||||
enabled: currentIsFocus && !loading,
|
|
||||||
enableOnFormTags: currentIsFocus && !loading,
|
|
||||||
preventDefault: true
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputRef.current && isFocus) {
|
if (inputRef.current && isFocus) {
|
||||||
inputRef.current.focus();
|
inputRef.current.focus();
|
||||||
@@ -110,6 +98,20 @@ const MessageItem: React.FC<{
|
|||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
onDelete();
|
onDelete();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useHotkeys(
|
||||||
|
HotKeys.SUBMIT,
|
||||||
|
() => {
|
||||||
|
inputRef.current.blur();
|
||||||
|
onSubmit();
|
||||||
|
},
|
||||||
|
{
|
||||||
|
enabled: currentIsFocus,
|
||||||
|
enableOnFormTags: currentIsFocus,
|
||||||
|
preventDefault: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="message-item">
|
<div className="message-item">
|
||||||
<div className="role-type">
|
<div className="role-type">
|
||||||
@@ -124,6 +126,7 @@ const MessageItem: React.FC<{
|
|||||||
value={messageContent}
|
value={messageContent}
|
||||||
autoSize={true}
|
autoSize={true}
|
||||||
variant="filled"
|
variant="filled"
|
||||||
|
readOnly={loading}
|
||||||
onChange={handleMessageChange}
|
onChange={handleMessageChange}
|
||||||
onFocus={handleFocus}
|
onFocus={handleFocus}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
},
|
},
|
||||||
formatOnType: true,
|
formatOnType: true,
|
||||||
formatOnPaste: true,
|
formatOnPaste: true,
|
||||||
|
fontWeight: '700',
|
||||||
scrollbar: {
|
scrollbar: {
|
||||||
verticalSliderSize: 8
|
verticalSliderSize: 8
|
||||||
}
|
}
|
||||||
@@ -130,13 +131,13 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
<Modal
|
<Modal
|
||||||
title={title}
|
title={title}
|
||||||
open={open}
|
open={open}
|
||||||
|
centered={true}
|
||||||
onCancel={handleClose}
|
onCancel={handleClose}
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
closeIcon={true}
|
closeIcon={true}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
keyboard={false}
|
keyboard={false}
|
||||||
width={'max(50%, 600px)'}
|
width={660}
|
||||||
style={{ top: '80px' }}
|
|
||||||
footer={null}
|
footer={null}
|
||||||
>
|
>
|
||||||
<div style={{ marginBottom: '10px' }}>
|
<div style={{ marginBottom: '10px' }}>
|
||||||
@@ -151,7 +152,7 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
onChangeLang={handleOnChangeLang}
|
onChangeLang={handleOnChangeLang}
|
||||||
>
|
>
|
||||||
<Editor
|
<Editor
|
||||||
height="500px"
|
height="min(500px, 90vh)"
|
||||||
theme="vs-dark"
|
theme="vs-dark"
|
||||||
className="monaco-editor"
|
className="monaco-editor"
|
||||||
defaultLanguage="shell"
|
defaultLanguage="shell"
|
||||||
|
|||||||
@@ -50,26 +50,6 @@ const Profile: React.FC = () => {
|
|||||||
onFinish={handleOnFinish}
|
onFinish={handleOnFinish}
|
||||||
onFinishFailed={handleOnFinishFailed}
|
onFinishFailed={handleOnFinishFailed}
|
||||||
>
|
>
|
||||||
{/* <Form.Item<ProfileProps>
|
|
||||||
name="username"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: intl.formatMessage(
|
|
||||||
{ id: 'common.form.rule.input' },
|
|
||||||
{
|
|
||||||
name: intl.formatMessage({ id: 'common.form.username' })
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<SealInput.Input
|
|
||||||
label={intl.formatMessage({ id: 'common.form.username' })}
|
|
||||||
required
|
|
||||||
style={{ width: INPUT_WIDTH.default }}
|
|
||||||
></SealInput.Input>
|
|
||||||
</Form.Item> */}
|
|
||||||
<Form.Item<ProfileProps>
|
<Form.Item<ProfileProps>
|
||||||
name="current_password"
|
name="current_password"
|
||||||
rules={[
|
rules={[
|
||||||
@@ -135,6 +115,7 @@ const Profile: React.FC = () => {
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<SealInput.Password
|
<SealInput.Password
|
||||||
|
required={true}
|
||||||
label={intl.formatMessage({ id: 'users.password.confirm' })}
|
label={intl.formatMessage({ id: 'users.password.confirm' })}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const CreateForm: React.FC<PropsWithChildren<CreateFormProps>> = (props) => {
|
|||||||
destroyOnClose
|
destroyOnClose
|
||||||
title="新建"
|
title="新建"
|
||||||
width={420}
|
width={420}
|
||||||
|
centered={true}
|
||||||
open={modalVisible}
|
open={modalVisible}
|
||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
footer={null}
|
footer={null}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ const AddModal: React.FC<AddModalProps> = ({
|
|||||||
<Modal
|
<Modal
|
||||||
title={title}
|
title={title}
|
||||||
open={open}
|
open={open}
|
||||||
|
centered={true}
|
||||||
onOk={handleSumit}
|
onOk={handleSumit}
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export const readStreamData = async (
|
|||||||
callback: (data: any) => void
|
callback: (data: any) => void
|
||||||
) => {
|
) => {
|
||||||
const { done, value } = await reader.read();
|
const { done, value } = await reader.read();
|
||||||
|
console.log('done====', done, value);
|
||||||
if (done) {
|
if (done) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,3 +141,17 @@ export const generateFluctuatingData = ({
|
|||||||
|
|
||||||
return y;
|
return y;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const platformCall = () => {
|
||||||
|
const platform = navigator.userAgent;
|
||||||
|
const isMac = () => {
|
||||||
|
return platform.indexOf('Mac') !== -1;
|
||||||
|
};
|
||||||
|
const isWin = () => {
|
||||||
|
return platform.indexOf('Win') !== -1;
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
isMac: isMac(),
|
||||||
|
isWin: isWin()
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user