mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
fixes isos pagination & search template/isos
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
d4ebf4c7be
commit
c8255adeed
@ -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
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
<a-input-search
|
||||
class="search-input"
|
||||
:placeholder="$t('label.search')"
|
||||
v-model="filter"
|
||||
@search="handleSearch">
|
||||
</a-input-search>
|
||||
<a-spin :spinning="loading">
|
||||
@ -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)"
|
||||
></TemplateIsoRadioGroup>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user