You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/07/15 15:22:50 UTC

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

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:
users@infra.apache.org