Browse Source

[Fix-7493] Support searching for task node in the DAG. (#7766)

* add a select to support fuzzy search
calvin 3 years ago
parent
commit
4203304b08

+ 12 - 16
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/canvas/toolbar.vue

@@ -74,16 +74,14 @@
           'visible': searchInputVisible
         }"
       >
-        <el-input
-          v-model="searchText"
-          placeholder=""
-          prefix-icon="el-icon-search"
-          size="mini"
-          @keyup.enter.native="onSearch"
-          clearable
-          @blur="searchInputBlur"
-          ref="searchInput"
-        ></el-input>
+        <el-select v-if="searchInputVisible" ref="searchInput" v-model="searchText" size="mini" clearable prefix-icon="el-icon-search" @change="onSearch" @keyup.enter.native="onSearch" filterable :placeholder="$t('Please select task name')">
+          <el-option
+            v-for="item in getTaskNodeOptions()"
+            :key="item.id"
+            :label="item.data.taskName"
+            :value="item.data.taskName">
+          </el-option>
+        </el-select>
       </div>
       <el-tooltip
         class="toolbar-operation"
@@ -191,14 +189,12 @@
         const canvas = this.getDagCanvasRef()
         canvas.navigateTo(this.searchText)
       },
+      getTaskNodeOptions () {
+        const canvas = this.getDagCanvasRef()
+        return canvas.getNodes()
+      },
       showSearchInput () {
         this.searchInputVisible = true
-        this.$refs.searchInput.focus()
-      },
-      searchInputBlur () {
-        if (!this.searchText) {
-          this.searchInputVisible = false
-        }
       },
       getDagCanvasRef () {
         if (this.canvasRef) {

+ 2 - 1
dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js

@@ -795,5 +795,6 @@ export default {
   'Task group queue the status of releasing': 'Released',
   'Modify task group queue priority': 'Edit the priority of the task group queue',
   'Priority not empty': 'The value of priority can not be empty',
-  'Priority must be number': 'The value of priority should be number'
+  'Priority must be number': 'The value of priority should be number',
+  'Please select task name': 'Please select a task name'
 }

+ 2 - 1
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@@ -797,5 +797,6 @@ export default {
   'Modify task group queue priority': '修改优先级',
   'Force to start task': '强制启动',
   'Priority not empty': '优先级不能为空',
-  'Priority must be number': '优先级必须是数值'
+  'Priority must be number': '优先级必须是数值',
+  'Please select task name': '请选择节点名称'
 }