bzp2010 commented on a change in pull request #172: feature: improve project structure and fix some problem URL: https://github.com/apache/incubator-apisix-dashboard/pull/172#discussion_r407039149
########## File path: src/pages/SSLModule/detail/index.tsx ########## @@ -1,56 +1,75 @@ -import React, { useState, useEffect } from 'react'; -import { PageHeaderWrapper } from '@ant-design/pro-layout'; -import { useParams } from 'dva'; -import { Form, Input, Card, Button, notification } from 'antd'; -import { formatMessage } from 'umi-plugin-react/locale'; +import React, {useState, useEffect} from 'react'; +import {PageHeaderWrapper} from '@ant-design/pro-layout'; +import {useParams} from 'dva'; +import {Form, Input, Card, Button, notification, message} from 'antd'; +import {formatMessage} from 'umi-plugin-react/locale'; -import { getPageMode } from '@/utils/utils'; +import {getPageMode} from '@/utils/utils'; import { fetchItem as fetchSSLItem, create as createSSL, update as updateSSL, } from '@/services/ssl'; -import { useForm } from 'antd/es/form/util'; +import {useForm} from 'antd/es/form/util'; +import {router} from 'umi'; const layout = { - wrapperCol: { span: 8 }, + labelCol: { + span: 2, + }, + wrapperCol: { + span: 8, + }, +}; + +const tailLayout = { + wrapperCol: { + offset: 2, + }, }; const Detail: React.FC = () => { const [mode] = useState<PageMode>(getPageMode()); - const { key } = useParams(); + const {key} = useParams(); const [form] = useForm(); useEffect(() => { + let hideLoading = message.loading(formatMessage({id: 'component.global.loading'}), 0); if (mode === 'EDIT' && key) { fetchSSLItem(key).then(data => { form.setFieldsValue(data.value); + hideLoading(); }); + } else { + hideLoading(); } }, [mode]); const onFinish = (values: any) => { + let hideLoading = message.loading(formatMessage({id: 'component.global.loading'}), 0); Review comment: function `message.loading` return a new function to remove this message, it is associated with the previously `message.loading` function > the second param `0`, name is `duration` , it is mean disable automatic remove message ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services