diff --git a/web/public/locales/en/translation.json b/web/public/locales/en/translation.json index 1443d8dd43..8890152ab0 100644 --- a/web/public/locales/en/translation.json +++ b/web/public/locales/en/translation.json @@ -93,7 +93,7 @@ "FunctionNameTip": "The unique identifier of the function, such as get-user", "InterfaceDebug": "Interface Debugging", "Methods": "Request Method", - "Name": "Parameter Name", + "Name": "KEY", "Tags": "Tags", "SearchPlaceholder": "Please enter the function name query", "Select": "chosen", @@ -202,5 +202,6 @@ "Refresh": "Refresh", "RefreshData": "Refresh", "EditTip": "modified, unpublished", - "NoInfo": "No information" -} + "NoInfo": "No information", + "RefreshDataSuccess": "data refreshed" +} \ No newline at end of file diff --git a/web/public/locales/zh-CN/translation.json b/web/public/locales/zh-CN/translation.json index 0b60c8a8e5..122d7d70ff 100644 --- a/web/public/locales/zh-CN/translation.json +++ b/web/public/locales/zh-CN/translation.json @@ -202,5 +202,6 @@ "EditTip": "已修改,未发布", "Refresh": "刷新", "RefreshData": "刷新数据", - "NoInfo": "暂无信息" -} + "NoInfo": "暂无信息", + "RefreshDataSuccess": "数据刷新成功" +} \ No newline at end of file diff --git a/web/public/locales/zh/translation.json b/web/public/locales/zh/translation.json index e03d091a65..5270907ee4 100644 --- a/web/public/locales/zh/translation.json +++ b/web/public/locales/zh/translation.json @@ -202,5 +202,6 @@ "Refresh": "刷新", "RefreshData": "刷新数据", "EditTip": "已修改,未发布", - "NoInfo": "暂无信息" -} + "NoInfo": "暂无信息", + "RefreshDataSuccess": "数据刷新成功" +} \ No newline at end of file diff --git a/web/src/chakraTheme.ts b/web/src/chakraTheme.ts index 6a3ff52eaf..11278cbee4 100644 --- a/web/src/chakraTheme.ts +++ b/web/src/chakraTheme.ts @@ -91,6 +91,11 @@ const Button = defineStyleConfig({ _hover: { bg: "primary.700", }, + _disabled: { + _hover: { + bg: "primary.500 !important", + }, + }, }, secondary: { diff --git a/web/src/components/Editor/FunctionEditor.tsx b/web/src/components/Editor/FunctionEditor.tsx index 5f6aa632a8..162992509f 100644 --- a/web/src/components/Editor/FunctionEditor.tsx +++ b/web/src/components/Editor/FunctionEditor.tsx @@ -57,23 +57,6 @@ function FunctionEditor(props: { const subscriptionRef = useRef(undefined); const monacoEl = useRef(null); - // onChange - useEffect(() => { - subscriptionRef.current?.dispose(); - if (onChange) { - subscriptionRef.current = editorRef.current?.onDidChangeModelContent((event) => { - onChange(editorRef.current?.getValue()); - parseImports(editorRef.current?.getValue() || ""); - }); - } - }, [onChange]); - - useEffect(() => { - if (monacoEl && editorRef.current) { - updateModel(path, value, editorRef); - } - }, [path, value]); - useEffect(() => { if (monacoEl && !editorRef.current) { editorRef.current = monaco.editor.create(monacoEl.current!, { @@ -102,6 +85,23 @@ function FunctionEditor(props: { return () => {}; }, [path, value]); + useEffect(() => { + if (monacoEl && editorRef.current) { + updateModel(path, value, editorRef); + } + }, [path, value]); + + // onChange + useEffect(() => { + subscriptionRef.current?.dispose(); + if (onChange) { + subscriptionRef.current = editorRef.current?.onDidChangeModelContent((event) => { + onChange(editorRef.current?.getValue()); + parseImports(editorRef.current?.getValue() || ""); + }); + } + }, [onChange]); + return
; } diff --git a/web/src/components/MoreButton/index.tsx b/web/src/components/MoreButton/index.tsx index 54ac4f471d..6a3a2687dc 100644 --- a/web/src/components/MoreButton/index.tsx +++ b/web/src/components/MoreButton/index.tsx @@ -1,9 +1,14 @@ -import { Popover, PopoverContent, PopoverTrigger, useDisclosure } from "@chakra-ui/react"; +import { + Box, + Popover, + PopoverContent, + PopoverTrigger, + Tooltip, + useDisclosure, +} from "@chakra-ui/react"; import clsx from "clsx"; -import { t } from "i18next"; import { MoreIcon } from "@/components/CommonIcon/index"; -import IconWrap from "@/components/IconWrap"; export default function MoreButton(props: { children: React.ReactElement; @@ -21,21 +26,15 @@ export default function MoreButton(props: { closeOnBlur={true} placement="bottom" > - - - { - event?.stopPropagation(); - }} - /> - - + + + +
+ +
+
+
+
{children}
diff --git a/web/src/pages/app/database/CollectionDataList/index.tsx b/web/src/pages/app/database/CollectionDataList/index.tsx index 2a40a6a4f7..229d2bcd6f 100644 --- a/web/src/pages/app/database/CollectionDataList/index.tsx +++ b/web/src/pages/app/database/CollectionDataList/index.tsx @@ -1,31 +1,5 @@ -import { useTranslation } from "react-i18next"; - -import EmptyBox from "@/components/EmptyBox"; - -import CreateCollectionModal from "../mods/CreateCollectionModal"; -import useDBMStore from "../store"; - import DataPanel from "./mods/DataPanel"; export default function CollectionDataList() { - const { t } = useTranslation(); - const store = useDBMStore((state) => state); - return ( - <> - {store.currentDB === undefined ? ( - -
- {t("CollectionPanel.EmptyCollectionText")} - - - {t("CreateNow")} - - -
-
- ) : ( - - )} - - ); + return ; } diff --git a/web/src/pages/app/database/CollectionDataList/mods/DataPanel/index.tsx b/web/src/pages/app/database/CollectionDataList/mods/DataPanel/index.tsx index d866e8c6d0..94acb2e32c 100644 --- a/web/src/pages/app/database/CollectionDataList/mods/DataPanel/index.tsx +++ b/web/src/pages/app/database/CollectionDataList/mods/DataPanel/index.tsx @@ -2,15 +2,7 @@ import { useEffect, useMemo, useState } from "react"; import { BiRefresh } from "react-icons/bi"; import SyntaxHighlighter from "react-syntax-highlighter"; import { AddIcon, CopyIcon, Search2Icon } from "@chakra-ui/icons"; -import { - Button, - Center, - HStack, - Input, - InputGroup, - InputLeftElement, - Spinner, -} from "@chakra-ui/react"; +import { Button, HStack, Input, InputGroup, InputLeftElement } from "@chakra-ui/react"; import { t } from "i18next"; import { throttle } from "lodash"; @@ -121,8 +113,9 @@ export default function DataPanel() { }; }); entryDataQuery.refetch(); + globalStore.showSuccess(t("RefreshDataSuccess")); }, 1000), - [setQueryData, entryDataQuery], + [setQueryData, entryDataQuery, globalStore], ); const handleData = async () => { @@ -174,6 +167,7 @@ export default function DataPanel() { colorScheme="primary" className="mr-2" style={{ width: "114px" }} + isLoading={entryDataQuery.isFetching} leftIcon={} onClick={() => refresh(search)} > @@ -222,74 +216,7 @@ export default function DataPanel() { />
- {entryDataQuery.isFetching ? ( -
- -
- ) : entryDataQuery?.data?.list?.length ? ( - <> - currentData.data?._id === item._id} - onClick={(data: any) => { - setCurrentData({ - data: data, - record: JSON.stringify(data), - }); - }} - deleteRuleMutation={deleteDataMutation} - component={(item: any) => { - return ( - - {JSON.stringify(item, null, 2)} - - ); - }} - toolComponent={(item: any) => { - const newData = { ...item }; - delete newData._id; - return ( - - - - - - ); - }} - /> - -
- { - setCurrentData((pre: any) => { - return { - ...pre, - record: values!, - }; - }); - }} - /> -
-
- - ) : ( + {entryDataQuery.status !== "loading" && entryDataQuery?.data?.list?.length! === 0 && (
{t("CollectionPanel.EmptyDataText")} @@ -301,6 +228,69 @@ export default function DataPanel() {
)} + + <> + currentData.data?._id === item._id} + onClick={(data: any) => { + setCurrentData({ + data: data, + record: JSON.stringify(data), + }); + }} + deleteRuleMutation={deleteDataMutation} + component={(item: any) => { + return ( + + {JSON.stringify(item, null, 2)} + + ); + }} + toolComponent={(item: any) => { + const newData = { ...item }; + delete newData._id; + return ( + + + + + + ); + }} + /> + +
+ { + setCurrentData((pre: any) => { + return { + ...pre, + record: values!, + }; + }); + }} + /> +
+
+
); diff --git a/web/src/pages/app/functions/mods/DebugPanel/HeaderParamsTab/index.tsx b/web/src/pages/app/functions/mods/DebugPanel/HeaderParamsTab/index.tsx index d7c9316ade..d7df03e0c9 100644 --- a/web/src/pages/app/functions/mods/DebugPanel/HeaderParamsTab/index.tsx +++ b/web/src/pages/app/functions/mods/DebugPanel/HeaderParamsTab/index.tsx @@ -15,7 +15,7 @@ type FormValues = { function HeaderParamsTab(props: { onChange(values: Params[]): void }) { const { onChange } = props; - const { register, control, handleSubmit, watch } = useForm({ + const { register, control, watch } = useForm({ defaultValues: { params: [{ name: "", value: "" }], }, @@ -25,7 +25,6 @@ function HeaderParamsTab(props: { onChange(values: Params[]): void }) { name: "params", control, }); - const onSubmit = (data: FormValues) => console.log(data); useEffect(() => { const subscription = watch((value) => { @@ -37,7 +36,7 @@ function HeaderParamsTab(props: { onChange(values: Params[]): void }) { return (
-
+ diff --git a/web/src/pages/app/functions/mods/DebugPanel/QueryParamsTab/index.tsx b/web/src/pages/app/functions/mods/DebugPanel/QueryParamsTab/index.tsx index 2d4786f8c5..5a4b79ff9f 100644 --- a/web/src/pages/app/functions/mods/DebugPanel/QueryParamsTab/index.tsx +++ b/web/src/pages/app/functions/mods/DebugPanel/QueryParamsTab/index.tsx @@ -15,7 +15,7 @@ type FormValues = { function HeaderParamsTab(props: { onChange(values: Params[]): void }) { const { onChange } = props; - const { register, control, handleSubmit, watch } = useForm({ + const { register, control, watch } = useForm({ defaultValues: { params: [{ name: "", value: "" }], }, @@ -25,7 +25,6 @@ function HeaderParamsTab(props: { onChange(values: Params[]): void }) { name: "params", control, }); - const onSubmit = (data: FormValues) => console.log(data); useEffect(() => { const subscription = watch((value) => { @@ -37,7 +36,7 @@ function HeaderParamsTab(props: { onChange(values: Params[]): void }) { return (
- +
diff --git a/web/src/pages/app/functions/mods/DeployButton/index.tsx b/web/src/pages/app/functions/mods/DeployButton/index.tsx index c9456ea3a0..0a004b3f8f 100644 --- a/web/src/pages/app/functions/mods/DeployButton/index.tsx +++ b/web/src/pages/app/functions/mods/DeployButton/index.tsx @@ -95,6 +95,7 @@ export default function DeployButton() { - diff --git a/web/src/pages/app/functions/service.ts b/web/src/pages/app/functions/service.ts index e59464a1ff..03bec4cd7a 100644 --- a/web/src/pages/app/functions/service.ts +++ b/web/src/pages/app/functions/service.ts @@ -16,14 +16,14 @@ const queryKeys = { useFunctionListQuery: ["useFunctionListQuery"], }; -export const useFunctionListQuery = ({ onSuccess }: { onSuccess: (data: any) => void }) => { +export const useFunctionListQuery = (config?: { onSuccess?: (data: any) => void }) => { return useQuery( queryKeys.useFunctionListQuery, () => { return FunctionControllerFindAll({}); }, { - onSuccess, + onSuccess: config?.onSuccess, }, ); }; diff --git a/web/src/pages/app/logs/index.tsx b/web/src/pages/app/logs/index.tsx index b44ea901a7..b9243a6f98 100644 --- a/web/src/pages/app/logs/index.tsx +++ b/web/src/pages/app/logs/index.tsx @@ -64,9 +64,6 @@ export default function LogsPage() { }, { keepPreviousData: true, - onSuccess(data: any) { - console.log(data); - }, }, ); diff --git a/web/src/pages/app/setting/AppEnvList/EditTextarea/index.tsx b/web/src/pages/app/setting/AppEnvList/EditTextarea/index.tsx index 08d4047578..f530e3dacd 100644 --- a/web/src/pages/app/setting/AppEnvList/EditTextarea/index.tsx +++ b/web/src/pages/app/setting/AppEnvList/EditTextarea/index.tsx @@ -11,7 +11,6 @@ const EditTextarea = function (props: { const { text, value, onBlur, onChange, disabled } = props; return (