From b9d9f556572ab6e709775b9ea08c3e0a97a0175e Mon Sep 17 00:00:00 2001 From: lishutong Date: Mon, 19 Jul 2021 18:39:40 +0000 Subject: [PATCH] Fix a bug in build library: the uploaded file cannot be shown in table. Previously, the newly uploaded file cannot be shown immediately in the datatable, unless refresh the page. Now the bug is fixed. Similar bug is also fixed in OTAJobTable.vue. Test: mannual tested. Change-Id: Ia0531db884a7e1675b2cf51aeb8ca0847694c63c --- tools/otagui/src/components/BuildTable.vue | 17 ++++++++++++++--- tools/otagui/src/components/OTAJobTable.vue | 17 ++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/tools/otagui/src/components/BuildTable.vue b/tools/otagui/src/components/BuildTable.vue index d04662dbb..a4a642dac 100644 --- a/tools/otagui/src/components/BuildTable.vue +++ b/tools/otagui/src/components/BuildTable.vue @@ -5,7 +5,7 @@ :is-loading="isLoading" :rows="rows" :sortable="sortable" - :total="total" + :total="tableLength" @do-search="doSearch" /> @@ -67,9 +67,21 @@ export default { total: 0 } }, + computed: { + tableLength() { + return this.builds.length + } + }, + watch: { + builds: { + handler: function() { + this.rows = TableSort(this.builds, this.sortable.order, this.sortable.sort, 0, 10) + }, + deep: true + } + }, created() { this.rows = TableSort(this.builds, this.sortable.order, this.sortable.sort, 0, 10) - this.total = this.builds.length }, methods: { doSearch(offset, limit, order, sort) { @@ -77,7 +89,6 @@ export default { this.sortable.order = order this.sortable.sort = sort this.rows = TableSort(this.builds, order, sort, offset, limit) - this.total = this.builds.length this.isLoading = false } } diff --git a/tools/otagui/src/components/OTAJobTable.vue b/tools/otagui/src/components/OTAJobTable.vue index cad9bfc1e..6e96d3d3e 100644 --- a/tools/otagui/src/components/OTAJobTable.vue +++ b/tools/otagui/src/components/OTAJobTable.vue @@ -5,7 +5,7 @@ :is-loading="isLoading" :rows="rows" :sortable="sortable" - :total="total" + :total="tableLength" @do-search="doSearch" /> @@ -82,9 +82,21 @@ export default { total: 0 } }, + computed: { + tableLength() { + return this.jobs.length + }, + }, + watch: { + jobs: { + handler: function() { + this.rows = TableSort(this.jobs, this.sortable.order, this.sortable.sort, 0, 10) + }, + deep: true + } + }, created() { this.rows = TableSort(this.jobs, this.sortable.order, this.sortable.sort, 0, 10) - this.total = this.jobs.length }, methods: { doSearch(offset, limit, order, sort) { @@ -92,7 +104,6 @@ export default { this.sortable.order = order this.sortable.sort = sort this.rows = TableSort(this.jobs, order, sort, offset, limit) - this.total = this.jobs.length this.isLoading = false } }