mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-26 04:32:50 +00:00
feat: fe
This commit is contained in:
parent
2ec2d2b1ce
commit
1e522ed334
|
|
@ -45,5 +45,6 @@
|
|||
"dingtalk.title": "Publish to DingTalk Bot",
|
||||
"dingtalk.api": "DingTalk API",
|
||||
"use_default_domain": "Use Default Domain",
|
||||
"ip_whitelist": "IP Whitelist"
|
||||
"ip_whitelist": "IP Whitelist",
|
||||
"custom_domain_management": "Custom Domain Management"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,5 +45,6 @@
|
|||
"dingtalk.title": "发布到钉钉机器人",
|
||||
"dingtalk.api": "钉钉 API",
|
||||
"use_default_domain": "使用默认域名",
|
||||
"ip_whitelist": "IP 白名单"
|
||||
"ip_whitelist": "IP 白名单",
|
||||
"custom_domain_management": "自定义域名管理"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,5 +45,6 @@
|
|||
"dingtalk.title": "發布至釘釘聊天機器人",
|
||||
"dingtalk.api": "釘釘 API",
|
||||
"use_default_domain": "使用預設域名",
|
||||
"ip_whitelist": "IP 白名單"
|
||||
"ip_whitelist": "IP 白名單",
|
||||
"custom_domain_management": "自訂域名管理"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,15 +50,6 @@ const AccountContainer = ({
|
|||
label: t('account:personal_information'),
|
||||
value: TabEnum.info
|
||||
},
|
||||
...(feConfigs.isPlus && feConfigs.customDomain?.enable
|
||||
? [
|
||||
{
|
||||
icon: 'common/globalLine',
|
||||
label: t('account:custom_domain'),
|
||||
value: TabEnum.customDomain
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...(feConfigs?.isPlus
|
||||
? [
|
||||
{
|
||||
|
|
@ -87,6 +78,15 @@ const AccountContainer = ({
|
|||
label: t('account:third_party'),
|
||||
value: TabEnum.thirdParty
|
||||
},
|
||||
...(feConfigs.isPlus && feConfigs.customDomain?.enable
|
||||
? [
|
||||
{
|
||||
icon: 'common/globalLine',
|
||||
label: t('account:custom_domain'),
|
||||
value: TabEnum.customDomain
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
icon: 'common/model',
|
||||
label: t('account:model_provider'),
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ function CreateCustomDomainModal<T extends 'create' | 'refresh'>({
|
|||
isDisabled={!editDomain || type === 'refresh'}
|
||||
/>
|
||||
<InputRightElement width="auto" paddingRight={'8px'}>
|
||||
{!editDomain && domain ? (
|
||||
{!editDomain && domain && startDnsResolve ? (
|
||||
DnsResolved ? (
|
||||
<Tag colorScheme="green" size="sm">
|
||||
{t('account:custom_domain.dns_resolved')}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ const WecomEditModal = ({
|
|||
appId: string;
|
||||
defaultData: OutLinkEditType<WecomAppType>;
|
||||
onClose: () => void;
|
||||
onCreate: (id: string) => void;
|
||||
onCreate: (shareId: string) => Promise<string | undefined>;
|
||||
onEdit: () => void;
|
||||
isEdit?: boolean;
|
||||
}) => {
|
||||
|
|
@ -54,7 +54,12 @@ const WecomEditModal = ({
|
|||
{
|
||||
errorToast: t('common:create_failed'),
|
||||
successToast: t('common:create_success'),
|
||||
onSuccess: onCreate
|
||||
onSuccess: async (shareId) => {
|
||||
const _id = await onCreate(shareId);
|
||||
if (_id) {
|
||||
setValue('_id', _id);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -70,6 +75,10 @@ const WecomEditModal = ({
|
|||
|
||||
const shareId = useMemo(() => createShareId || updatedShareId, [createShareId, updatedShareId]);
|
||||
|
||||
// 判断是否已经创建成功(有 createShareId 说明已经创建)
|
||||
const isCreated = useMemo(() => !!createShareId, [createShareId]);
|
||||
const isEditMode = useMemo(() => isEdit || isCreated, [isEdit, isCreated]);
|
||||
|
||||
const { feConfigs } = useSystemStore();
|
||||
const { MyStep, activeStep, goToNext, goToPrevious } = useMyStep({
|
||||
steps: [
|
||||
|
|
@ -90,7 +99,9 @@ const WecomEditModal = ({
|
|||
return (
|
||||
<MyModal
|
||||
iconSrc="core/app/publish/wecom"
|
||||
title={isEdit ? t('publish:wecom.edit_modal_title') : t('publish:wecom.create_modal_title')}
|
||||
title={
|
||||
isEditMode ? t('publish:wecom.edit_modal_title') : t('publish:wecom.create_modal_title')
|
||||
}
|
||||
minW={['auto', '60rem']}
|
||||
onClose={onClose}
|
||||
>
|
||||
|
|
@ -102,9 +113,9 @@ const WecomEditModal = ({
|
|||
gridTemplateColumns={'200px 1fr'}
|
||||
rowGap="4"
|
||||
mt="4"
|
||||
pb="4"
|
||||
pb="24px"
|
||||
borderBottom="1px solid"
|
||||
borderColor="myGray.300"
|
||||
borderColor="myGray.200"
|
||||
>
|
||||
<Box color="myGray.900" fontWeight={'500'}>
|
||||
{t('publish:basic_info')}
|
||||
|
|
@ -169,8 +180,8 @@ const WecomEditModal = ({
|
|||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Grid gridTemplateColumns={'200px 1fr'} rowGap="4" mt="4">
|
||||
<Flex>
|
||||
<Grid gridTemplateColumns={'200px 1fr'} rowGap="4" mt="24px">
|
||||
<Flex h="min">
|
||||
<Box color="myGray.900" fontWeight="500">
|
||||
{t('publish:wecom.api')}
|
||||
</Box>
|
||||
|
|
@ -226,7 +237,7 @@ const WecomEditModal = ({
|
|||
)}
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
{activeStep === 0 && (
|
||||
{activeStep === 1 && (
|
||||
<Button
|
||||
variant={'whiteBase'}
|
||||
mr={3}
|
||||
|
|
@ -242,7 +253,7 @@ const WecomEditModal = ({
|
|||
onClick={() => {
|
||||
if (activeStep === 0) {
|
||||
submitShareChat((data) =>
|
||||
(isEdit ? onclickUpdate(data) : onclickCreate(data)).then(() => goToNext())
|
||||
(isEditMode ? onclickUpdate(data) : onclickCreate(data)).then(() => goToNext())
|
||||
)();
|
||||
} else {
|
||||
onClose();
|
||||
|
|
|
|||
|
|
@ -65,25 +65,35 @@ const Wecom = ({ appId }: { appId: string }) => {
|
|||
<Box fontWeight={'bold'} fontSize={['md', 'lg']}>
|
||||
{t('publish:wecom.title')}
|
||||
</Box>
|
||||
<Button
|
||||
variant={'primary'}
|
||||
colorScheme={'blue'}
|
||||
size={['sm', 'md']}
|
||||
leftIcon={<MyIcon name={'common/addLight'} w="1.25rem" color="white" />}
|
||||
ml={3}
|
||||
{...(shareChatList.length >= 10
|
||||
? {
|
||||
isDisabled: true,
|
||||
title: t('common:core.app.share.Amount limit tip')
|
||||
}
|
||||
: {})}
|
||||
onClick={() => {
|
||||
setEditWecomData(defaultOutLinkForm as any); // HACK
|
||||
setIsEdit(false);
|
||||
}}
|
||||
>
|
||||
{t('common:add_new')}
|
||||
</Button>
|
||||
<Flex gap={3}>
|
||||
<Button
|
||||
variant={'whitePrimary'}
|
||||
size={['sm', 'md']}
|
||||
onClick={() => {
|
||||
window.open('/account/customDomain', '_blank');
|
||||
}}
|
||||
>
|
||||
{t('publish:custom_domain_management')}
|
||||
</Button>
|
||||
<Button
|
||||
variant={'primary'}
|
||||
colorScheme={'blue'}
|
||||
size={['sm', 'md']}
|
||||
leftIcon={<MyIcon name={'common/addLight'} w="1.25rem" color="white" />}
|
||||
{...(shareChatList.length >= 10
|
||||
? {
|
||||
isDisabled: true,
|
||||
title: t('common:core.app.share.Amount limit tip')
|
||||
}
|
||||
: {})}
|
||||
onClick={() => {
|
||||
setEditWecomData(defaultOutLinkForm as any); // HACK
|
||||
setIsEdit(false);
|
||||
}}
|
||||
>
|
||||
{t('common:add_new')}
|
||||
</Button>
|
||||
</Flex>
|
||||
</Flex>
|
||||
<TableContainer mt={3}>
|
||||
<Table variant={'simple'} w={'100%'} overflowX={'auto'} fontSize={'sm'}>
|
||||
|
|
@ -200,7 +210,11 @@ const Wecom = ({ appId }: { appId: string }) => {
|
|||
<WecomEditModal
|
||||
appId={appId}
|
||||
defaultData={editWecomData}
|
||||
onCreate={() => refetchShareChatList()}
|
||||
onCreate={async (shareId: string) => {
|
||||
const newList = await refetchShareChatList();
|
||||
const newItem = newList.find((item) => item.shareId === shareId);
|
||||
return newItem?._id;
|
||||
}}
|
||||
onEdit={() => refetchShareChatList()}
|
||||
onClose={() => setEditWecomData(undefined)}
|
||||
isEdit={isEdit}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import { useState, useMemo } from 'react';
|
|||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { StandardSubLevelEnum } from '@fastgpt/global/support/wallet/sub/constants';
|
||||
import { useRouter } from 'next/router';
|
||||
import Tag from '@fastgpt/web/components/common/Tag';
|
||||
|
||||
const CreateCustomDomainModal = dynamic(
|
||||
() => import('@/pageComponents/account/customDomain/createModal')
|
||||
|
|
@ -88,7 +89,11 @@ const CustomDomain = () => {
|
|||
<Flex justifyContent="space-between" alignItems="center" w="100%">
|
||||
<Box fontSize="20px" fontWeight="500">
|
||||
{t('account:custom_domain')}
|
||||
{customDomainList?.length ? `: (${customDomainList.length}/3)` : <></>}
|
||||
{customDomainList?.length ? (
|
||||
`: (${customDomainList.length}/${teamPlanStatus?.standardConstants?.customDomain})`
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<Button
|
||||
|
|
@ -117,9 +122,27 @@ const CustomDomain = () => {
|
|||
<Td>{customDomain.domain}</Td>
|
||||
<Td>{customDomain.cnameDomain}</Td>
|
||||
<Td>{t(providerMap[customDomain.provider])}</Td>
|
||||
<Td>{t(customDomainStatusMap[customDomain.status])}</Td>
|
||||
<Td>
|
||||
{customDomain.status === 'active' ? (
|
||||
<Tag colorSchema="green">
|
||||
{t(customDomainStatusMap[customDomain.status])}
|
||||
</Tag>
|
||||
) : (
|
||||
<Tag colorSchema="red">
|
||||
{t(customDomainStatusMap[customDomain.status])}
|
||||
</Tag>
|
||||
)}
|
||||
</Td>
|
||||
<Td>
|
||||
<Flex gap="2">
|
||||
<Button
|
||||
variant="whiteDanger"
|
||||
onClick={() => {
|
||||
return openConfirm(() => onDelete(customDomain.domain))();
|
||||
}}
|
||||
>
|
||||
{t('common:Delete')}
|
||||
</Button>
|
||||
{customDomain.status === 'inactive' ? (
|
||||
<Button
|
||||
variant="whitePrimary"
|
||||
|
|
@ -142,14 +165,6 @@ const CustomDomain = () => {
|
|||
// {t('account:custom_domain.domain_verify')}
|
||||
// </Button>
|
||||
)}
|
||||
<Button
|
||||
variant="whiteDanger"
|
||||
onClick={() => {
|
||||
return openConfirm(() => onDelete(customDomain.domain))();
|
||||
}}
|
||||
>
|
||||
{t('common:Delete')}
|
||||
</Button>
|
||||
</Flex>
|
||||
</Td>
|
||||
</Tr>
|
||||
|
|
|
|||
Loading…
Reference in New Issue