From 294f94e860b74dfb90dc6aeb8536f1e33e5b045c Mon Sep 17 00:00:00 2001 From: songjianet <1778651752@qq.com> Date: Fri, 25 Mar 2022 17:25:11 +0800 Subject: [PATCH] [Feature][UI Next][V1.0.0-Alpha] Added results page without workflow nodes. (#9189) --- .../src/components/result/index.tsx | 6 +- .../src/layouts/content/index.tsx | 6 +- .../src/locales/modules/en_US.ts | 5 +- .../src/locales/modules/zh_CN.ts | 5 +- .../views/monitor/servers/worker/index.tsx | 10 +- .../projects/task/definition/use-table.ts | 6 +- .../projects/workflow/definition/index.tsx | 28 ++-- .../projects/workflow/definition/use-table.ts | 23 +-- .../projects/workflow/relation/index.tsx | 137 +++++++++--------- 9 files changed, 125 insertions(+), 101 deletions(-) diff --git a/dolphinscheduler-ui-next/src/components/result/index.tsx b/dolphinscheduler-ui-next/src/components/result/index.tsx index 52b40ee3ea..dcc31c3990 100644 --- a/dolphinscheduler-ui-next/src/components/result/index.tsx +++ b/dolphinscheduler-ui-next/src/components/result/index.tsx @@ -33,11 +33,13 @@ const props = { type: String as PropType }, size: { - type: String as PropType<"small" | "medium" | "large" | "huge">, + type: String as PropType<'small' | 'medium' | 'large' | 'huge'>, default: 'medium' }, status: { - type: String as PropType<"500" | "error" | "info" | "success" | "warning" | "404" | "403" | "418"> + type: String as PropType< + '500' | 'error' | 'info' | 'success' | 'warning' | '404' | '403' | '418' + > }, contentStyle: { type: String as PropType, diff --git a/dolphinscheduler-ui-next/src/layouts/content/index.tsx b/dolphinscheduler-ui-next/src/layouts/content/index.tsx index 9a83a9250e..33a37f7d5b 100644 --- a/dolphinscheduler-ui-next/src/layouts/content/index.tsx +++ b/dolphinscheduler-ui-next/src/layouts/content/index.tsx @@ -119,7 +119,11 @@ const Content = defineComponent({ sideKey={this.sideKeyRef} /> )} - + diff --git a/dolphinscheduler-ui-next/src/locales/modules/en_US.ts b/dolphinscheduler-ui-next/src/locales/modules/en_US.ts index 45382f1120..6e17ee3c9d 100644 --- a/dolphinscheduler-ui-next/src/locales/modules/en_US.ts +++ b/dolphinscheduler-ui-next/src/locales/modules/en_US.ts @@ -162,7 +162,10 @@ const monitor = { last_heartbeat_time: 'Last Heartbeat Time', directory_detail: 'Directory Detail', host: 'Host', - directory: 'Directory' + directory: 'Directory', + worker_no_data_result_title: 'No Worker Nodes Exist', + worker_no_data_result_desc: + 'Currently, there are no worker nodes exist, please create a worker node and refresh this page' }, db: { health_state: 'Health State', diff --git a/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts b/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts index 947161ede2..ad1bbd7946 100644 --- a/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts +++ b/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts @@ -161,7 +161,10 @@ const monitor = { last_heartbeat_time: '最后心跳时间', directory_detail: '目录详情', host: '主机', - directory: '注册目录' + directory: '注册目录', + worker_no_data_result_title: 'Worker节点不存在', + worker_no_data_result_desc: + '目前没有任何Worker节点,请先创建Worker节点,再访问该页面' }, db: { health_state: '健康状态', diff --git a/dolphinscheduler-ui-next/src/views/monitor/servers/worker/index.tsx b/dolphinscheduler-ui-next/src/views/monitor/servers/worker/index.tsx index b17ae1ca98..e532d539a2 100644 --- a/dolphinscheduler-ui-next/src/views/monitor/servers/worker/index.tsx +++ b/dolphinscheduler-ui-next/src/views/monitor/servers/worker/index.tsx @@ -21,6 +21,7 @@ import { useI18n } from 'vue-i18n' import { useWorker } from './use-worker' import styles from './index.module.scss' import Card from '@/components/card' +import Result from '@/components/result' import Gauge from '@/components/chart/modules/Gauge' import WorkerModal from './worker-modal' import type { Ref } from 'vue' @@ -65,7 +66,14 @@ const worker = defineComponent({ const { t, clickDetails, onConfirmModal, showModalRef, zkDirectoryRef } = this - return ( + return this.data.length < 1 ? ( + + ) : ( <> {this.data.map((item: WorkerNode) => { diff --git a/dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts b/dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts index 2add224535..871496fc88 100644 --- a/dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts +++ b/dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts @@ -106,11 +106,7 @@ export function useTable(onEdit: Function) { key: 'upstreamTaskMap', render: (row: TaskDefinitionItem) => row.upstreamTaskMap.map((item: string, index: number) => { - return h( - 'p', - null, - { default: () => `[${index + 1}] ${item}` } - ) + return h('p', null, { default: () => `[${index + 1}] ${item}` }) }), ...COLUMN_WIDTH_CONFIG['name'] }, diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/definition/index.tsx b/dolphinscheduler-ui-next/src/views/projects/workflow/definition/index.tsx index c3486daa37..aef090b4e7 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/definition/index.tsx +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/definition/index.tsx @@ -176,19 +176,21 @@ export default defineComponent({ {{ default: () => t('project.workflow.delete'), trigger: () => ( - - {{ - default: () => t('project.workflow.delete_confirm'), - trigger: () => ( - {t('project.workflow.delete')} - ) - }} - + + {{ + default: () => t('project.workflow.delete_confirm'), + trigger: () => ( + + {t('project.workflow.delete')} + + ) + }} + ) }} diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.ts b/dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.ts index 4379a37ca7..71c6d80de7 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.ts +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.ts @@ -82,17 +82,18 @@ export function useTable() { key: 'name', className: 'workflow-name', ...COLUMN_WIDTH_CONFIG['name'], - render: (row) => h( - ButtonLink, - { - onClick: () => - void router.push({ - name: 'workflow-definition-detail', - params: { code: row.code } - }) - }, - { default: () => row.name } - ) + render: (row) => + h( + ButtonLink, + { + onClick: () => + void router.push({ + name: 'workflow-definition-detail', + params: { code: row.code } + }) + }, + { default: () => row.name } + ) }, { title: t('project.workflow.status'), diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/relation/index.tsx b/dolphinscheduler-ui-next/src/views/projects/workflow/relation/index.tsx index 414e96eaa2..3bbb229a0e 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/relation/index.tsx +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/relation/index.tsx @@ -23,7 +23,7 @@ import { ReloadOutlined, EyeOutlined } from '@vicons/antd' import { useRelation } from './use-relation' import Card from '@/components/card' import Graph from './components/Graph' -import Result from "@/components/result"; +import Result from '@/components/result' const workflowRelation = defineComponent({ name: 'workflow-relation', @@ -61,71 +61,76 @@ const workflowRelation = defineComponent({ const { t, handleResetDate } = this return ( - this.seriesData.length === 0 && ( - - ) - ) || ( - this.seriesData.length > 0 && ( - - {{ - default: () => - Object.keys(this.seriesData).length > 0 && ( - - ), - 'header-extra': () => ( - - - - {{ - default: () => t('project.workflow.refresh'), - trigger: () => ( - - - - - - ) - }} - - - {{ - default: () => t('project.workflow.show_hide_label'), - trigger: () => ( - (this.labelShow = !this.labelShow)} - > - - - - - ) - }} - - - ) - }} - - ) + (this.seriesData.length === 0 && ( + + )) || + (this.seriesData.length > 0 && ( + + {{ + default: () => + Object.keys(this.seriesData).length > 0 && ( + + ), + 'header-extra': () => ( + + + + {{ + default: () => t('project.workflow.refresh'), + trigger: () => ( + + + + + + ) + }} + + + {{ + default: () => t('project.workflow.show_hide_label'), + trigger: () => ( + (this.labelShow = !this.labelShow)} + > + + + + + ) + }} + + + ) + }} + + )) ) } })