Commit b27d537e authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: use portal_catalog to be complaint with listbox pagination

See merge request !528
parents 74ce8553 0df7e6f4
Pipeline #28040 failed with stage
in 0 seconds
# This script might not be efficient to a large quantities of # This script might not be efficient to a large quantities of
# Compute Nodes # Compute Nodes
portal = context.getPortalObject()
from DateTime import DateTime
kw = {"node_uid": context.getUid(),
"at_date": DateTime()}
def filter_per_portal_type(document): def filter_per_portal_type(document):
if document.getPortalType() == "Compute Node" \ if document.getPortalType() == "Compute Node" \
...@@ -17,6 +13,11 @@ def filter_per_portal_type(document): ...@@ -17,6 +13,11 @@ def filter_per_portal_type(document):
and document.getValidationState() == "validated": and document.getValidationState() == "validated":
return document return document
return [ i.getObject() uid_list = [i.uid for i in context.portal_simulation.getCurrentTrackingList(
for i in context.portal_simulation.getCurrentTrackingList(**kw) node_uid=context.getUid(), at_date=DateTime())
if filter_per_portal_type(i.getObject())] if filter_per_portal_type(i.getObject())]
if not uid_list:
return []
return portal.portal_catalog(uid=uid_list, **kw)
# This script might not be efficient to a large quantities of # This script might not be efficient to a large quantities of
# Compute Nodes # Compute Nodes
from DateTime import DateTime portal = context.getPortalObject()
kw = {"project_uid": context.getUid(),
"at_date": DateTime()}
def filter_per_portal_type(document): def filter_per_portal_type(document):
if document.getPortalType() == "Compute Node" \ if document.getPortalType() == "Compute Node" \
...@@ -16,6 +13,11 @@ def filter_per_portal_type(document): ...@@ -16,6 +13,11 @@ def filter_per_portal_type(document):
and document.getValidationState() == "validated": and document.getValidationState() == "validated":
return document return document
return [ i.getObject() uid_list = [i.uid for i in context.portal_simulation.getCurrentTrackingList(
for i in context.portal_simulation.getCurrentTrackingList(**kw) project_uid=context.getUid(), at_date=DateTime())
if filter_per_portal_type(i.getObject())] if filter_per_portal_type(i.getObject())]
if not uid_list:
return []
return portal.portal_catalog(uid=uid_list, **kw)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment