Browse Source

[Feature][UI Next][V1.0.0-Alpha] Add a DISPATCH state to the task. (#9302)

3.0.0/version-upgrade
Amy0104 3 years ago committed by GitHub
parent
commit
c49ae015ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      dolphinscheduler-ui-next/src/locales/modules/en_US.ts
  2. 19
      dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts
  3. 75
      dolphinscheduler-ui-next/src/utils/common.ts
  4. 1
      dolphinscheduler-ui-next/src/utils/types.ts
  5. 40
      dolphinscheduler-ui-next/src/views/projects/task/instance/index.tsx
  6. 2
      dolphinscheduler-ui-next/src/views/projects/task/instance/use-table.ts
  7. 69
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/tree/index.tsx

19
dolphinscheduler-ui-next/src/locales/modules/en_US.ts

@ -104,6 +104,7 @@ const home = {
delay_execution: 'DELAY_EXECUTION', delay_execution: 'DELAY_EXECUTION',
forced_success: 'FORCED_SUCCESS', forced_success: 'FORCED_SUCCESS',
serial_wait: 'SERIAL_WAIT', serial_wait: 'SERIAL_WAIT',
dispatch: 'DISPATCH',
ready_block: 'READY_BLOCK', ready_block: 'READY_BLOCK',
block: 'BLOCK' block: 'BLOCK'
} }
@ -496,6 +497,7 @@ const project = {
delay_execution: 'Delay execution', delay_execution: 'Delay execution',
forced_success: 'Forced success', forced_success: 'Forced success',
serial_wait: 'Serial wait', serial_wait: 'Serial wait',
dispatch: 'Dispatch',
executing: 'Executing', executing: 'Executing',
startup_type: 'Startup Type', startup_type: 'Startup Type',
complement_range: 'Complement Range', complement_range: 'Complement Range',
@ -561,24 +563,9 @@ const project = {
edit: 'Edit', edit: 'Edit',
delete: 'Delete', delete: 'Delete',
delete_confirm: 'Delete?', delete_confirm: 'Delete?',
submitted_success: 'Submitted Success',
running_execution: 'Running Execution',
ready_pause: 'Ready Pause',
pause: 'Pause',
ready_stop: 'Ready Stop',
stop: 'Stop',
failure: 'Failure',
success: 'Success',
need_fault_tolerance: 'Need Fault Tolerance',
kill: 'Kill',
waiting_thread: 'Waiting Thread',
waiting_depend: 'Waiting Depend',
delay_execution: 'Delay Execution',
forced_success: 'Forced Success',
view_log: 'View Log', view_log: 'View Log',
download_log: 'Download Log', download_log: 'Download Log',
refresh: 'Refresh', refresh: 'Refresh'
serial_wait: 'Serial Wait'
}, },
dag: { dag: {
create: 'Create Workflow', create: 'Create Workflow',

19
dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts

@ -104,6 +104,7 @@ const home = {
delay_execution: '延时执行', delay_execution: '延时执行',
forced_success: '强制成功', forced_success: '强制成功',
serial_wait: '串行等待', serial_wait: '串行等待',
dispatch: '派发',
ready_block: '准备阻断', ready_block: '准备阻断',
block: '阻断' block: '阻断'
} }
@ -493,6 +494,7 @@ const project = {
delay_execution: '延时执行', delay_execution: '延时执行',
forced_success: '强制成功', forced_success: '强制成功',
serial_wait: '串行等待', serial_wait: '串行等待',
dispatch: '派发',
executing: '正在执行', executing: '正在执行',
startup_type: '启动类型', startup_type: '启动类型',
complement_range: '补数范围', complement_range: '补数范围',
@ -557,24 +559,9 @@ const project = {
edit: '编辑', edit: '编辑',
delete: '删除', delete: '删除',
delete_confirm: '确定删除吗?', delete_confirm: '确定删除吗?',
submitted_success: '提交成功',
running_execution: '正在运行',
ready_pause: '准备暂停',
pause: '暂停',
ready_stop: '准备停止',
stop: '停止',
failure: '失败',
success: '成功',
need_fault_tolerance: '需要容错',
kill: 'KILL',
waiting_thread: '等待线程',
waiting_depend: '等待依赖完成',
delay_execution: '延时执行',
forced_success: '强制成功',
view_log: '查看日志', view_log: '查看日志',
download_log: '下载日志', download_log: '下载日志',
refresh: '刷新', refresh: '刷新'
serial_wait: '串行等待'
}, },
dag: { dag: {
create: '创建工作流', create: '创建工作流',

75
dolphinscheduler-ui-next/src/utils/common.ts

@ -30,7 +30,8 @@ import {
StopFilled, StopFilled,
StopOutlined, StopOutlined,
GlobalOutlined, GlobalOutlined,
IssuesCloseOutlined IssuesCloseOutlined,
SendOutlined
} from '@vicons/antd' } from '@vicons/antd'
import { parseISO } from 'date-fns' import { parseISO } from 'date-fns'
import _ from 'lodash' import _ from 'lodash'
@ -132,66 +133,10 @@ export const stateType = (t: any) => [
value: '', value: '',
label: `${t('project.workflow.all_status')}` label: `${t('project.workflow.all_status')}`
}, },
{ ...Object.entries(tasksState(t)).map(([key, item]) => ({
value: 'SUBMITTED_SUCCESS', value: key,
label: `${t('project.workflow.submit_success')}` label: item.desc
}, }))
{
value: 'RUNNING_EXECUTION',
label: `${t('project.workflow.running')}`
},
{
value: 'READY_PAUSE',
label: `${t('project.workflow.ready_to_pause')}`
},
{
value: 'PAUSE',
label: `${t('project.workflow.pause')}`
},
{
value: 'READY_STOP',
label: `${t('project.workflow.ready_to_stop')}`
},
{
value: 'STOP',
label: `${t('project.workflow.stop')}`
},
{
value: 'FAILURE',
label: `${t('project.workflow.failed')}`
},
{
value: 'SUCCESS',
label: `${t('project.workflow.success')}`
},
{
value: 'NEED_FAULT_TOLERANCE',
label: `${t('project.workflow.need_fault_tolerance')}`
},
{
value: 'KILL',
label: `${t('project.workflow.kill')}`
},
{
value: 'WAITING_THREAD',
label: `${t('project.workflow.waiting_for_thread')}`
},
{
value: 'WAITING_DEPEND',
label: `${t('project.workflow.waiting_for_dependency_to_complete')}`
},
{
value: 'DELAY_EXECUTION',
label: `${t('project.workflow.delay_execution')}`
},
{
value: 'FORCED_SUCCESS',
label: `${t('project.workflow.forced_success')}`
},
{
value: 'SERIAL_WAIT',
label: `${t('project.workflow.serial_wait')}`
}
] ]
/** /**
@ -322,6 +267,14 @@ export const tasksState = (t: any): ITaskStateConfig => ({
icon: Loading3QuartersOutlined, icon: Loading3QuartersOutlined,
isSpin: true, isSpin: true,
classNames: 'serial_wait' classNames: 'serial_wait'
},
DISPATCH: {
id: 15,
desc: `${t('project.workflow.dispatch')}`,
color: '#5101be',
icon: SendOutlined,
isSpin: false,
classNames: 'dispatch'
} }
}) })

1
dolphinscheduler-ui-next/src/utils/types.ts

@ -32,6 +32,7 @@ export type ITaskState =
| 'DELAY_EXECUTION' | 'DELAY_EXECUTION'
| 'FORCED_SUCCESS' | 'FORCED_SUCCESS'
| 'SERIAL_WAIT' | 'SERIAL_WAIT'
| 'DISPATCH'
export type ITaskStateConfig = { export type ITaskStateConfig = {
[key in ITaskState]: { [key in ITaskState]: {

40
dolphinscheduler-ui-next/src/views/projects/task/instance/index.tsx

@ -32,6 +32,7 @@ import { useTable } from './use-table'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import Card from '@/components/card' import Card from '@/components/card'
import LogModal from './components/log-modal' import LogModal from './components/log-modal'
import { stateType } from '@/utils/common'
import styles from './index.module.scss' import styles from './index.module.scss'
const TaskInstance = defineComponent({ const TaskInstance = defineComponent({
@ -126,44 +127,7 @@ const TaskInstance = defineComponent({
<NSelect <NSelect
v-model={[this.stateType, 'value']} v-model={[this.stateType, 'value']}
size='small' size='small'
options={[ options={stateType(t).slice(1)}
{
label: t('project.task.submitted_success'),
value: 'SUBMITTED_SUCCESS'
},
{
label: t('project.task.running_execution'),
value: 'RUNNING_EXECUTION'
},
{ label: t('project.task.ready_pause'), value: 'READY_PAUSE' },
{ label: t('project.task.pause'), value: 'PAUSE' },
{ label: t('project.task.ready_stop'), value: 'READY_STOP' },
{ label: t('project.task.stop'), value: 'STOP' },
{ label: t('project.task.failure'), value: 'FAILURE' },
{ label: t('project.task.success'), value: 'SUCCESS' },
{
label: t('project.task.need_fault_tolerance'),
value: 'NEED_FAULT_TOLERANCE'
},
{ label: t('project.task.kill'), value: 'KILL' },
{
label: t('project.task.waiting_thread'),
value: 'WAITING_THREAD'
},
{
label: t('project.task.waiting_depend'),
value: 'WAITING_DEPEND'
},
{
label: t('project.task.delay_execution'),
value: 'DELAY_EXECUTION'
},
{
label: t('project.task.forced_success'),
value: 'FORCED_SUCCESS'
},
{ label: t('project.task.serial_wait'), value: 'SERIAL_WAIT' }
]}
placeholder={t('project.task.state')} placeholder={t('project.task.state')}
style={{ width: '180px' }} style={{ width: '180px' }}
clearable clearable

2
dolphinscheduler-ui-next/src/views/projects/task/instance/use-table.ts

@ -327,6 +327,8 @@ export function useTable() {
} }
export function renderStateCell(state: ITaskState, t: Function) { export function renderStateCell(state: ITaskState, t: Function) {
if (!state) return ''
const stateOption = tasksState(t)[state] const stateOption = tasksState(t)[state]
const Icon = h( const Icon = h(

69
dolphinscheduler-ui-next/src/views/projects/workflow/definition/tree/index.tsx

@ -27,7 +27,8 @@ import { Router, useRouter } from 'vue-router'
import { viewTree } from '@/service/modules/process-definition' import { viewTree } from '@/service/modules/process-definition'
import { SelectMixedOption } from 'naive-ui/lib/select/src/interface' import { SelectMixedOption } from 'naive-ui/lib/select/src/interface'
import { find } from 'lodash' import { find } from 'lodash'
import { ITaskTypeNodeOption } from './types' import { tasksState } from '@/utils/common'
import type { ITaskTypeNodeOption } from './types'
export default defineComponent({ export default defineComponent({
name: 'WorkflowDefinitionTiming', name: 'WorkflowDefinitionTiming',
@ -136,67 +137,11 @@ export default defineComponent({
]) ])
const initTaskStateMap = () => { const initTaskStateMap = () => {
taskStateMap.value = [ taskStateMap.value = Object.entries(tasksState(t)).map(([key, item]) => ({
{ state: key,
state: 'SUBMITTED_SUCCESS', value: item.desc,
value: t('project.task.submitted_success'), color: item.color
color: '#A9A9A9' }))
},
{
state: 'RUNNING_EXECUTION',
value: t('project.task.running_execution'),
color: '#4295DA'
},
{
state: 'READY_PAUSE',
value: t('project.task.ready_pause'),
color: '#50AEA3'
},
{ state: 'PAUSE', value: t('project.task.pause'), color: '#367A72' },
{
state: 'READY_STOP',
value: t('project.task.ready_stop'),
color: '#E93424'
},
{ state: 'STOP', value: t('project.task.stop'), color: '#D62E20' },
{ state: 'FAILURE', value: t('project.task.failed'), color: '#000000' },
{
state: 'SUCCESS',
value: t('project.task.success'),
color: '#67C93B'
},
{
state: 'NEED_FAULT_TOLERANCE',
value: t('project.task.need_fault_tolerance'),
color: '#F09235'
},
{ state: 'KILL', value: t('project.task.kill'), color: '#991F14' },
{
state: 'WAITING_THREAD',
value: t('project.task.waiting_thread'),
color: '#8635E4'
},
{
state: 'WAITING_DEPEND',
value: t('project.task.waiting_depend'),
color: '#4A0AB6'
},
{
state: 'DELAY_EXECUTION',
value: t('project.task.delay_execution'),
color: '#c5b4ec'
},
{
state: 'FORCED_SUCCESS',
value: t('project.task.forced_success'),
color: '#453463'
},
{
state: 'SERIAL_WAIT',
value: t('project.task.serial_wait'),
color: '#1b0446'
}
]
} }
const initChartData = (node: any, newNode: any) => { const initChartData = (node: any, newNode: any) => {

Loading…
Cancel
Save