From 29d84fe2fc661026cd64669b219164cfa5a3583d Mon Sep 17 00:00:00 2001 From: mintsweet <0x1304570@gmail.com> Date: Fri, 20 Oct 2023 15:43:25 +1300 Subject: [PATCH 1/4] fix(config-ui): missed connections when refreshing connection detail page --- config-ui/src/pages/connection/detail/index.tsx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/config-ui/src/pages/connection/detail/index.tsx b/config-ui/src/pages/connection/detail/index.tsx index 2668392f3c1..2ce5e207ed3 100644 --- a/config-ui/src/pages/connection/detail/index.tsx +++ b/config-ui/src/pages/connection/detail/index.tsx @@ -41,16 +41,6 @@ import { operator } from '@/utils'; import * as S from './styled'; export const ConnectionDetailPage = () => { - const { plugin, id } = useParams() as { plugin: string; id: string }; - return ; -}; - -interface Props { - plugin: string; - connectionId: ID; -} - -const ConnectionDetail = ({ plugin, connectionId }: Props) => { const [type, setType] = useState< | 'deleteConnection' | 'updateConnection' @@ -71,6 +61,9 @@ const ConnectionDetail = ({ plugin, connectionId }: Props) => { const [conflict, setConflict] = useState([]); const [errorMsg, setErrorMsg] = useState(''); + const { plugin, id } = useParams() as { plugin: string; id: string }; + const connectionId = +id; + const connection = useAppSelector((state) => selectConnection(state, `${plugin}-${connectionId}`)) as IConnection; const navigate = useNavigate(); const { setTips } = useTips(); From 766d1043e60df476ff2f143781ba2f44b8d4a925 Mon Sep 17 00:00:00 2001 From: mintsweet <0x1304570@gmail.com> Date: Fri, 20 Oct 2023 15:43:49 +1300 Subject: [PATCH 2/4] fix(config-ui): adjust the spacing for webhook --- config-ui/src/plugins/register/webhook/styled.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config-ui/src/plugins/register/webhook/styled.ts b/config-ui/src/plugins/register/webhook/styled.ts index 2ac46315253..12d83227db0 100644 --- a/config-ui/src/plugins/register/webhook/styled.ts +++ b/config-ui/src/plugins/register/webhook/styled.ts @@ -36,7 +36,7 @@ export const Wrapper = styled.div` } h5 { - margin: 8px 0; + margin: 16px 0 8px; } p { From dbbf628aff744b805e518c3a72a2f9b7be79e8cc Mon Sep 17 00:00:00 2001 From: mintsweet <0x1304570@gmail.com> Date: Fri, 20 Oct 2023 15:58:47 +1300 Subject: [PATCH 3/4] fix(config-ui): adjust some content about api-keys --- config-ui/src/routes/api-keys/api-keys.tsx | 40 ++++++---------------- config-ui/src/routes/api-keys/styled.ts | 10 ------ 2 files changed, 10 insertions(+), 40 deletions(-) diff --git a/config-ui/src/routes/api-keys/api-keys.tsx b/config-ui/src/routes/api-keys/api-keys.tsx index b37a525e064..cfb8419fcc4 100644 --- a/config-ui/src/routes/api-keys/api-keys.tsx +++ b/config-ui/src/routes/api-keys/api-keys.tsx @@ -18,22 +18,9 @@ import { useState, useMemo } from 'react'; import { Button, Intent, InputGroup } from '@blueprintjs/core'; -import { CopyToClipboard } from 'react-copy-to-clipboard'; import API from '@/api'; -import { - PageHeader, - Table, - Dialog, - FormItem, - Selector, - ExternalLink, - TextTooltip, - IconButton, - toast, - Buttons, - Message, -} from '@/components'; +import { PageHeader, Table, Dialog, FormItem, Selector, ExternalLink, CopyText, Message } from '@/components'; import { useRefreshData } from '@/hooks'; import { operator, formatTime } from '@/utils'; @@ -47,7 +34,7 @@ export const ApiKeys = () => { const [operating, setOperating] = useState(false); const [modal, setModal] = useState<'create' | 'show' | 'delete'>(); const [currentId, setCurrentId] = useState(); - const [currentKey, setCurrentKey] = useState(); + const [currentKey, setCurrentKey] = useState(''); const [form, setForm] = useState<{ name: string; expiredAt?: string; @@ -61,6 +48,7 @@ export const ApiKeys = () => { const { data, ready } = useRefreshData(() => API.apiKey.list({ page, pageSize }), [version, page, pageSize]); const [dataSource, total] = useMemo(() => [data?.apikeys ?? [], data?.count ?? 0], [data]); + const hasError = useMemo(() => !form.name || !form.allowedPath, [form]); const timeSelectedItem = useMemo(() => { return C.timeOptions.find((it) => it.value === form.expiredAt || !it.value); @@ -73,7 +61,6 @@ export const ApiKeys = () => { const handleSubmit = async () => { const [success, res] = await operator(() => API.apiKey.create(form), { setOperating, - hideToast: true, }); if (success) { @@ -164,6 +151,7 @@ export const ApiKeys = () => { title="Generate a New API Key" okLoading={operating} okText="Generate" + okDisabled={hasError} onCancel={handleCancel} onOk={handleSubmit} > @@ -191,8 +179,8 @@ export const ApiKeys = () => { subLabel={

Enter a Regular Expression that matches the API URL(s) from the{' '} - DevLake API docs. The default Regular Expression is set to all - APIs. + DevLake API docs. The default Regular + Expression is set to all APIs.

} required @@ -216,18 +204,10 @@ export const ApiKeys = () => { footer={null} onCancel={handleCancel} > -
Please make sure to copy your API key now. You will not be able to see it again.
- - - {currentKey} - - toast.success('Copy successfully.')}> - - - - -