Commit 7f6a241c authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Dont calculate things that user has no access into

parent 3242ed28
......@@ -3,14 +3,9 @@ if REQUEST is not None:
raise Unauthorized
node_dict = {}
partition_dict = {}
for compute_node in compute_node_list:
reference = compute_node.getReference()
node_dict[reference] = compute_node.getAccessStatus()
partition_dict[reference] = compute_node.getComputePartitionNewsDict()
node_dict[compute_node.getReference()] = compute_node.getAccessStatus()
return {"compute_node": node_dict,
"partition": partition_dict,
"reference": context.getReference(),
"portal_type": context.getPortalType(),
"monitor_url": context.Base_getStatusMonitorUrl(compute_node_list=compute_node_list)}
"portal_type": context.getPortalType()}
base_url = 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND '
if context.getPortalType() in ["Organisation", "Computer Network"]:
if compute_node_list is None:
return ""
compute_node_reference = ",".join([ '"' + i.getReference() + '"' for i in compute_node_list])
return base_url + "aggregate_reference:(%s)" % compute_node_reference
if context.getPortalType() == "Instance Tree":
for connection_parameter in context.InstanceTree_getConnectionParameterList(raw=True):
if connection_parameter['connection_key'] == "monitor-setup-url":
......@@ -15,6 +9,3 @@ if context.getPortalType() == "Instance Tree":
if context.getPortalType() in ["Software Instance", "Slave Instance"]:
return base_url + "reference:%s" % context.getReference()
if context.getPortalType() == "Compute Node":
return base_url + "aggregate_reference:%s" % context.getReference()
......@@ -2,14 +2,4 @@ from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
def get_compute_partition_dict():
compute_node_dict = context.getAccessStatus()
compute_partition_dict = context.getComputePartitionNewsDict()
return {"compute_node": compute_node_dict,
"partition": compute_partition_dict,
"portal_type": compute_node_dict['portal_type'],
"reference": compute_node_dict['reference'],
"monitor_url": context.Base_getStatusMonitorUrl()}
return get_compute_partition_dict()
return context.getAccessStatus()
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