This is an automated email from the ASF dual-hosted git repository.
jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 165168a93 [AMORO-3206] fix the dataSource superimposed (#3208)
165168a93 is described below
commit 165168a932b80f9f5abcc664dd7ca78864ec8b79
Author: xiaomo <[email protected]>
AuthorDate: Thu Sep 19 02:32:02 2024 -0700
[AMORO-3206] fix the dataSource superimposed (#3208)
* [AMORO-3206] fix the dataSource superimposed
* [AMORO-3206] replace forEach to Map
---
amoro-web/src/views/optimize/components/List.vue | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/amoro-web/src/views/optimize/components/List.vue
b/amoro-web/src/views/optimize/components/List.vue
index cebd16a72..b66bf66c6 100644
--- a/amoro-web/src/views/optimize/components/List.vue
+++ b/amoro-web/src/views/optimize/components/List.vue
@@ -56,7 +56,7 @@ const columns = shallowReactive([
])
const pagination = reactive(usePagination())
-const dataSource = reactive<IOptimizeTableItem[]>([])
+const dataSource = ref<IOptimizeTableItem[]>([])
const optimizerGroup = ref<ILableAndValue>()
const dbSearchInput = ref<ILableAndValue>()
const tableSearchInput = ref<ILableAndValue>()
@@ -77,7 +77,6 @@ function refresh(resetPage?: boolean) {
async function getTableList() {
try {
- dataSource.length = 0
loading.value = true
const params = {
optimizerGroup: optimizerGroup.value || 'all',
@@ -88,13 +87,15 @@ async function getTableList() {
}
const result = await getOptimizerTableList(params as any)
const { list, total } = result
- pagination.total = total;
- (list || []).forEach((p: IOptimizeTableItem) => {
- p.quotaOccupationDesc = p.quotaOccupation - 0.0005 > 0 ?
`${(p.quotaOccupation * 100).toFixed(1)}%` : '0'
- p.durationDesc = p.duration ? formatMS2Time(p.duration) : '-'
- p.durationDisplay = formatMS2DisplayTime(p.duration || 0)
- p.fileSizeDesc = bytesToSize(p.fileSize)
- dataSource.push(p)
+ pagination.total = total
+ dataSource.value = (list || []).map((p: IOptimizeTableItem) => {
+ return {
+ ...p,
+ quotaOccupationDesc: p.quotaOccupation - 0.0005 > 0 ?
`${(p.quotaOccupation * 100).toFixed(1)}%` : '0',
+ durationDesc: p.duration ? formatMS2Time(p.duration) : '-',
+ durationDisplay: formatMS2DisplayTime(p.duration || 0),
+ fileSizeDesc: bytesToSize(p.fileSize),
+ }
})
}
catch (error) {