You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ke...@apache.org on 2023/05/22 07:52:32 UTC

[dolphinscheduler] 02/02: improve the select component on the page of workflow relation (#13805)

This is an automated email from the ASF dual-hosted git repository.

kerwin pushed a commit to branch 3.1.7-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git

commit cdf2b21e7eaac17732057f7b80562c7c6cdba0bd
Author: calvin <ji...@163.com>
AuthorDate: Tue Mar 28 18:20:42 2023 +0800

    improve the select component on the page of workflow relation (#13805)
---
 .../src/views/projects/workflow/relation/index.tsx         | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/dolphinscheduler-ui/src/views/projects/workflow/relation/index.tsx b/dolphinscheduler-ui/src/views/projects/workflow/relation/index.tsx
index 6da6326adf..b0557ad053 100644
--- a/dolphinscheduler-ui/src/views/projects/workflow/relation/index.tsx
+++ b/dolphinscheduler-ui/src/views/projects/workflow/relation/index.tsx
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-import { defineComponent, onMounted, toRefs, watch } from 'vue'
+import { defineComponent, onMounted, toRefs, watch, VNode, h } from 'vue'
 import { useI18n } from 'vue-i18n'
 import { useRoute } from 'vue-router'
-import { NSelect, NButton, NIcon, NSpace, NTooltip } from 'naive-ui'
+import { NSelect, NButton, NIcon, NSpace, NTooltip, SelectOption } from 'naive-ui'
 import { ReloadOutlined, EyeOutlined } from '@vicons/antd'
 import { useRelation } from './use-relation'
 import Card from '@/components/card'
@@ -48,6 +48,12 @@ const workflowRelation = defineComponent({
         : getWorkflowList(Number(route.params.projectCode))
     }
 
+    const renderOption = ({ node, option }: { node: VNode; option: SelectOption }) =>
+      h(NTooltip, null, {
+        trigger: () => node,
+        default: () => option.label
+      })
+
     watch(
       () => [variables.workflow, variables.labelShow, locale.value],
       () => {
@@ -55,7 +61,7 @@ const workflowRelation = defineComponent({
       }
     )
 
-    return { t, handleResetDate, ...toRefs(variables) }
+    return { t, handleResetDate, ...toRefs(variables), renderOption }
   },
   render() {
     const { t, handleResetDate } = this
@@ -86,10 +92,12 @@ const workflowRelation = defineComponent({
               <NSpace>
                 <NSelect
                   clearable
+                  filterable
                   style={{ width: '300px' }}
                   placeholder={t('project.workflow.workflow_name')}
                   options={this.workflowOptions}
                   v-model={[this.workflow, 'value']}
+                  renderOption={this.renderOption}
                 />
                 <NTooltip trigger={'hover'}>
                   {{