Merge remote-tracking branch 'myori/main' into feat/collaboration2

This commit is contained in:
hjlarry
2026-01-17 10:22:41 +08:00
6266 changed files with 544217 additions and 224655 deletions

View File

@ -1,8 +1,20 @@
import { RiHistoryLine } from '@remixicon/react'
import {
useCallback,
} from 'react'
import { RiHistoryLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { useStore as useAppStore } from '@/app/components/app/store'
import Button from '@/app/components/base/button'
import useTheme from '@/hooks/use-theme'
import { useInvalidAllLastRun } from '@/service/use-workflow'
import { cn } from '@/utils/classnames'
import Toast from '../../base/toast'
import { collaborationManager } from '../collaboration/core/collaboration-manager'
import {
useNodesSyncDraft,
useWorkflowRun,
} from '../hooks'
import { useHooksStore } from '../hooks-store'
import {
useStore,
useWorkflowStore,
@ -10,19 +22,7 @@ import {
import {
WorkflowVersion,
} from '../types'
import {
useNodesSyncDraft,
useWorkflowRun,
} from '../hooks'
import Toast from '../../base/toast'
import RestoringTitle from './restoring-title'
import Button from '@/app/components/base/button'
import { useInvalidAllLastRun } from '@/service/use-workflow'
import { useHooksStore } from '../hooks-store'
import { useStore as useAppStore } from '@/app/components/app/store'
import useTheme from '@/hooks/use-theme'
import cn from '@/utils/classnames'
import { collaborationManager } from '../collaboration/core/collaboration-manager'
export type HeaderInRestoringProps = {
onRestoreSettled?: () => void
@ -61,7 +61,7 @@ const HeaderInRestoring = ({
onSuccess: () => {
Toast.notify({
type: 'success',
message: t('workflow.versionHistory.action.restoreSuccess'),
message: t('versionHistory.action.restoreSuccess', { ns: 'workflow' }),
})
// Notify other collaboration clients about the workflow restore
if (appDetail)
@ -70,7 +70,7 @@ const HeaderInRestoring = ({
onError: () => {
Toast.notify({
type: 'error',
message: t('workflow.versionHistory.action.restoreFailure'),
message: t('versionHistory.action.restoreFailure', { ns: 'workflow' }),
})
},
onSettled: () => {
@ -86,27 +86,28 @@ const HeaderInRestoring = ({
<div>
<RestoringTitle />
</div>
<div className=' flex items-center justify-end gap-x-2'>
<div className=" flex items-center justify-end gap-x-2">
<Button
onClick={handleRestore}
disabled={!currentVersion || currentVersion.version === WorkflowVersion.Draft}
variant='primary'
variant="primary"
className={cn(
theme === 'dark' && 'rounded-lg border border-black/5 bg-white/10 backdrop-blur-sm',
'rounded-lg border border-transparent',
theme === 'dark' && 'border-black/5 bg-white/10 backdrop-blur-sm',
)}
>
{t('workflow.common.restore')}
{t('common.restore', { ns: 'workflow' })}
</Button>
<Button
onClick={handleCancelRestore}
className={cn(
'text-components-button-secondary-accent-text',
theme === 'dark' && 'rounded-lg border border-black/5 bg-white/10 backdrop-blur-sm',
'rounded-lg border border-transparent text-components-button-secondary-accent-text',
theme === 'dark' && 'border-black/5 bg-white/10 backdrop-blur-sm',
)}
>
<div className='flex items-center gap-x-0.5'>
<RiHistoryLine className='h-4 w-4' />
<span className='px-0.5'>{t('workflow.common.exitVersions')}</span>
<div className="flex items-center gap-x-0.5">
<RiHistoryLine className="h-4 w-4" />
<span className="px-0.5">{t('common.exitVersions', { ns: 'workflow' })}</span>
</div>
</Button>
</div>