('');
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.')}>
-
-
-
-
-
-
+
+ Please make sure to copy your API key now. You will not be able to see it again.
+
+
)}
{modal === 'delete' && (
diff --git a/config-ui/src/routes/api-keys/styled.ts b/config-ui/src/routes/api-keys/styled.ts
index 3838e3d1925..9a4aa557a0e 100644
--- a/config-ui/src/routes/api-keys/styled.ts
+++ b/config-ui/src/routes/api-keys/styled.ts
@@ -26,13 +26,3 @@ export const InputContainer = styled.div`
margin-right: 4px;
}
`;
-
-export const KeyContainer = styled.div`
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-top: 24px;
- margin-bottom: 16px;
- padding: 10px 16px;
- background: #f0f4fe;
-`;
From 687917a55a2732510dd3024ea3c6499b27757bb0 Mon Sep 17 00:00:00 2001
From: mintsweet <0x1304570@gmail.com>
Date: Fri, 20 Oct 2023 15:59:14 +1300
Subject: [PATCH 4/4] fix(config-ui): hidden edit scope config when plugin
doesn't have it
---
.../pages/blueprint/connection-detail/index.tsx | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/config-ui/src/pages/blueprint/connection-detail/index.tsx b/config-ui/src/pages/blueprint/connection-detail/index.tsx
index bae6b58f885..bb13c4b0532 100644
--- a/config-ui/src/pages/blueprint/connection-detail/index.tsx
+++ b/config-ui/src/pages/blueprint/connection-detail/index.tsx
@@ -24,7 +24,7 @@ import { Popover2 } from '@blueprintjs/popover2';
import API from '@/api';
import { PageLoading, PageHeader, ExternalLink, Message, Buttons, Table, Dialog } from '@/components';
import { useRefreshData, useTips } from '@/hooks';
-import { DataScopeSelect, getPluginScopeId } from '@/plugins';
+import { DataScopeSelect, getPluginScopeId, PluginConfig, PluginConfigType } from '@/plugins';
import { operator } from '@/utils';
import { encodeName } from '../../project/utils';
@@ -50,8 +50,11 @@ export const BlueprintConnectionDetailPage = () => {
return API.blueprint.get(bid as any);
};
+ const [plugin, connectionId] = unique.split('-');
+
+ const pluginConfig = PluginConfig.find((p) => p.plugin === plugin) as PluginConfigType;
+
const { ready, data } = useRefreshData(async () => {
- const [plugin, connectionId] = unique.split('-');
const [blueprint, connection] = await Promise.all([
getBlueprint(pname, bid),
API.connection.get(plugin, connectionId),
@@ -205,9 +208,11 @@ export const BlueprintConnectionDetailPage = () => {
-
-
-
+ {pluginConfig.scopeConfig && (
+
+
+
+ )}