diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue index f4071c8fc32..80340949f09 100644 --- a/ui/src/views/compute/DeployVM.vue +++ b/ui/src/views/compute/DeployVM.vue @@ -1511,17 +1511,17 @@ export default { }) }, fetchIsos (isoFilter, params) { - params = params || {} - if (params.keyword || params.category !== isoFilter) { - params.page = 1 - params.pageSize = params.pageSize || 10 + const args = Object.assign({}, params) + if (args.keyword || args.category !== isoFilter) { + args.page = 1 + args.pageSize = args.pageSize || 10 } - params.zoneid = _.get(this.zone, 'id') - params.isoFilter = isoFilter - params.bootable = true + args.zoneid = _.get(this.zone, 'id') + args.isoFilter = isoFilter + args.bootable = true return new Promise((resolve, reject) => { - api('listIsos', params).then((response) => { + api('listIsos', args).then((response) => { resolve(response) }).catch((reason) => { // ToDo: Handle errors diff --git a/ui/src/views/compute/wizard/TemplateIsoSelection.vue b/ui/src/views/compute/wizard/TemplateIsoSelection.vue index b9de394db54..b45761bfd5b 100644 --- a/ui/src/views/compute/wizard/TemplateIsoSelection.vue +++ b/ui/src/views/compute/wizard/TemplateIsoSelection.vue @@ -20,7 +20,6 @@ @@ -42,7 +41,7 @@ :selected="checkedValue" :preFillContent="preFillContent" @emit-update-template-iso="updateTemplateIso" - @handle-search-filter="($event) => emitSearchFilter($event)" + @handle-search-filter="($event) => eventPagination($event)" > @@ -95,7 +94,8 @@ export default { id: 'sharedexecutable', name: 'label.sharedexecutable' }], - filterType: 'featured' + filterType: 'featured', + pagination: false } }, watch: { @@ -104,6 +104,9 @@ export default { const key = this.inputDecorator.slice(0, -2) for (const filter of this.filterOpts) { if (items[filter.id] && items[filter.id][key] && items[filter.id][key].length > 0) { + if (!this.pagination) { + this.filterType = filter.id + } this.checkedValue = items[filter.id][key][0].id break } @@ -112,7 +115,6 @@ export default { inputDecorator (newValue, oldValue) { if (newValue !== oldValue) { this.filter = '' - this.filterType = 'featured' } } }, @@ -125,6 +127,10 @@ export default { this.$emit('update-template-iso', name, id) }, handleSearch (value) { + if (!this.filter && !value) { + return + } + this.pagination = false this.filter = value const options = { page: 1, @@ -133,6 +139,10 @@ export default { } this.emitSearchFilter(options) }, + eventPagination (options) { + this.pagination = true + this.emitSearchFilter(options) + }, emitSearchFilter (options) { options.category = this.filterType this.$emit('handle-search-filter', options)