|
|
|
@ -21,7 +21,8 @@ import { useI18n } from 'vue-i18n'
|
|
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
|
import ButtonLink from '@/components/button-link' |
|
|
|
|
import { RowKey } from 'naive-ui/lib/data-table/src/interface' |
|
|
|
|
import { NEllipsis } from 'naive-ui' |
|
|
|
|
|
|
|
|
|
import {NEllipsis, NIcon, NSpin, NTooltip} from 'naive-ui' |
|
|
|
|
import { |
|
|
|
|
queryProcessInstanceListPaging, |
|
|
|
|
deleteProcessInstanceById, |
|
|
|
@ -29,8 +30,11 @@ import {
|
|
|
|
|
} from '@/service/modules/process-instances' |
|
|
|
|
import { execute } from '@/service/modules/executors' |
|
|
|
|
import TableAction from './components/table-action' |
|
|
|
|
import { renderTableTime, runningType } from '@/common/common' |
|
|
|
|
import { renderStateCell } from '../../task/instance/use-table' |
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
renderTableTime, |
|
|
|
|
runningType, workflowExecutionState |
|
|
|
|
} from '@/common/common' |
|
|
|
|
import { |
|
|
|
|
COLUMN_WIDTH_CONFIG, |
|
|
|
|
calculateTableWidth, |
|
|
|
@ -41,6 +45,8 @@ import type { IWorkflowInstance } from '@/service/modules/process-instances/type
|
|
|
|
|
import type { ICountDownParam } from './types' |
|
|
|
|
import type { ExecuteReq } from '@/service/modules/executors/types' |
|
|
|
|
|
|
|
|
|
import { IWorkflowExecutionState } from "@/common/types"; |
|
|
|
|
|
|
|
|
|
export function useTable() { |
|
|
|
|
const { t } = useI18n() |
|
|
|
|
const router: Router = useRouter() |
|
|
|
@ -107,7 +113,7 @@ export function useTable() {
|
|
|
|
|
key: 'state', |
|
|
|
|
...COLUMN_WIDTH_CONFIG['state'], |
|
|
|
|
className: 'workflow-status', |
|
|
|
|
render: (_row: IWorkflowInstance) => renderStateCell(_row.state, t) |
|
|
|
|
render: (_row: IWorkflowInstance) => renderWorkflowStateCell(_row.state, t) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: t('project.workflow.run_type'), |
|
|
|
@ -341,3 +347,29 @@ export function useTable() {
|
|
|
|
|
batchDeleteInstance |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function renderWorkflowStateCell(state: IWorkflowExecutionState, t: Function) { |
|
|
|
|
if (!state) return '' |
|
|
|
|
|
|
|
|
|
const stateOption = workflowExecutionState(t)[state] |
|
|
|
|
|
|
|
|
|
const Icon = h( |
|
|
|
|
NIcon, |
|
|
|
|
{ |
|
|
|
|
color: stateOption.color, |
|
|
|
|
class: stateOption.classNames, |
|
|
|
|
style: { |
|
|
|
|
display: 'flex' |
|
|
|
|
}, |
|
|
|
|
size: 20 |
|
|
|
|
}, |
|
|
|
|
() => h(stateOption.icon) |
|
|
|
|
) |
|
|
|
|
return h(NTooltip, null, { |
|
|
|
|
trigger: () => { |
|
|
|
|
if (!stateOption.isSpin) return Icon |
|
|
|
|
return h(NSpin, { size: 20 }, { icon: () => Icon }) |
|
|
|
|
}, |
|
|
|
|
default: () => stateOption.desc |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|