Browse Source

improve the select component on the page of workflow relation (#13805)

3.2.0-release
calvin 2 years ago committed by GitHub
parent
commit
1e8d09e955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      dolphinscheduler-ui/src/views/projects/workflow/relation/index.tsx

14
dolphinscheduler-ui/src/views/projects/workflow/relation/index.tsx

@ -15,10 +15,10 @@
* limitations under the License. * 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 { useI18n } from 'vue-i18n'
import { useRoute } from 'vue-router' 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 { ReloadOutlined, EyeOutlined } from '@vicons/antd'
import { useRelation } from './use-relation' import { useRelation } from './use-relation'
import Card from '@/components/card' import Card from '@/components/card'
@ -48,6 +48,12 @@ const workflowRelation = defineComponent({
: getWorkflowList(Number(route.params.projectCode)) : getWorkflowList(Number(route.params.projectCode))
} }
const renderOption = ({ node, option }: { node: VNode; option: SelectOption }) =>
h(NTooltip, null, {
trigger: () => node,
default: () => option.label
})
watch( watch(
() => [variables.workflow, variables.labelShow, locale.value], () => [variables.workflow, variables.labelShow, locale.value],
() => { () => {
@ -55,7 +61,7 @@ const workflowRelation = defineComponent({
} }
) )
return { t, handleResetDate, ...toRefs(variables) } return { t, handleResetDate, ...toRefs(variables), renderOption }
}, },
render() { render() {
const { t, handleResetDate } = this const { t, handleResetDate } = this
@ -86,10 +92,12 @@ const workflowRelation = defineComponent({
<NSpace> <NSpace>
<NSelect <NSelect
clearable clearable
filterable
style={{ width: '300px' }} style={{ width: '300px' }}
placeholder={t('project.workflow.workflow_name')} placeholder={t('project.workflow.workflow_name')}
options={this.workflowOptions} options={this.workflowOptions}
v-model={[this.workflow, 'value']} v-model={[this.workflow, 'value']}
renderOption={this.renderOption}
/> />
<NTooltip trigger={'hover'}> <NTooltip trigger={'hover'}>
{{ {{

Loading…
Cancel
Save