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



##########
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:
       yeah zoneid is sometimes a crucial parameter. code LGTM apart from the 
above mentioned missing stuffs




----------------------------------------------------------------
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


Reply via email to