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 13:04:18 UTC

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

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