Skip to content

Commit

Permalink
fix: duplicate table pagination UI (AutomaApp#1454)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kholid060 committed Oct 17, 2023
1 parent df7036b commit 73bb2a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 48 deletions.
1 change: 1 addition & 0 deletions src/components/newtab/logs/LogsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
/>
<ui-table
v-show="state.activeTab === 'table'"
with-pagination
:headers="tableData.header"
:items="tableData.body"
:search="state.query"
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/UiTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const props = defineProps({
},
withPagination: {
type: Boolean,
default: true,
default: false,
},
});
Expand Down
50 changes: 3 additions & 47 deletions src/newtab/pages/storage/Tables.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@
</div>
<div class="scroll w-full overflow-x-auto">
<ui-table
with-pagination
:headers="table.header"
:items="rows"
:items="table.body"
:search="state.query"
item-key="id"
class="w-full"
Expand All @@ -72,33 +73,6 @@
</template>
</ui-table>
</div>
<div
v-if="table.body && table.body.length >= 10"
class="mt-4 flex flex-col md:flex-row md:items-center md:justify-between"
>
<div class="mb-4 md:mb-0">
{{ t('components.pagination.text1') }}
<select v-model="pagination.perPage" class="bg-input rounded-md p-1">
<option
v-for="num in [10, 15, 25, 50, 100, 150]"
:key="num"
:value="num"
>
{{ num }}
</option>
</select>
{{
t('components.pagination.text2', {
count: table.body.length,
})
}}
</div>
<ui-pagination
v-model="pagination.currentPage"
:per-page="pagination.perPage"
:records="table.body.length"
/>
</div>
<storage-edit-table
v-model="editState.show"
:name="editState.name"
Expand All @@ -108,14 +82,7 @@
</div>
</template>
<script setup>
import {
watch,
shallowRef,
shallowReactive,
computed,
toRaw,
triggerRef,
} from 'vue';
import { watch, shallowRef, shallowReactive, toRaw, triggerRef } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useWorkflowStore } from '@/stores/workflow';
Expand Down Expand Up @@ -154,17 +121,6 @@ const editState = shallowReactive({
columns: [],
show: false,
});
const pagination = shallowReactive({
perPage: 10,
currentPage: 1,
});
const rows = computed(() =>
table.value.body.slice(
(pagination.currentPage - 1) * pagination.perPage,
pagination.currentPage * pagination.perPage
)
);
function editTable() {
editState.name = tableDetail.value.name;
Expand Down

0 comments on commit 73bb2a5

Please sign in to comment.