[GitHub] [cloudstack-primate] davidjumani commented on a change in pull request #543: Fix template search

2020-07-15 Thread GitBox


davidjumani commented on a change in pull request #543:
URL: https://github.com/apache/cloudstack-primate/pull/543#discussion_r455058969



##
File path: src/views/compute/wizard/TemplateIsoSelection.vue
##
@@ -232,6 +236,60 @@ 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
+  params.showunique = true
+  if (this.inputDecorator === 'templateid') {
+apiCommand = 'listTemplates'
+apiCommandResponse = 'listtemplatesresponse.template'
+  } else {
+apiCommand = 'listIsos'
+apiCommandResponse = 'listisosresponse.iso'
+params.bootable = 'true'
+  }
+  this.isLoading = 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:
   Also zoneid doesn't get passed, need to address that too but preferably 
in another PR where we move the search functionality to DeployVM like other 
view do





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




[GitHub] [cloudstack-primate] davidjumani commented on a change in pull request #543: Fix template search

2020-07-15 Thread GitBox


davidjumani commented on a change in pull request #543:
URL: https://github.com/apache/cloudstack-primate/pull/543#discussion_r455034076



##
File path: src/views/compute/wizard/TemplateIsoSelection.vue
##
@@ -232,6 +236,60 @@ 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
+  params.showunique = true
+  if (this.inputDecorator === 'templateid') {
+apiCommand = 'listTemplates'
+apiCommandResponse = 'listtemplatesresponse.template'
+  } else {
+apiCommand = 'listIsos'
+apiCommandResponse = 'listisosresponse.iso'
+params.bootable = 'true'
+  }
+  this.isLoading = 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:
   @rhtyd @ravening Keeping it this way to not introduce too many changes, 
but since we're getting the API response per filter, we can set the datasource 
here itself. Would also need changes in DeployVM





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