diff --git a/dolphinscheduler-ui-next/src/components/result/index.tsx b/dolphinscheduler-ui-next/src/components/result/index.tsx new file mode 100644 index 0000000000..52b40ee3ea --- /dev/null +++ b/dolphinscheduler-ui-next/src/components/result/index.tsx @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CSSProperties, defineComponent, PropType } from 'vue' +import { NResult } from 'naive-ui' + +const defaultContentStyle = { + height: '100%', + display: 'flex', + flexDirection: 'column', + justifyContent: 'center' +} + +const props = { + title: { + type: String as PropType + }, + description: { + type: String as PropType + }, + size: { + type: String as PropType<"small" | "medium" | "large" | "huge">, + default: 'medium' + }, + status: { + type: String as PropType<"500" | "error" | "info" | "success" | "warning" | "404" | "403" | "418"> + }, + contentStyle: { + type: String as PropType, + default: defaultContentStyle + } +} + +const Result = defineComponent({ + name: 'Result', + props, + render() { + const { title, description, size, status, contentStyle, $slots } = this + return ( + + {$slots} + + ) + } +}) + +export default Result diff --git a/dolphinscheduler-ui-next/src/layouts/content/index.tsx b/dolphinscheduler-ui-next/src/layouts/content/index.tsx index 45edeb9790..9a83a9250e 100644 --- a/dolphinscheduler-ui-next/src/layouts/content/index.tsx +++ b/dolphinscheduler-ui-next/src/layouts/content/index.tsx @@ -119,7 +119,7 @@ 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 69197e24fe..4f8918c712 100644 --- a/dolphinscheduler-ui-next/src/locales/modules/en_US.ts +++ b/dolphinscheduler-ui-next/src/locales/modules/en_US.ts @@ -516,7 +516,9 @@ const project = { project_name_required: 'Project name is required', related_items: 'Related items', project_name: 'Project Name', - project_tips: 'Please select project name' + project_tips: 'Please select project name', + workflow_relation_no_data_result_title: 'Can not find any relations of workflows.', + workflow_relation_no_data_result_desc: 'There is not any workflows. Please create a workflow, and then visit this page again.', }, task: { online: 'Online', diff --git a/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts b/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts index 199f9248d4..a837b7a6d6 100644 --- a/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts +++ b/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts @@ -513,7 +513,9 @@ const project = { project_name_required: '项目名称必填', related_items: '关联项目', project_name: '项目名称', - project_tips: '请选择项目' + project_tips: '请选择项目', + workflow_relation_no_data_result_title: '工作流关系不存在', + workflow_relation_no_data_result_desc: '目前没有任何工作流,请先创建工作流,再访问该页面', }, task: { online: '已上线', 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 fc409e468c..414e96eaa2 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/relation/index.tsx +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/relation/index.tsx @@ -23,6 +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"; const workflowRelation = defineComponent({ name: 'workflow-relation', @@ -60,61 +61,71 @@ const workflowRelation = defineComponent({ const { t, handleResetDate } = this return ( - - {{ - 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)} + > + + + + + ) + }} + + + ) + }} + + ) ) } })