Browse Source

[Fix]fix the search bar echoes abnormally (#9835)

3.0.0/version-upgrade
labbomb 2 years ago committed by GitHub
parent
commit
d1f5bbfcae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-toolbar.tsx
  2. 6
      dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-search.ts
  3. 2
      dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-task-edit.ts

2
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-toolbar.tsx

@ -84,6 +84,7 @@ export default defineComponent({
* Node search and navigate * Node search and navigate
*/ */
const { const {
searchSelectValue,
navigateTo, navigateTo,
toggleSearchInput, toggleSearchInput,
searchInputVisible, searchInputVisible,
@ -315,6 +316,7 @@ export default defineComponent({
> >
<NSelect <NSelect
size='small' size='small'
value={searchSelectValue.value}
options={nodesDropdown.value} options={nodesDropdown.value}
onFocus={reQueryNodes} onFocus={reQueryNodes}
onUpdateValue={navigateTo} onUpdateValue={navigateTo}

6
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-search.ts

@ -26,6 +26,8 @@ interface Options {
* Node search and navigate * Node search and navigate
*/ */
export function useNodeSearch(options: Options) { export function useNodeSearch(options: Options) {
const searchSelectValue = ref('')
const { graph } = options const { graph } = options
/** /**
@ -46,6 +48,8 @@ export function useNodeSearch(options: Options) {
label: node.getData().taskName, label: node.getData().taskName,
value: node.id value: node.id
})) }))
const filterSelect = nodesDropdown.value.findIndex(item => item.value === searchSelectValue.value)
filterSelect === -1 && (searchSelectValue.value = '')
} }
/** /**
@ -53,6 +57,7 @@ export function useNodeSearch(options: Options) {
* @param {string} code * @param {string} code
*/ */
function navigateTo(code: string) { function navigateTo(code: string) {
searchSelectValue.value = code
if (!graph.value) return if (!graph.value) return
const cell = graph.value.getCellById(code) const cell = graph.value.getCellById(code)
graph.value.scrollToCell(cell, { animation: { duration: 600 } }) graph.value.scrollToCell(cell, { animation: { duration: 600 } })
@ -61,6 +66,7 @@ export function useNodeSearch(options: Options) {
} }
return { return {
searchSelectValue,
navigateTo, navigateTo,
toggleSearchInput, toggleSearchInput,
searchInputVisible, searchInputVisible,

2
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-task-edit.ts

@ -106,7 +106,7 @@ export function useTaskEdit(options: Options) {
/** /**
* Remove task * Remove task
* @param {number} code * @param {number} codes
*/ */
function removeTasks(codes: number[]) { function removeTasks(codes: number[]) {
processDefinition.value.taskDefinitionList = processDefinition.value.taskDefinitionList =

Loading…
Cancel
Save