You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/08/10 12:50:51 UTC

[GitHub] [cloudstack] shwstppr commented on a change in pull request #5276: ui: Fetch all records in list* API and allow searching in dropdowns

shwstppr commented on a change in pull request #5276:
URL: https://github.com/apache/cloudstack/pull/5276#discussion_r685985535



##########
File path: ui/src/api/index.js
##########
@@ -29,14 +29,73 @@ export function api (command, args = {}, method = 'GET', data = {}) {
     })
   }
 
-  return axios({
-    params: {
-      ...args
-    },
-    url: '/',
-    method,
-    data: params || {}
-  })
+  const exemptedAPIs = ['listLdapConfigurations', 'listCapabilities', 'listIdps', 'listApis', 'listInfrastructure', 'listAndSwitchSamlAccount']
+
+  if ('page' in args || exemptedAPIs.includes(command) || !command.startsWith('list')) {
+    return axios({
+      params: {
+        ...args
+      },
+      url: '/',
+      method,
+      data: params || {}
+    })
+  }
+
+  const pagesize = 10
+  let page = 1
+  let items = []
+  let done = false
+  let response = null
+
+  while (!done) {
+    args.page = page
+    args.pagesize = pagesize

Review comment:
       @davidjumani do we use `default.ui.page.size` global setting in the UI?
   
   And just want to know if I have 1000 VMs in my env and I open AttachVolume form will this call listVirtualMachines API 100 times?




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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org