feat(web): workflow publish add check list validate
This commit is contained in:
@@ -16,9 +16,9 @@ import { getReleaseList, rollbackRelease, appExport } from '@/api/application'
|
||||
import ReleaseModal from './components/ReleaseModal'
|
||||
import ReleaseShareModal from './components/ReleaseShareModal'
|
||||
import AppSharingModal from './components/AppSharingModal'
|
||||
import type { Release, ReleaseModalRef, ReleaseShareModalRef, AppSharingModalRef, WorkflowRef } from './types'
|
||||
import type { Release, ReleaseModalRef, ReleaseShareModalRef, AppSharingModalRef } from './types'
|
||||
import type { Application } from '@/views/ApplicationManagement/types'
|
||||
import { runCheckOnGraph } from '@/views/Workflow/components/CheckList'
|
||||
import { useWorkflowStore } from '@/store/workflow'
|
||||
import Empty from '@/components/Empty'
|
||||
import { formatDateTime } from '@/utils/format';
|
||||
import Markdown from '@/components/Markdown'
|
||||
@@ -39,9 +39,10 @@ const heightClass = 'rb:max-h-[calc(100vh-140px)]'
|
||||
* @param data - Application data
|
||||
* @param refresh - Function to refresh application data
|
||||
*/
|
||||
const ReleasePage: FC<{data: Application; refresh: () => void; workflowRef?: React.RefObject<WorkflowRef>}> = ({data, refresh, workflowRef}) => {
|
||||
const ReleasePage: FC<{data: Application; refresh: () => void}> = ({data, refresh}) => {
|
||||
const { t } = useTranslation();
|
||||
const { message } = App.useApp()
|
||||
const { getCheckResults } = useWorkflowStore()
|
||||
const releaseModalRef = useRef<ReleaseModalRef>(null)
|
||||
const releaseShareModalRef = useRef<ReleaseShareModalRef>(null)
|
||||
const appSharingModalRef = useRef<AppSharingModalRef>(null)
|
||||
@@ -148,13 +149,10 @@ const ReleasePage: FC<{data: Application; refresh: () => void; workflowRef?: Rea
|
||||
</>}
|
||||
<RbButton type="primary" onClick={async () => {
|
||||
if (data?.type === 'workflow') {
|
||||
const graph = workflowRef?.current?.graphRef?.current
|
||||
if (graph) {
|
||||
const errors = await runCheckOnGraph(graph, t)
|
||||
if (errors.length) {
|
||||
message.error(t('workflow.checkListHasErrors'))
|
||||
return
|
||||
}
|
||||
const errors = getCheckResults(data.id)
|
||||
if (errors.length) {
|
||||
message.error(t('workflow.checkListHasErrors'))
|
||||
return
|
||||
}
|
||||
}
|
||||
releaseModalRef.current?.handleOpen()
|
||||
|
||||
@@ -207,7 +207,7 @@ const ConfigHeader: FC<ConfigHeaderProps> = ({
|
||||
</Flex>}
|
||||
extra={application?.type === 'workflow' && source !== 'sharing' && activeTab === 'arrangement'
|
||||
? <Flex align="center" justify="end" gap={10} className="rb:h-8">
|
||||
<CheckList workflowRef={workflowRef} />
|
||||
<CheckList workflowRef={workflowRef} appId={application?.id ?? ''} />
|
||||
<Popover content={t('application.features')} classNames={{ body: 'rb:py-0.5! rb:px-1! rb:rounded-[6px]! rb:text-[12px]!' }}>
|
||||
<div
|
||||
className="rb:cursor-pointer rb:size-7.5 rb:border rb:border-[#EBEBEB] rb:hover:bg-[#F6F6F6] rb:rounded-[10px] rb:bg-[url('@/assets/images/workflow/features.svg')] rb:bg-size-[16px_16px] rb:bg-center rb:bg-no-repeat"
|
||||
|
||||
Reference in New Issue
Block a user