Commit 91ae216b authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Filter list to not display closed/destroy/invalidated ones.

   Filter Computer, Hosting Subscription and Computer Network to not display closed/destroy/invalidated ones.
parent fb5b7245
......@@ -6,5 +6,17 @@ from DateTime import DateTime
kw = {"node_uid": context.getUid(),
"at_date": DateTime()}
def filter_per_portal_type(document):
if document.getPortalType() == "Computer" \
and document.getAllocationScope() != "close/forever":
return document
elif document.getPortalType() == "Hosting Subscription" \
and document.getSlapState() != "destroy_requested":
return document
elif document.getPortalType() == "Computer Network" \
and document.getValidationState() == "validated":
return document
return [ i.getObject()
for i in context.portal_simulation.getCurrentTrackingList(**kw)]
for i in context.portal_simulation.getCurrentTrackingList(**kw)
if filter_per_portal_type(i.getObject())]
......@@ -5,5 +5,17 @@ from DateTime import DateTime
kw = {"project_uid": context.getUid(),
"at_date": DateTime()}
def filter_per_portal_type(document):
if document.getPortalType() == "Computer" \
and document.getAllocationScope() != "close/forever":
return document
elif document.getPortalType() == "Hosting Subscription" \
and document.getSlapState() != "destroy_requested":
return document
elif document.getPortalType() == "Computer Network" \
and document.getValidationState() == "validated":
return document
return [ i.getObject()
for i in context.portal_simulation.getCurrentTrackingList(**kw)]
for i in context.portal_simulation.getCurrentTrackingList(**kw)
if filter_per_portal_type(i.getObject())]
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