Skip to content

Commit 5ab758d

Browse files
authored
fix: Fix the pagination issue in the historical version list (#12583)
1 parent 3a0a653 commit 5ab758d

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

  • frontend/src/views/host/file-management/code-editor/history

frontend/src/views/host/file-management/code-editor/history/index.vue

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,14 @@
100100
</div>
101101
</template>
102102

103-
<div class="table-box history-table-box">
103+
<div class="history-table-box">
104104
<div class="history-table-wrap">
105105
<ComplexTable
106106
:pagination-config="paginationConfig"
107107
:data="historyItems"
108108
v-loading="historyLoading"
109109
class="history-table"
110+
@search="loadHistoryList()"
110111
@row-click="openHistoryRecord"
111112
@selection-change="handleSelectionChange"
112113
>
@@ -247,7 +248,7 @@ const activeCollapse = ref([]);
247248
const paginationConfig = reactive({
248249
cacheSizeKey: 'file-history-page-size',
249250
currentPage: 1,
250-
pageSize: Number(localStorage.getItem('page-size')) || 20,
251+
pageSize: Number(localStorage.getItem('file-history-page-size')) || 20,
251252
total: 0,
252253
small: false,
253254
});
@@ -355,12 +356,6 @@ const syncCurrentFileContext = (history?: File.FileHistoryInfo | null) => {
355356
};
356357
};
357358
358-
const pagination = ref({
359-
currentPage: 1,
360-
pageSize: 10,
361-
total: 0,
362-
});
363-
364359
const diffContainer = ref<HTMLElement | null>(null);
365360
const emit = defineEmits(['restored']);
366361
let monacoApi: MonacoEditorApi | null = null;
@@ -485,7 +480,7 @@ const saveHistorySetting = async () => {
485480
486481
const loadHistoryList = async (resetPage = false) => {
487482
if (resetPage) {
488-
pagination.value.currentPage = 1;
483+
paginationConfig.currentPage = 1;
489484
}
490485
historyLoading.value = true;
491486
try {
@@ -497,14 +492,14 @@ const loadHistoryList = async (resetPage = false) => {
497492
historyItems.value[0]?.path ||
498493
'';
499494
const res = await searchFileHistory({
500-
page: pagination.value.currentPage,
501-
pageSize: pagination.value.pageSize,
495+
page: paginationConfig.currentPage,
496+
pageSize: paginationConfig.pageSize,
502497
path: scope.value === 'current' ? currentScopePath : '',
503498
scope: scope.value,
504499
operation: operationFilter.value,
505500
});
506501
historyItems.value = res.data.items || [];
507-
pagination.value.total = res.data.total || 0;
502+
paginationConfig.total = res.data.total || 0;
508503
if (historyItems.value.length > 0) {
509504
const existSelected = selectedHistory.value
510505
? historyItems.value.find((item) => item.id === selectedHistory.value?.id)
@@ -715,6 +710,7 @@ onBeforeUnmount(() => {
715710
display: flex;
716711
flex-direction: column;
717712
min-height: 0;
713+
padding-top: 2px;
718714
}
719715
}
720716
</style>

0 commit comments

Comments
 (0)