Browse Source

[Fix][UI Next][V1.0.0-Alpha] Fix missing pagination in version info table. (#8785)

3.0.0/version-upgrade
songjianet 3 years ago committed by GitHub
parent
commit
97a0eede25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/use-table.ts
  2. 29
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/version-modal.tsx

20
dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/use-table.ts

@ -18,16 +18,16 @@
import { h, ref, reactive, SetupContext } from 'vue' import { h, ref, reactive, SetupContext } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { NSpace, NTooltip, NButton, NPopconfirm, NTag } from 'naive-ui'
import { import {
deleteVersion, deleteVersion,
queryVersions, queryVersions,
switchVersion switchVersion
} from '@/service/modules/process-definition' } from '@/service/modules/process-definition'
import type { Router } from 'vue-router'
import type { TableColumns } from 'naive-ui/es/data-table/src/interface'
import { DeleteOutlined, ExclamationCircleOutlined } from '@vicons/antd' import { DeleteOutlined, ExclamationCircleOutlined } from '@vicons/antd'
import { NSpace, NTooltip, NButton, NPopconfirm, NTag } from 'naive-ui'
import styles from '../index.module.scss' import styles from '../index.module.scss'
import type { Router } from 'vue-router'
import type { TableColumns } from 'naive-ui/es/data-table/src/interface'
export function useTable( export function useTable(
ctx: SetupContext<('update:show' | 'update:row' | 'updateList')[]> ctx: SetupContext<('update:show' | 'update:row' | 'updateList')[]>
@ -149,21 +149,25 @@ export function useTable(
columns, columns,
row: {} as any, row: {} as any,
tableData: [], tableData: [],
page: ref(1),
totalPage: ref(1),
pageSize: ref(10),
projectCode: ref(Number(router.currentRoute.value.params.projectCode)) projectCode: ref(Number(router.currentRoute.value.params.projectCode))
}) })
const getTableData = (row: any) => { const getTableData = (row: any) => {
variables.row = row variables.row = row
const params = {
pageSize: 10,
pageNo: 1
}
queryVersions( queryVersions(
{ ...params }, {
pageSize: variables.pageSize,
pageNo: variables.page
},
variables.projectCode, variables.projectCode,
variables.row.code variables.row.code
).then((res: any) => { ).then((res: any) => {
variables.tableData = res.totalList.map((item: any) => ({ ...item })) variables.tableData = res.totalList.map((item: any) => ({ ...item }))
variables.totalPage = res.totalPage
}) })
} }

29
dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/version-modal.tsx

@ -17,13 +17,13 @@
import { defineComponent, PropType, toRefs, watch } from 'vue' import { defineComponent, PropType, toRefs, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { NDataTable } from 'naive-ui'
import Modal from '@/components/modal'
import { useForm } from './use-form' import { useForm } from './use-form'
import { useModal } from './use-modal' import { useModal } from './use-modal'
import { useTable } from './use-table' import { useTable } from './use-table'
import { IDefinitionData } from '../types' import { NDataTable, NPagination } from 'naive-ui'
import Modal from '@/components/modal'
import styles from '../index.module.scss' import styles from '../index.module.scss'
import type { IDefinitionData } from '../types'
const props = { const props = {
show: { show: {
@ -44,6 +44,13 @@ export default defineComponent({
const { variables, getTableData } = useTable(ctx) const { variables, getTableData } = useTable(ctx)
const { importState } = useForm() const { importState } = useForm()
const { handleImportDefinition } = useModal(importState, ctx) const { handleImportDefinition } = useModal(importState, ctx)
const requestData = () => {
if (props.show && props.row?.code) {
getTableData(props.row)
}
}
const hideModal = () => { const hideModal = () => {
ctx.emit('update:show') ctx.emit('update:show')
} }
@ -59,23 +66,21 @@ export default defineComponent({
watch( watch(
() => props.show, () => props.show,
() => { () => requestData()
if (props.show && props.row?.code) {
getTableData(props.row)
}
}
) )
return { return {
hideModal, hideModal,
handleImport, handleImport,
customRequest, customRequest,
requestData,
...toRefs(variables) ...toRefs(variables)
} }
}, },
render() { render() {
const { t } = useI18n() const { t } = useI18n()
const { requestData } = this
return ( return (
<Modal <Modal
@ -91,6 +96,14 @@ export default defineComponent({
size={'small'} size={'small'}
class={styles.table} class={styles.table}
/> />
<div class={styles.pagination}>
<NPagination
v-model:page={this.page}
v-model:page-size={this.pageSize}
page-count={this.totalPage}
onUpdatePage={requestData}
/>
</div>
</Modal> </Modal>
) )
} }

Loading…
Cancel
Save