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

* add a select to support fuzzy search
This commit is contained in:
calvin 2022-01-01 12:46:40 +08:00 committed by GitHub
parent 7e378ea672
commit 4203304b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 18 deletions

View File

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

View File

@ -795,5 +795,6 @@ export default {
'Task group queue the status of releasing': 'Released', 'Task group queue the status of releasing': 'Released',
'Modify task group queue priority': 'Edit the priority of the task group queue', '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 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'
} }

View File

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