Skip to content

Commit

Permalink
resolve conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
FU-design committed Jul 25, 2024
1 parent 6b573a7 commit 35848b6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
20 changes: 10 additions & 10 deletions bigtop-manager-ui/src/components/job-info/job.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import Stage from './stage.vue'
import Task from './task.vue'
import TaskLog from './task-log.vue'
import useBaseTable from '@/composables/useBaseTable'
import useBaseTable from '@/composables/use-base-table'
import type { TableColumnType, TablePaginationConfig } from 'ant-design-vue'

const columns: TableColumnType[] = [
Expand Down Expand Up @@ -97,9 +97,9 @@
loading,
columnsProp,
dataSource: jobs,
paginateProp,
paginationProps,
onChange,
restState
resetState
} = useBaseTable<JobVO>(columns, [])

const getCurrPage = computed(() => {
Expand All @@ -108,7 +108,7 @@

watch(visible, (val) => {
if (val) {
restState()
resetState()
loading.value = true
checkDataOrigin(outerData.value ? true : false)
}
Expand Down Expand Up @@ -159,8 +159,8 @@
const getJobsList = async () => {
try {
const params = {
pageNum: paginateProp.value.current,
pageSize: paginateProp.value.pageSize,
pageNum: paginationProps.value.current,
pageSize: paginationProps.value.pageSize,
sort: 'desc'
} as Pagination
const { content } = await getJobs(clusterId.value, params)
Expand Down Expand Up @@ -202,7 +202,7 @@
const handleClose = () => {
intervalId.value?.pause()
breadcrumbs.value = [{ name: 'Job Info' }]
restState()
resetState()
emits('update:visible', false)
}

Expand All @@ -227,7 +227,7 @@
<div :class="{ 'footer-btns': showLogAwaitMsg }">
<div
v-if="showLogAwaitMsg"
class="logs_wait_msg"
class="logs-wait-msg"
:class="{ 'loading-dot': !isComplete }"
>
{{
Expand Down Expand Up @@ -259,7 +259,7 @@
:loading="loading"
:data-source="jobs"
:columns="columnsProp"
:pagination="paginateProp"
:pagination="paginationProps"
destroy-on-close
@change="onTableChange"
>
Expand Down Expand Up @@ -306,7 +306,7 @@
flex-wrap: wrap;
}

.logs_wait_msg {
.logs-wait-msg {
margin: 0;
padding: 0;
}
Expand Down
7 changes: 4 additions & 3 deletions bigtop-manager-ui/src/components/job-info/stage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import { StageVO } from '@/api/job/types.ts'
import { watch } from 'vue'
import CustomProgress from './custom-progress.vue'
import useBaseTable from '@/composables/useBaseTable'
import useBaseTable from '@/composables/use-base-table'
import type { TableColumnType } from 'ant-design-vue'

interface StageProps {
Expand All @@ -31,7 +31,8 @@

const props = defineProps<StageProps>()
const baseTable = useBaseTable<StageVO>(props.columns, props.stages)
const { dataSource, columnsProp, loading, paginateProp, onChange } = baseTable
const { dataSource, columnsProp, loading, paginationProps, onChange } =
baseTable
watch(
() => props.stages,
(val) => {
Expand Down Expand Up @@ -59,7 +60,7 @@
:loading="loading"
:columns="columnsProp"
:data-source="dataSource"
:pagination="paginateProp"
:pagination="paginationProps"
@change="onChange"
>
<template #headerCell="{ column }">
Expand Down
7 changes: 4 additions & 3 deletions bigtop-manager-ui/src/components/job-info/task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<script setup lang="ts">
import { TaskVO, State } from '@/api/job/types.ts'
import useBaseTable from '@/composables/useBaseTable'
import useBaseTable from '@/composables/use-base-table'
import type { TableColumnType } from 'ant-design-vue'

import {
Expand All @@ -36,7 +36,8 @@

const props = defineProps<TaskProps>()
const baseTable = useBaseTable<TaskVO>(props.columns, props.tasks)
const { dataSource, columnsProp, loading, paginateProp, onChange } = baseTable
const { dataSource, columnsProp, loading, paginationProps, onChange } =
baseTable

const emits = defineEmits(['clickTask'])
const clickTask = (record: TaskVO) => {
Expand All @@ -51,7 +52,7 @@
:loading="loading"
:columns="columnsProp"
:data-source="dataSource"
:pagination="paginateProp"
:pagination="paginationProps"
@change="onChange"
>
<template #headerCell="{ column }">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const useBaseTable = <T>(
const loading = ref(false)
const dataSource = ref<T[]>(rows || [])
const columnsProp = ref<TableColumnType[]>(columns)
const paginateProp = ref<TablePaginationConfig>({
const paginationProps = ref<TablePaginationConfig>({
current: 1,
pageSize: 10,
total: dataSource.value.length,
Expand All @@ -39,17 +39,17 @@ const useBaseTable = <T>(

// merge pagination config
if (pagination) {
paginateProp.value = Object.assign(paginateProp.value, pagination)
paginationProps.value = Object.assign(paginationProps.value, pagination)
}

const onChange = (pagination: TablePaginationConfig) => {
paginateProp.value = Object.assign(paginateProp.value, pagination)
paginationProps.value = Object.assign(paginationProps.value, pagination)
}

const restState = () => {
const resetState = () => {
loading.value = false
dataSource.value = []
paginateProp.value = {
paginationProps.value = {
current: 1,
pageSize: 10,
total: dataSource.value.length || 0,
Expand All @@ -60,16 +60,16 @@ const useBaseTable = <T>(
}

onUnmounted(() => {
restState()
resetState()
})

return {
columnsProp,
dataSource,
loading,
paginateProp,
paginationProps,
onChange,
restState
resetState
}
}

Expand Down

0 comments on commit 35848b6

Please sign in to comment.