Browse Source

[Fix-13248][UI] Ironed out the issue with failing to query task instances by some state of task. (#13251)

3.2.0-release
calvin 2 years ago committed by GitHub
parent
commit
4e09bacb17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 60
      dolphinscheduler-ui/src/common/common.ts
  2. 7
      dolphinscheduler-ui/src/common/types.ts
  3. 4
      dolphinscheduler-ui/src/service/modules/process-instances/types.ts
  4. 6
      dolphinscheduler-ui/src/store/project/types.ts
  5. 2
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts
  6. 34
      dolphinscheduler-ui/src/views/projects/workflow/instance/use-table.ts

60
dolphinscheduler-ui/src/common/common.ts

@ -26,10 +26,8 @@ import {
CheckCircleFilled,
Loading3QuartersOutlined,
PauseCircleFilled,
ClockCircleOutlined,
StopFilled,
StopOutlined,
GlobalOutlined,
IssuesCloseOutlined,
SendOutlined,
HistoryOutlined
@ -210,14 +208,6 @@ export const tasksState = (t: any): ITaskStateConfig => ({
isSpin: true,
classNames: 'running_execution'
},
READY_PAUSE: {
id: 2,
desc: `${t('project.workflow.ready_to_pause')}`,
color: '#07b1a3',
icon: SettingOutlined,
isSpin: false,
classNames: 'ready_pause'
},
PAUSE: {
id: 3,
desc: `${t('project.workflow.pause')}`,
@ -226,22 +216,6 @@ export const tasksState = (t: any): ITaskStateConfig => ({
isSpin: false,
classNames: 'pause'
},
READY_STOP: {
id: 4,
desc: `${t('project.workflow.ready_to_stop')}`,
color: '#FE0402',
icon: StopFilled,
isSpin: false,
classNames: 'ready_stop'
},
STOP: {
id: 5,
desc: `${t('project.workflow.stop')}`,
color: '#e90101',
icon: StopOutlined,
isSpin: false,
classNames: 'stop'
},
FAILURE: {
id: 6,
desc: `${t('project.workflow.failed')}`,
@ -274,22 +248,6 @@ export const tasksState = (t: any): ITaskStateConfig => ({
isSpin: false,
classNames: 'kill'
},
WAITING_THREAD: {
id: 10,
desc: `${t('project.workflow.waiting_for_thread')}`,
color: '#912eed',
icon: ClockCircleOutlined,
isSpin: false,
classNames: 'waiting_thread'
},
WAITING_DEPEND: {
id: 11,
desc: `${t('project.workflow.waiting_for_dependence')}`,
color: '#5101be',
icon: GlobalOutlined,
isSpin: false,
classNames: 'waiting_depend'
},
DELAY_EXECUTION: {
id: 12,
desc: `${t('project.workflow.delay_execution')}`,
@ -306,30 +264,14 @@ export const tasksState = (t: any): ITaskStateConfig => ({
isSpin: false,
classNames: 'forced_success'
},
SERIAL_WAIT: {
id: 14,
desc: `${t('project.workflow.serial_wait')}`,
color: '#5102ce',
icon: Loading3QuartersOutlined,
isSpin: true,
classNames: 'serial_wait'
},
DISPATCH: {
id: 15,
id: 17,
desc: `${t('project.workflow.dispatch')}`,
color: '#5101be',
icon: SendOutlined,
isSpin: false,
classNames: 'dispatch'
},
PENDING: {
id: 18,
desc: `${t('project.workflow.pending')}`,
color: '#5101be',
icon: HistoryOutlined,
isSpin: false,
classNames: 'pending'
}
})
/**

7
dolphinscheduler-ui/src/common/types.ts

@ -19,21 +19,14 @@ import { Component } from 'vue'
export type ITaskState =
| 'SUBMITTED_SUCCESS'
| 'RUNNING_EXECUTION'
| 'READY_PAUSE'
| 'PAUSE'
| 'READY_STOP'
| 'STOP'
| 'FAILURE'
| 'SUCCESS'
| 'NEED_FAULT_TOLERANCE'
| 'KILL'
| 'WAITING_THREAD'
| 'WAITING_DEPEND'
| 'DELAY_EXECUTION'
| 'FORCED_SUCCESS'
| 'SERIAL_WAIT'
| 'DISPATCH'
| 'PENDING'
export type IWorkflowExecutionState =
| 'SUBMITTED_SUCCESS'

4
dolphinscheduler-ui/src/service/modules/process-instances/types.ts

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { ITaskState } from '@/common/types'
import type { IWorkflowExecutionState } from '@/common/types'
interface CodeReq {
projectCode: number
@ -86,7 +86,7 @@ interface ProcessInstanceReq {
interface IWorkflowInstance {
id: number
name: string
state: ITaskState
state: IWorkflowExecutionState
commandType: string
scheduleTime?: string
processDefinitionCode?: number

6
dolphinscheduler-ui/src/store/project/types.ts

@ -58,11 +58,13 @@ type TaskType =
| 'LINKIS'
type ProgramType = 'JAVA' | 'SCALA' | 'PYTHON'
type DependentResultType = {
[key: string]: 'SUCCESS' | 'WAITING_THREAD' | 'FAILURE'
[key: string]: 'SUCCESS' | 'FAILURE'
}
type BDependentResultType = {
[key: string]: 'SUCCESS' | 'WAITING_THREAD' | 'FAILED'
[key: string]: 'SUCCESS' | 'FAILED'
}
interface IResource {

2
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts

@ -226,7 +226,7 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
if (!item || router.currentRoute.value.name !== 'workflow-instance-detail')
return null
const key = `${item.definitionCode}-${item.depTaskCode}-${item.cycle}-${item.dateValue}`
const state: ITaskState = dependentResult[key] || 'WAITING_THREAD'
const state: ITaskState = dependentResult[key]
return h(NIcon, { size: 24, color: TasksStateConfig[state].color }, () =>
h(TasksStateConfig[state].icon)
)

34
dolphinscheduler-ui/src/views/projects/workflow/instance/use-table.ts

@ -21,7 +21,7 @@ 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,
@ -31,9 +31,8 @@ import { execute } from '@/service/modules/executors'
import TableAction from './components/table-action'
import {
renderTableTime,
runningType
runningType, workflowExecutionState
} from '@/common/common'
import { renderStateCell } from '../../task/instance/use-table'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
@ -44,6 +43,7 @@ import type { IWorkflowInstance } from '@/service/modules/process-instances/type
import type { ICountDownParam } from './types'
import type { ExecuteReq } from '@/service/modules/executors/types'
import {renderEnvironmentalDistinctionCell} from "@/utils/environmental-distinction";
import { IWorkflowExecutionState } from "@/common/types";
export function useTable() {
const { t } = useI18n()
@ -117,7 +117,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.operating_environment'),
@ -359,3 +359,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
})
}

Loading…
Cancel
Save