Skip to content

Commit

Permalink
Merge branch 'zp-search-improvement' into '3.1.9-com'
Browse files Browse the repository at this point in the history
cherry-pick [improvement-apache#11879]Keyword Search Improvement (apache#12951)

See merge request DataTech/dolphinscheduler!7
  • Loading branch information
zhaopink committed Jan 5, 2024
2 parents 6f49045 + 1231d51 commit 224228a
Show file tree
Hide file tree
Showing 28 changed files with 216 additions and 149 deletions.
55 changes: 55 additions & 0 deletions dolphinscheduler-ui/src/components/input-search/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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 { defineComponent, withKeys, PropType } from 'vue'
import { NInput } from 'naive-ui'
import { useI18n } from 'vue-i18n'

const props = {
placeholder: {
type: String as PropType<string>,
required: false
}
}

const Search = defineComponent({
name: 'Search',
emits: ['search','clear'],
props: props,
setup(props, ctx) {
const { t } = useI18n()

const onKeyDown = (ev: KeyboardEvent) => {
ctx.emit('search', (ev.target as HTMLInputElement)?.value || '')
}
const onClear = (ev: Event) => {
ctx.emit('clear', (ev.target as HTMLInputElement)?.value || '')
}
return () => (

<NInput
size='small'
clearable
placeholder = {props.placeholder?props.placeholder:t('input_search.placeholder')}
onKeydown={withKeys(onKeyDown, ['enter'])}
onClear = {onClear}
/>
)
}
})

export default Search
4 changes: 3 additions & 1 deletion dolphinscheduler-ui/src/locales/en_US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import crontab from '@/locales/en_US/crontab'
import data_quality from '@/locales/en_US/data-quality'
import datasource from '@/locales/en_US/datasource'
import home from '@/locales/en_US/home'
import input_search from '@/locales/en_US/input-search'
import login from '@/locales/en_US/login'
import menu from '@/locales/en_US/menu'
import modal from '@/locales/en_US/modal'
Expand Down Expand Up @@ -46,5 +47,6 @@ export default {
security,
datasource,
data_quality,
crontab
crontab,
input_search
}
20 changes: 20 additions & 0 deletions dolphinscheduler-ui/src/locales/en_US/input-search.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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.
*/

export default {
placeholder: 'Please enter keyword'
}
4 changes: 3 additions & 1 deletion dolphinscheduler-ui/src/locales/zh_CN/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import crontab from '@/locales/zh_CN/crontab'
import data_quality from '@/locales/zh_CN/data-quality'
import datasource from '@/locales/zh_CN/datasource'
import home from '@/locales/zh_CN/home'
import input_search from '@/locales/zh_CN/input-search'
import login from '@/locales/zh_CN/login'
import menu from '@/locales/zh_CN/menu'
import modal from '@/locales/zh_CN/modal'
Expand Down Expand Up @@ -46,5 +47,6 @@ export default {
security,
datasource,
data_quality,
crontab
crontab,
input_search
}
20 changes: 20 additions & 0 deletions dolphinscheduler-ui/src/locales/zh_CN/input-search.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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.
*/

export default {
placeholder: '请输入关键词'
}
25 changes: 10 additions & 15 deletions dolphinscheduler-ui/src/views/data-quality/rule/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,11 @@ import {
ref,
toRefs
} from 'vue'
import {
NSpace,
NInput,
NButton,
NIcon,
NDataTable,
NPagination
} from 'naive-ui'
import {NSpace, NButton, NIcon, NDataTable, NPagination} from 'naive-ui'
import { SearchOutlined } from '@vicons/antd'
import { useTable } from './use-table'
import Card from '@/components/card'
import Search from '@/components/input-search'
import RuleModal from './components/rule-modal'

const TaskResult = defineComponent({
Expand All @@ -58,7 +52,6 @@ const TaskResult = defineComponent({
}

const onSearch = () => {
variables.page = 1
requestTableData()
}

Expand Down Expand Up @@ -115,14 +108,16 @@ const TaskResult = defineComponent({
<NSpace vertical>
<Card>
<NSpace justify='end'>
<NInput
allowInput={this.trim}
v-model={[this.searchVal, 'value']}
size='small'
<Search
v-model:value={this.searchVal}
placeholder={t('data_quality.rule.name')}
clearable
onSearch={onSearch}
/>
<NButton size='small' type='primary' onClick={onSearch}>
<NButton
size='small'
type='primary'
onClick={onSearch}
>
<NIcon>
<SearchOutlined />
</NIcon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function useTable(viewRuleEntry = (unusedRuleJson: string): void => {}) {
page: ref(1),
pageSize: ref(10),
state: ref(null),
searchVal: ref(null),
searchVal: '',
totalPage: ref(1),
loadingRef: ref(false)
})
Expand Down
12 changes: 5 additions & 7 deletions dolphinscheduler-ui/src/views/data-quality/task-result/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
} from 'vue'
import {
NSpace,
NInput,
NSelect,
NDatePicker,
NButton,
Expand All @@ -36,6 +35,7 @@ import { SearchOutlined } from '@vicons/antd'
import { useTable } from './use-table'
import { useI18n } from 'vue-i18n'
import Card from '@/components/card'
import Search from '@/components/input-search'

const TaskResult = defineComponent({
name: 'task-result',
Expand Down Expand Up @@ -90,12 +90,10 @@ const TaskResult = defineComponent({
<NSpace vertical>
<Card>
<NSpace justify='end'>
<NInput
allowInput={this.trim}
v-model={[this.searchVal, 'value']}
size='small'
placeholder={t('data_quality.task_result.task_name')}
clearable
<Search
v-model:value={this.searchVal}
placeholder={t('data_quality.task_result.task_name')}
onSearch={onSearch}
/>
<NSelect
v-model={[this.ruleType, 'value']}
Expand Down
11 changes: 5 additions & 6 deletions dolphinscheduler-ui/src/views/datasource/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
} from 'vue'
import {
NButton,
NInput,
NIcon,
NDataTable,
NPagination,
Expand All @@ -37,6 +36,7 @@ import { useColumns } from './use-columns'
import { useTable } from './use-table'
import { DefaultTableWidth } from '@/common/column-width-config'
import Card from '@/components/card'
import Search from '@/components/input-search'
import DetailModal from './detail'
import type { TableColumns } from './types'

Expand Down Expand Up @@ -121,11 +121,10 @@ const list = defineComponent({
{t('datasource.create_datasource')}
</NButton>
<NSpace justify='end' wrap={false}>
<NInput
allowInput={this.trim}
v-model={[this.searchVal, 'value']}
size='small'
placeholder={`${t('datasource.search_input_tips')}`}
<Search
v-model:value = {this.searchVal}
placeholder = {t('datasource.search_input_tips')}
onSearch={onUpdatedList}
/>
<NButton type='primary' size='small' onClick={onUpdatedList}>
<NIcon>
Expand Down
4 changes: 2 additions & 2 deletions dolphinscheduler-ui/src/views/datasource/list/use-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { reactive } from 'vue'
import {reactive, ref} from 'vue'
import {
queryDataSourceListPaging,
deleteDataSource
Expand All @@ -26,7 +26,7 @@ export function useTable() {
page: 1,
pageSize: 10,
itemCount: 0,
searchVal: '',
searchVal: ref(''),
list: [],
loading: false
})
Expand Down
15 changes: 7 additions & 8 deletions dolphinscheduler-ui/src/views/projects/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
NButton,
NDataTable,
NIcon,
NInput,
NPagination,
NSpace
} from 'naive-ui'
Expand All @@ -34,6 +33,7 @@ import {
import { useI18n } from 'vue-i18n'
import { useTable } from './use-table'
import Card from '@/components/card'
import Search from "@/components/input-search";
import ProjectModal from './components/project-modal'

const list = defineComponent({
Expand Down Expand Up @@ -121,14 +121,13 @@ const list = defineComponent({
{t('project.list.create_project')}
</NButton>
<NSpace>
<NInput
allowInput={this.trim}
size='small'
v-model={[this.searchVal, 'value']}
placeholder={t('project.list.project_tips')}
clearable
onClear={this.onClearSearch}
<Search
v-model:value = {this.searchVal}
placeholder={t('project.list.project_tips')}
onSearch={this.handleSearch}
onClear={this.onClearSearch}
/>

<NButton size='small' type='primary' onClick={this.handleSearch}>
<NIcon>
<SearchOutlined />
Expand Down
2 changes: 1 addition & 1 deletion dolphinscheduler-ui/src/views/projects/list/use-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export function useTable() {
tableData: [],
page: ref(1),
pageSize: ref(10),
searchVal: ref(null),
searchVal: ref(''),
totalPage: ref(1),
showModalRef: ref(false),
statusRef: ref(0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
NButton,
NDataTable,
NIcon,
NInput,
NPagination,
NSpace,
NTooltip,
Expand All @@ -43,6 +42,7 @@ import TimingModal from './components/timing-modal'
import VersionModal from './components/version-modal'
import CopyModal from './components/copy-modal'
import type { Router } from 'vue-router'
import Search from "@/components/input-search";

export default defineComponent({
name: 'WorkflowDefinitionList',
Expand Down Expand Up @@ -154,12 +154,10 @@ export default defineComponent({
</NButton>
</NSpace>
<NSpace>
<NInput
allowInput={this.trim}
size='small'
placeholder={t('resource.function.enter_keyword_tips')}
v-model={[this.searchVal, 'value']}
clearable
<Search
placeholder = {t('resource.function.enter_keyword_tips')}
v-model:value={this.searchVal}
onSearch={this.handleSearch}
onClear={this.onClearSearch}
/>
<NButton type='primary' size='small' onClick={this.handleSearch}>
Expand Down
11 changes: 5 additions & 6 deletions dolphinscheduler-ui/src/views/resource/file/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
NButtonGroup,
NButton,
NPagination,
NInput,
NBreadcrumb,
NBreadcrumbItem
} from 'naive-ui'
Expand All @@ -52,6 +51,7 @@ import ResourceRenameModal from './rename'
import styles from './index.module.scss'
import type { ResourceFile } from '@/service/modules/resources/types'
import type { Router } from 'vue-router'
import Search from "@/components/input-search";

export default defineComponent({
name: 'File',
Expand Down Expand Up @@ -280,11 +280,10 @@ export default defineComponent({
</NButton>
</NButtonGroup>
<NSpace>
<NInput
size='small'
allowInput={this.trim}
placeholder={t('resource.file.enter_keyword_tips')}
v-model={[this.searchRef, 'value']}
<Search
placeholder = {t('resource.file.enter_keyword_tips')}
v-model:value={this.searchRef}
onSearch={handleConditions}
/>
<NButton size='small' type='primary' onClick={handleConditions}>
<NIcon>
Expand Down
Loading

0 comments on commit 224228a

Please sign in to comment.