rhtyd commented on a change in pull request #527: URL: https://github.com/apache/cloudstack-primate/pull/527#discussion_r454098973
########## File path: src/views/compute/wizard/TemplateIsoSelection.vue ########## @@ -232,6 +235,57 @@ export default { }, changeFilterType (value) { this.filterType = value + }, + getTemplatesByKeyword (keyword) { + let apiCommand = '' + let apiCommandResponse = '' + this.filteredItems = [] + const promises = [] + const templates = [] + const params = {} + const templateFilter = [ + 'featured', + 'community', + 'selfexecutable', + 'sharedexecutable' + ] + // Fetch templates or isos depending on active tab + params.zoneid = _.get(this.zone, 'id') + params.keyword = keyword + if (this.inputDecorator === 'templateid') { + apiCommand = 'listTemplates' + apiCommandResponse = 'listtemplatesresponse.template' + } else { + apiCommand = 'listIsos' + apiCommandResponse = 'listisosresponse.iso' + params.bootable = 'true' + } + // Fetch templates/isos for all filters + templateFilter.forEach(filter => { + params.templatefilter = filter + promises.push(this.fetchTemplatesIsos(apiCommand, keyword, params)) + }) + + Promise.all(promises).then(response => { + response.forEach((resItem) => { + const concatTemplates = _.concat(templates, _.get(resItem, apiCommandResponse, [])) Review comment: @ravening with latest 4.14 that is what we use reference env, templates returned are unque when the API is called with a `showunique=true` param. This will not be necessary then, also use of lodash. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org