mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 15:05:54 +08:00
Revert "Feat: update app published time after clicking publish button" (#8320)
This commit is contained in:
parent
d4985fb3aa
commit
aa11659062
@ -63,7 +63,6 @@ const AppPublisher = ({
|
|||||||
const [published, setPublished] = useState(false)
|
const [published, setPublished] = useState(false)
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const appDetail = useAppStore(state => state.appDetail)
|
const appDetail = useAppStore(state => state.appDetail)
|
||||||
const [publishedTime, setPublishedTime] = useState<number | undefined>(publishedAt)
|
|
||||||
const { app_base_url: appBaseURL = '', access_token: accessToken = '' } = appDetail?.site ?? {}
|
const { app_base_url: appBaseURL = '', access_token: accessToken = '' } = appDetail?.site ?? {}
|
||||||
const appMode = (appDetail?.mode !== 'completion' && appDetail?.mode !== 'workflow') ? 'chat' : appDetail.mode
|
const appMode = (appDetail?.mode !== 'completion' && appDetail?.mode !== 'workflow') ? 'chat' : appDetail.mode
|
||||||
const appURL = `${appBaseURL}/${appMode}/${accessToken}`
|
const appURL = `${appBaseURL}/${appMode}/${accessToken}`
|
||||||
@ -77,7 +76,6 @@ const AppPublisher = ({
|
|||||||
try {
|
try {
|
||||||
await onPublish?.(modelAndParameter)
|
await onPublish?.(modelAndParameter)
|
||||||
setPublished(true)
|
setPublished(true)
|
||||||
setPublishedTime(Date.now())
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
setPublished(false)
|
setPublished(false)
|
||||||
@ -133,13 +131,13 @@ const AppPublisher = ({
|
|||||||
<div className='w-[336px] bg-white rounded-2xl border-[0.5px] border-gray-200 shadow-xl'>
|
<div className='w-[336px] bg-white rounded-2xl border-[0.5px] border-gray-200 shadow-xl'>
|
||||||
<div className='p-4 pt-3'>
|
<div className='p-4 pt-3'>
|
||||||
<div className='flex items-center h-6 text-xs font-medium text-gray-500 uppercase'>
|
<div className='flex items-center h-6 text-xs font-medium text-gray-500 uppercase'>
|
||||||
{publishedTime ? t('workflow.common.latestPublished') : t('workflow.common.currentDraftUnpublished')}
|
{publishedAt ? t('workflow.common.latestPublished') : t('workflow.common.currentDraftUnpublished')}
|
||||||
</div>
|
</div>
|
||||||
{publishedTime
|
{publishedAt
|
||||||
? (
|
? (
|
||||||
<div className='flex justify-between items-center h-[18px]'>
|
<div className='flex justify-between items-center h-[18px]'>
|
||||||
<div className='flex items-center mt-[3px] mb-[3px] leading-[18px] text-[13px] font-medium text-gray-700'>
|
<div className='flex items-center mt-[3px] mb-[3px] leading-[18px] text-[13px] font-medium text-gray-700'>
|
||||||
{t('workflow.common.publishedAt')} {formatTimeFromNow(publishedTime)}
|
{t('workflow.common.publishedAt')} {formatTimeFromNow(publishedAt)}
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
className={`
|
className={`
|
||||||
@ -177,18 +175,18 @@ const AppPublisher = ({
|
|||||||
{
|
{
|
||||||
published
|
published
|
||||||
? t('workflow.common.published')
|
? t('workflow.common.published')
|
||||||
: publishedTime ? t('workflow.common.update') : t('workflow.common.publish')
|
: publishedAt ? t('workflow.common.update') : t('workflow.common.publish')
|
||||||
}
|
}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div className='p-4 pt-3 border-t-[0.5px] border-t-black/5'>
|
<div className='p-4 pt-3 border-t-[0.5px] border-t-black/5'>
|
||||||
<SuggestedAction disabled={!publishedTime} link={appURL} icon={<PlayCircle />}>{t('workflow.common.runApp')}</SuggestedAction>
|
<SuggestedAction disabled={!publishedAt} link={appURL} icon={<PlayCircle />}>{t('workflow.common.runApp')}</SuggestedAction>
|
||||||
{appDetail?.mode === 'workflow'
|
{appDetail?.mode === 'workflow'
|
||||||
? (
|
? (
|
||||||
<SuggestedAction
|
<SuggestedAction
|
||||||
disabled={!publishedTime}
|
disabled={!publishedAt}
|
||||||
link={`${appURL}${appURL.includes('?') ? '&' : '?'}mode=batch`}
|
link={`${appURL}${appURL.includes('?') ? '&' : '?'}mode=batch`}
|
||||||
icon={<LeftIndent02 className='w-4 h-4' />}
|
icon={<LeftIndent02 className='w-4 h-4' />}
|
||||||
>
|
>
|
||||||
@ -201,16 +199,16 @@ const AppPublisher = ({
|
|||||||
setEmbeddingModalOpen(true)
|
setEmbeddingModalOpen(true)
|
||||||
handleTrigger()
|
handleTrigger()
|
||||||
}}
|
}}
|
||||||
disabled={!publishedTime}
|
disabled={!publishedAt}
|
||||||
icon={<CodeBrowser className='w-4 h-4' />}
|
icon={<CodeBrowser className='w-4 h-4' />}
|
||||||
>
|
>
|
||||||
{t('workflow.common.embedIntoSite')}
|
{t('workflow.common.embedIntoSite')}
|
||||||
</SuggestedAction>
|
</SuggestedAction>
|
||||||
)}
|
)}
|
||||||
<SuggestedAction disabled={!publishedTime} link='./develop' icon={<FileText className='w-4 h-4' />}>{t('workflow.common.accessAPIReference')}</SuggestedAction>
|
<SuggestedAction disabled={!publishedAt} link='./develop' icon={<FileText className='w-4 h-4' />}>{t('workflow.common.accessAPIReference')}</SuggestedAction>
|
||||||
{appDetail?.mode === 'workflow' && (
|
{appDetail?.mode === 'workflow' && (
|
||||||
<WorkflowToolConfigureButton
|
<WorkflowToolConfigureButton
|
||||||
disabled={!publishedTime}
|
disabled={!publishedAt}
|
||||||
published={!!toolPublished}
|
published={!!toolPublished}
|
||||||
detailNeedUpdate={!!toolPublished && published}
|
detailNeedUpdate={!!toolPublished && published}
|
||||||
workflowAppId={appDetail?.id}
|
workflowAppId={appDetail?.id}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user