Skip to content

Commit

Permalink
improve the select component on the page of workflow relation (#13805)
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinjiang authored and zhuangchong committed May 22, 2023
1 parent 99da77a commit cdf2b21
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions dolphinscheduler-ui/src/views/projects/workflow/relation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -48,14 +48,20 @@ 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],
() => {
handleResetDate()
}
)

return { t, handleResetDate, ...toRefs(variables) }
return { t, handleResetDate, ...toRefs(variables), renderOption }
},
render() {
const { t, handleResetDate } = this
Expand Down Expand Up @@ -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'}>
{{
Expand Down

0 comments on commit cdf2b21

Please sign in to comment.