fix: plugin input type options & save button (#2590)

This commit is contained in:
heheer
2024-09-02 13:06:48 +08:00
committed by GitHub
parent fdab383b26
commit 84de95d294
4 changed files with 13 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
import React, { useCallback, useMemo, useState } from 'react'; import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { import {
Box, Box,
Flex, Flex,
@@ -41,7 +41,6 @@ const Header = () => {
const { appDetail, onSaveApp, currentTab } = useContextSelector(AppContext, (v) => v); const { appDetail, onSaveApp, currentTab } = useContextSelector(AppContext, (v) => v);
const isV2Workflow = appDetail?.version === 'v2'; const isV2Workflow = appDetail?.version === 'v2';
const { const {
isOpen: isOpenBackConfirm, isOpen: isOpenBackConfirm,
onOpen: onOpenBackConfirm, onOpen: onOpenBackConfirm,
@@ -52,7 +51,6 @@ const Header = () => {
onOpen: onSaveAndPublishModalOpen, onOpen: onSaveAndPublishModalOpen,
onClose: onSaveAndPublishModalClose onClose: onSaveAndPublishModalClose
} = useDisclosure(); } = useDisclosure();
const [isSave, setIsSave] = useState(false); const [isSave, setIsSave] = useState(false);
const { const {
@@ -251,6 +249,8 @@ const Header = () => {
status: 'success', status: 'success',
title: t('app:saved_success') title: t('app:saved_success')
}); });
onClose();
setIsSave(false);
}} }}
> >
<MyIcon name={'core/workflow/upload'} w={'16px'} mr={2} /> <MyIcon name={'core/workflow/upload'} w={'16px'} mr={2} />
@@ -268,6 +268,7 @@ const Header = () => {
onSaveAndPublishModalOpen(); onSaveAndPublishModalOpen();
} }
onClose(); onClose();
setIsSave(false);
}} }}
> >
<MyIcon name={'core/workflow/publish'} w={'16px'} mr={2} /> <MyIcon name={'core/workflow/publish'} w={'16px'} mr={2} />
@@ -314,6 +315,10 @@ const Header = () => {
await onClickSave({}); await onClickSave({});
onCloseBackConfirm(); onCloseBackConfirm();
onBack(); onBack();
toast({
status: 'success',
title: t('app:saved_success')
});
}} }}
> >
{t('common:common.Save_and_exit')} {t('common:common.Save_and_exit')}

View File

@@ -249,6 +249,8 @@ const Header = () => {
status: 'success', status: 'success',
title: t('app:saved_success') title: t('app:saved_success')
}); });
onClose();
setIsSave(false);
}} }}
> >
<MyIcon name={'core/workflow/upload'} w={'16px'} mr={2} /> <MyIcon name={'core/workflow/upload'} w={'16px'} mr={2} />
@@ -266,6 +268,7 @@ const Header = () => {
onSaveAndPublishModalOpen(); onSaveAndPublishModalOpen();
} }
onClose(); onClose();
setIsSave(false);
}} }}
> >
<MyIcon name={'core/workflow/publish'} w={'16px'} mr={2} /> <MyIcon name={'core/workflow/publish'} w={'16px'} mr={2} />

View File

@@ -1,4 +1,5 @@
import { Box, Button, Input, ModalBody, ModalFooter } from '@chakra-ui/react'; import { Box, Button, Input, ModalBody, ModalFooter } from '@chakra-ui/react';
import { formatTime2YMDHMS } from '@fastgpt/global/common/string/time';
import MyModal from '@fastgpt/web/components/common/MyModal'; import MyModal from '@fastgpt/web/components/common/MyModal';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
@@ -21,7 +22,7 @@ const SaveAndPublishModal = ({
const { toast } = useToast(); const { toast } = useToast();
const { register, handleSubmit } = useForm<FormType>({ const { register, handleSubmit } = useForm<FormType>({
defaultValues: { defaultValues: {
versionName: '', versionName: formatTime2YMDHMS(new Date()),
isPublish: undefined isPublish: undefined
} }
}); });

View File

@@ -107,12 +107,6 @@ const FieldEditModal = ({
} }
], ],
[ [
{
icon: 'core/workflow/inputType/selectApp',
label: t('common:core.workflow.inputType.selectApp'),
value: FlowNodeInputTypeEnum.selectApp,
defaultValueType: WorkflowIOValueTypeEnum.selectApp
},
{ {
icon: 'core/workflow/inputType/selectLLM', icon: 'core/workflow/inputType/selectLLM',
label: t('common:core.workflow.inputType.selectLLMModel'), label: t('common:core.workflow.inputType.selectLLMModel'),