diff --git a/ui/src/components/page/GlobalLayout.vue b/ui/src/components/page/GlobalLayout.vue index e8e4ca2fac7..49695cbeaed 100644 --- a/ui/src/components/page/GlobalLayout.vue +++ b/ui/src/components/page/GlobalLayout.vue @@ -156,7 +156,7 @@ export default { diff --git a/ui/src/components/widgets/ListView.vue b/ui/src/components/widgets/ListView.vue index 35466e6a4ae..9c15a4544d4 100644 --- a/ui/src/components/widgets/ListView.vue +++ b/ui/src/components/widgets/ListView.vue @@ -4,9 +4,9 @@ :loading="loading" :columns="columns" :dataSource="items" - :rowKey="record => record.id" + :rowKey="record => record.id || record.name" :scroll="{ x: '100%' }" - :pagination="{ position: 'bottom', size: 'small', showSizeChanger: true }" + :pagination="false" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" :rowClassName="getRowClassName" > @@ -33,7 +33,7 @@ {{ text }} diff --git a/ui/src/locales/index.js b/ui/src/locales/index.js index b7279a79e50..c8732959fbd 100644 --- a/ui/src/locales/index.js +++ b/ui/src/locales/index.js @@ -19,5 +19,6 @@ Vue.use(VueI18n) export default new VueI18n({ locale: Vue.ls ? Vue.ls.get('current_locale') || 'en' : 'en', fallbackLocale: 'en', + silentTranslationWarn: true, messages: loadLocaleMessages() }) diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index 6c7a614e365..de459813f62 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -1,6 +1,6 @@ @@ -214,6 +225,10 @@ export default { autoRefresh: false, columns: [], items: [], + itemCount: 0, + page: 1, + pageSize: 20, + searchQuery: '', resource: {}, selectedRowKeys: [], currentAction: {}, @@ -234,6 +249,7 @@ export default { watch: { '$route' (to, from) { if (to.fullPath !== from.fullPath && !to.fullPath.includes('action/')) { + this.page = 1 this.fetchData() } }, @@ -247,7 +263,7 @@ export default { this.form = this.$form.createForm(this) }, methods: { - fetchData (search = '') { + fetchData () { this.routeName = this.$route.name if (!this.routeName) { this.routeName = this.$route.matched[this.$route.matched.length - 1].parent.name @@ -263,8 +279,8 @@ export default { Object.assign(params, this.$route.meta.params) } - if (search !== '') { - params['keyword'] = search + if (this.searchQuery !== '') { + params['keyword'] = this.searchQuery } if (this.$route && this.$route.params && this.$route.params.id) { @@ -316,6 +332,8 @@ export default { if (this.$route.params && this.$route.params.id) { params['id'] = this.$route.params.id } + params['page'] = this.page + params['pagesize'] = this.pageSize api(this.apiName, params).then(json => { this.loading = false var responseName @@ -327,7 +345,10 @@ export default { } } for (const key in json[responseName]) { - if (key === 'count') continue + if (key === 'count') { + this.itemCount = json[responseName]['count'] + continue + } objectName = key break } @@ -346,7 +367,8 @@ export default { }) }, onSearch (value) { - this.fetchData(value) + this.searchQuery = value + this.fetchData() }, toggleAutoRefresh () { this.autoRefresh = !this.autoRefresh @@ -506,6 +528,16 @@ export default { } }) }, + changePage (page, pageSize) { + this.page = page + this.pageSize = pageSize + this.fetchData() + }, + changePageSize (currentPage, pageSize) { + this.page = currentPage + this.pageSize = pageSize + this.fetchData() + }, start () { this.loading = true this.fetchData() @@ -518,18 +550,25 @@ export default { } -