Commit 87c2783b authored by Rafael Monnerat's avatar Rafael Monnerat

Remove massive computer partition status calculation

See merge request !550
parents cd8cff8f a23b5ca0
...@@ -131,10 +131,6 @@ class SlapOSComputeNodeMixin(object): ...@@ -131,10 +131,6 @@ class SlapOSComputeNodeMixin(object):
# called on site # called on site
pass pass
# Also update cache for News Dict, so it speed up access of this UI.
key = '%s_partition_news' % self.getReference()
self._getCachedComputePartitionNewsDict(key, refresh_etag)
def _calculateRefreshEtag(self): def _calculateRefreshEtag(self):
# check max indexation timestamp # check max indexation timestamp
# it is unlikely to get an empty catalog # it is unlikely to get an empty catalog
...@@ -333,62 +329,4 @@ class SlapOSComputeNodeMixin(object): ...@@ -333,62 +329,4 @@ class SlapOSComputeNodeMixin(object):
raise ValueError('Wrong list of software releases on %r: %s' % ( raise ValueError('Wrong list of software releases on %r: %s' % (
self.getReference(), ', '.join([q.getRelativeUrl() for q \ self.getReference(), ', '.join([q.getRelativeUrl() for q \
in software_installation_list]) in software_installation_list])
)) ))
\ No newline at end of file
def getComputePartitionNewsDict(self):
key = '%s_partition_news' % self.getReference()
cache_plugin = self._getCachePlugin()
refresh_etag = self._calculateRefreshEtag()
try:
entry = cache_plugin.get(key, DEFAULT_CACHE_SCOPE)
except KeyError:
entry = None
if entry is not None and isinstance(entry.getValue(), dict):
cached_dict = entry.getValue()
cached_etag = cached_dict.get('refresh_etag', None)
if (refresh_etag != cached_etag):
return self._getCachedComputePartitionNewsDict(key, refresh_etag)
else:
return cached_dict.get('data')
return self._getCachedComputePartitionNewsDict(key, refresh_etag)
def _getCachedComputePartitionNewsDict(self, key, refresh_etag):
unrestrictedSearchResults = self.getPortalObject().portal_catalog.unrestrictedSearchResults
compute_partition_uid_list = [x.uid for x in unrestrictedSearchResults(
parent_uid=self.getUid(),
validation_state="validated",
portal_type="Compute Partition")]
software_instance_list = unrestrictedSearchResults(
portal_type="Software Instance",
default_aggregate_uid=compute_partition_uid_list,
validation_state="validated",
group_by_list=['default_aggregate_uid'],
select_list=['default_aggregate_uid', 'default_aggregate_title']
)
compute_partition_dict = { }
for software_instance in software_instance_list:
compute_partition_dict[software_instance.default_aggregate_title] = software_instance.getAccessStatus()
try:
self._getCachePlugin().set(key, DEFAULT_CACHE_SCOPE,
dict (
time=time.time(),
refresh_etag=refresh_etag,
data=compute_partition_dict
),
cache_duration=self.getPortalObject().portal_caches\
.getRamCacheRoot().get('compute_node_information_cache_factory'\
).cache_duration
)
except (Unauthorized, IndexError):
# XXX: Unauthorized hack. Race condition of not ready setup delivery which provides
# security information shall not make this method fail, as it will be
# called later anyway
# Note: IndexError ignored, as it happend in case if full reindex is
# called on site
pass
return compute_partition_dict
\ No newline at end of file
...@@ -16,12 +16,8 @@ ...@@ -16,12 +16,8 @@
clear: left; clear: left;
} }
.ui-block-50 { .ui-block {
width: 50% !important; width: 100%
}
.ui-btn-hide {
display: none !important;
} }
.ui-bar { .ui-bar {
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1001.40386.24679.24320</string> </value> <value> <string>1009.35848.48037.15820</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1658172898.38</float> <float>1688482381.84</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -14,15 +14,10 @@ ...@@ -14,15 +14,10 @@
</head> </head>
<body> <body>
<div class="ui-block-a ui-block-50 main-status"> <div class="ui-block-a ui-block main-status">
<div class="ui-bar ui-corner-all first-child ui-btn-no-data"> <div class="ui-bar ui-corner-all first-child ui-btn-no-data">
<a class="ui-btn ui-btn-icon-left ui-icon-spinner ui-btn-color-white"> Node </a> <a class="ui-btn ui-btn-icon-left ui-icon-spinner ui-btn-color-white"> Node </a>
</div> </div>
</div> </div>
<div class="ui-block-c ui-block-50 sub-status">
<div class="ui-bar ui-corner-all first-child ui-btn-no-data">
<a class="ui-btn ui-btn-icon-left ui-icon-spinner ui-btn-color-white"> Partitions </a>
</div>
</div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -282,7 +282,7 @@ ...@@ -282,7 +282,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1001.26171.19762.42854</string> </value> <value> <string>1009.35843.10522.38024</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -302,7 +302,7 @@ ...@@ -302,7 +302,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1657906237.75</float> <float>1688481140.05</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -77,42 +77,6 @@ ...@@ -77,42 +77,6 @@
return 'ui-btn-error'; return 'ui-btn-error';
} }
function getComputePartitionStatus(options) {
var message,
compute_partition,
partition_class = 'ui-btn-ok',
error_amount = 0,
total_amount = 0;
if (!options) {
return 'ui-btn-no-data';
}
for (compute_partition in options) {
if (options.hasOwnProperty(compute_partition) &&
options[compute_partition].text) {
message = options[compute_partition].text;
if (message.startsWith("#error")) {
partition_class = 'ui-btn-warning';
error_amount += 1;
}
total_amount += 1;
if ((error_amount > 0) && (error_amount < total_amount)) {
// No need to continue the result will be a warnning
return partition_class;
}
}
}
if (!total_amount) {
return 'ui-btn-no-data';
}
if (error_amount === total_amount) {
return 'ui-btn-error';
}
return partition_class;
}
function getSoftwareInstallationStatus(options) { function getSoftwareInstallationStatus(options) {
if ((!options) || (options && !options.text)) { if ((!options) || (options && !options.text)) {
return 'ui-btn-no-data'; return 'ui-btn-no-data';
...@@ -163,81 +127,26 @@ ...@@ -163,81 +127,26 @@
return status; return status;
} }
function getComputePartitionStatusList(options) {
var compute_node_reference,
status = 'ui-btn-no-data',
previous_status = "START";
for (compute_node_reference in options.partition) {
if (options.partition.hasOwnProperty(compute_node_reference)) {
status = getComputePartitionStatus(
options.partition[compute_node_reference]
);
if (previous_status === "START") {
previous_status = status;
}
if (status === 'ui-btn-warning') {
// XXX Drop warning
return status;
}
if (previous_status !== status) {
if ((previous_status === 'ui-btn-error') &&
(status === 'ui-btn-ok')) {
return 'ui-btn-warning';
}
if ((status === 'ui-btn-error') &&
(previous_status === 'ui-btn-ok')) {
return 'ui-btn-warning';
}
if (status === 'ui-btn-no-data') {
status = previous_status;
}
}
}
}
return status;
}
function getStatus(gadget, result) { function getStatus(gadget, result) {
var i, status_class = 'ui-btn-no-data', var status_class = 'ui-btn-no-data',
right_class = 'ui-btn-no-data',
main_status_div = gadget.element.querySelector(".main-status"), main_status_div = gadget.element.querySelector(".main-status"),
sub_status_div = gadget.element.querySelector(".sub-status"),
monitor_url = '', monitor_url = '',
main_link_configuration_dict = { main_link_configuration_dict = {
class: "ui-btn ui-btn-icon-left ui-icon-desktop" class: "ui-btn ui-btn-icon-left ui-icon-desktop"
},
sub_link_configuration_dict = {
class: "ui-btn ui-btn-icon-left ui-icon-desktop"
}; };
if (result && result.monitor_url) { if (result && result.monitor_url) {
monitor_url = result.monitor_url monitor_url = result.monitor_url;
} }
if (result && result.portal_type && result.portal_type === "Compute Node") { if (result && result.portal_type && result.portal_type === "Compute Node") {
main_link_configuration_dict.href = monitor_url;
main_link_configuration_dict.target = "_target";
main_link_configuration_dict.text = 'Node'; main_link_configuration_dict.text = 'Node';
sub_link_configuration_dict.href = monitor_url; main_link_configuration_dict.class = "ui-btn ui-btn-icon-left";
sub_link_configuration_dict.target = "_target"; status_class = getComputeNodeStatus(result);
sub_link_configuration_dict.text = 'Partitions';
if (result && result.compute_node) {
status_class = getComputeNodeStatus(result.compute_node);
}
if ((status_class === 'ui-btn-error') ||
(status_class === 'ui-btn-no-data')) {
right_class = status_class;
} else {
if (result && result.partition) {
right_class = getComputePartitionStatus(result.partition);
}
}
} else if (result && result.portal_type && } else if (result && result.portal_type &&
result.portal_type === "Software Installation") { result.portal_type === "Software Installation") {
status_class = getSoftwareInstallationStatus(result); status_class = getSoftwareInstallationStatus(result);
main_link_configuration_dict.text = "Installation"; main_link_configuration_dict.text = "Installation";
right_class = "ui-btn-hide";
if (status_class === "ui-btn-is-building") { if (status_class === "ui-btn-is-building") {
main_link_configuration_dict.text = "Building"; main_link_configuration_dict.text = "Building";
status_class = "ui-btn-no-data"; status_class = "ui-btn-no-data";
...@@ -252,7 +161,6 @@ ...@@ -252,7 +161,6 @@
result.portal_type === "Slave Instance" result.portal_type === "Slave Instance"
)) { )) {
status_class = getInstanceStatus(result); status_class = getInstanceStatus(result);
right_class = "ui-btn-hide";
if (status_class === 'ui-btn-is-slave') { if (status_class === 'ui-btn-is-slave') {
status_class = 'ui-btn-color-white'; status_class = 'ui-btn-color-white';
main_link_configuration_dict.text = 'Slave'; main_link_configuration_dict.text = 'Slave';
...@@ -274,7 +182,6 @@ ...@@ -274,7 +182,6 @@
result.portal_type === "Instance Tree") { result.portal_type === "Instance Tree") {
status_class = getInstanceTreeStatus(result); status_class = getInstanceTreeStatus(result);
// it should verify if the monitor-base-url is ready. // it should verify if the monitor-base-url is ready.
right_class = "ui-btn-hide";
if (status_class === 'ui-btn-is-slave') { if (status_class === 'ui-btn-is-slave') {
status_class = 'ui-btn-color-white'; status_class = 'ui-btn-color-white';
main_link_configuration_dict.text = 'Slave Only'; main_link_configuration_dict.text = 'Slave Only';
...@@ -293,40 +200,18 @@ ...@@ -293,40 +200,18 @@
main_link_configuration_dict.text = 'Instance'; main_link_configuration_dict.text = 'Instance';
} }
} else { } else {
main_link_configuration_dict.href = monitor_url;
main_link_configuration_dict.target = "_target";
main_link_configuration_dict.text = 'Node'; main_link_configuration_dict.text = 'Node';
sub_link_configuration_dict.href = monitor_url; main_link_configuration_dict.class = "ui-btn ui-btn-icon-left";
sub_link_configuration_dict.target = "_target";
sub_link_configuration_dict.text = 'Partitions';
status_class = getComputeNodeStatusList(result); status_class = getComputeNodeStatusList(result);
if ((status_class === 'ui-btn-error') ||
(status_class === 'ui-btn-no-data')) {
right_class = status_class;
} else {
right_class = getComputePartitionStatusList(result);
}
} }
main_link_configuration_dict.text = ' ' + main_link_configuration_dict.text; main_link_configuration_dict.text = ' ' + main_link_configuration_dict.text;
sub_link_configuration_dict.text = ' ' + sub_link_configuration_dict.text;
domsugar(main_status_div.querySelector('div'), domsugar(main_status_div.querySelector('div'),
{ {
class: "ui-bar ui-corner-all first-child " + status_class class: "ui-bar ui-corner-all first-child " + status_class
}, [ }, [
domsugar("a", main_link_configuration_dict) domsugar("a", main_link_configuration_dict)
]); ]);
domsugar(sub_status_div.querySelector('div'),
{
class: "ui-bar ui-corner-all last-child " + right_class
}, [
domsugar("a", sub_link_configuration_dict)
]);
if (right_class === 'ui-btn-hide') {
// expand main button to use the space
main_status_div.className = "ui-block-a ui-block main-status";
}
return gadget; return gadget;
} }
...@@ -338,7 +223,8 @@ ...@@ -338,7 +223,8 @@
.onLoop(function () { .onLoop(function () {
var gadget = this; var gadget = this;
if (typeof gadget.state.jio_key === 'string' && gadget.state.jio_key !== '') { if (typeof gadget.state.jio_key === 'string' &&
gadget.state.jio_key !== '') {
return gadget.jio_get(gadget.state.jio_key) return gadget.jio_get(gadget.state.jio_key)
.push(function (result) { .push(function (result) {
var state_dict = result.news || {}; var state_dict = result.news || {};
......
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1006.58340.40727.23620</string> </value> <value> <string>1009.34688.1170.33860</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1680031759.77</float> <float>1688481138.46</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -3,14 +3,9 @@ if REQUEST is not None: ...@@ -3,14 +3,9 @@ if REQUEST is not None:
raise Unauthorized raise Unauthorized
node_dict = {} node_dict = {}
partition_dict = {}
for compute_node in compute_node_list: for compute_node in compute_node_list:
reference = compute_node.getReference() node_dict[compute_node.getReference()] = compute_node.getAccessStatus()
node_dict[reference] = compute_node.getAccessStatus()
partition_dict[reference] = compute_node.getComputePartitionNewsDict()
return {"compute_node": node_dict, return {"compute_node": node_dict,
"partition": partition_dict,
"reference": context.getReference(), "reference": context.getReference(),
"portal_type": context.getPortalType(), "portal_type": context.getPortalType()}
"monitor_url": context.Base_getStatusMonitorUrl(compute_node_list=compute_node_list)}
base_url = 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND ' 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": if context.getPortalType() == "Instance Tree":
for connection_parameter in context.InstanceTree_getConnectionParameterList(raw=True): for connection_parameter in context.InstanceTree_getConnectionParameterList(raw=True):
if connection_parameter['connection_key'] == "monitor-setup-url": if connection_parameter['connection_key'] == "monitor-setup-url":
...@@ -15,6 +9,3 @@ if context.getPortalType() == "Instance Tree": ...@@ -15,6 +9,3 @@ if context.getPortalType() == "Instance Tree":
if context.getPortalType() in ["Software Instance", "Slave Instance"]: if context.getPortalType() in ["Software Instance", "Slave Instance"]:
return base_url + "reference:%s" % context.getReference() 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 ...@@ -2,14 +2,4 @@ from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
def get_compute_partition_dict(): return context.getAccessStatus()
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()
...@@ -470,9 +470,7 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -470,9 +470,7 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
compute_node = self._makeComputeNode() compute_node = self._makeComputeNode()
self._logFakeAccess(compute_node) self._logFakeAccess(compute_node)
news_dict = compute_node.ComputeNode_getNewsDict() news_dict = compute_node.ComputeNode_getNewsDict()
monitor_url = 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:%s' % (compute_node.getReference()) expected_news_dict = {'created_at': self.created_at,
expected_news_dict = {'compute_node':
{'created_at': self.created_at,
'no_data_since_15_minutes': 0, 'no_data_since_15_minutes': 0,
'no_data_since_5_minutes': 0, 'no_data_since_5_minutes': 0,
'portal_type': compute_node.getPortalType(), 'portal_type': compute_node.getPortalType(),
...@@ -480,12 +478,7 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -480,12 +478,7 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
'since': self.created_at, 'since': self.created_at,
'state': 'start_requested', 'state': 'start_requested',
'text': '#access OK', 'text': '#access OK',
'user': 'SlapOS Master'}, 'user': 'SlapOS Master'}
'partition': {},
'portal_type': compute_node.getPortalType(),
'reference': compute_node.getReference(),
'monitor_url': monitor_url
}
self.assertEqual(_decode_with_json(news_dict), self.assertEqual(_decode_with_json(news_dict),
_decode_with_json(expected_news_dict)) _decode_with_json(expected_news_dict))
self.tic() self.tic()
...@@ -500,10 +493,8 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -500,10 +493,8 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
state='stop_requested') state='stop_requested')
news_dict = compute_node.ComputeNode_getNewsDict() news_dict = compute_node.ComputeNode_getNewsDict()
compute_node.getSlapState = fakeStopRequestedSlapState compute_node.getSlapState = fakeStopRequestedSlapState
monitor_url = 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:%s' % (compute_node.getReference())
expected_news_dict = {'compute_node': expected_news_dict = {'created_at': self.created_at,
{'created_at': self.created_at,
'no_data_since_15_minutes': 0, 'no_data_since_15_minutes': 0,
'no_data_since_5_minutes': 0, 'no_data_since_5_minutes': 0,
'portal_type': compute_node.getPortalType(), 'portal_type': compute_node.getPortalType(),
...@@ -511,11 +502,7 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -511,11 +502,7 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
'since': self.created_at, 'since': self.created_at,
'state': 'stop_requested', 'state': 'stop_requested',
'text': '#access OK', 'text': '#access OK',
'user': 'SlapOS Master'}, 'user': 'SlapOS Master'
'partition': {},
'portal_type': compute_node.getPortalType(),
'reference': compute_node.getReference(),
'monitor_url': monitor_url
} }
self.assertEqual(_decode_with_json(news_dict), self.assertEqual(_decode_with_json(news_dict),
_decode_with_json(expected_news_dict)) _decode_with_json(expected_news_dict))
...@@ -531,10 +518,8 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -531,10 +518,8 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
state='destroy_requested') state='destroy_requested')
news_dict = compute_node.ComputeNode_getNewsDict() news_dict = compute_node.ComputeNode_getNewsDict()
compute_node.getSlapState = fakeDestroyRequestedSlapState compute_node.getSlapState = fakeDestroyRequestedSlapState
monitor_url = 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:%s' % (compute_node.getReference())
expected_news_dict = {'compute_node': expected_news_dict = {'created_at': self.created_at,
{'created_at': self.created_at,
'no_data_since_15_minutes': 0, 'no_data_since_15_minutes': 0,
'no_data_since_5_minutes': 0, 'no_data_since_5_minutes': 0,
'portal_type': compute_node.getPortalType(), 'portal_type': compute_node.getPortalType(),
...@@ -542,11 +527,7 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -542,11 +527,7 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
'since': self.created_at, 'since': self.created_at,
'state': 'destroy_requested', 'state': 'destroy_requested',
'text': '#access OK', 'text': '#access OK',
'user': 'SlapOS Master'}, 'user': 'SlapOS Master'
'partition': {},
'portal_type': compute_node.getPortalType(),
'reference': compute_node.getReference(),
'monitor_url': monitor_url
} }
self.assertEqual(_decode_with_json(news_dict), self.assertEqual(_decode_with_json(news_dict),
_decode_with_json(expected_news_dict)) _decode_with_json(expected_news_dict))
...@@ -559,20 +540,14 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -559,20 +540,14 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
def test_no_data(self): def test_no_data(self):
compute_node = self._makeComputeNode() compute_node = self._makeComputeNode()
news_dict = compute_node.ComputeNode_getNewsDict() news_dict = compute_node.ComputeNode_getNewsDict()
monitor_url = 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:%s' % (compute_node.getReference()) expected_news_dict = {'created_at': self.created_at,
expected_news_dict = {'compute_node': 'no_data': 1,
{'created_at': self.created_at,
'no_data': 1,
'portal_type': compute_node.getPortalType(),
'reference': compute_node.getReference(),
'since': self.created_at,
'state': '',
'text': '#error no data found for %s' % compute_node.getReference(),
'user': 'SlapOS Master'},
'partition': {},
'portal_type': compute_node.getPortalType(), 'portal_type': compute_node.getPortalType(),
'reference': compute_node.getReference(), 'reference': compute_node.getReference(),
'monitor_url': monitor_url 'since': self.created_at,
'state': '',
'text': '#error no data found for %s' % compute_node.getReference(),
'user': 'SlapOS Master'
} }
self.assertEqual(_decode_with_json(news_dict), self.assertEqual(_decode_with_json(news_dict),
_decode_with_json(expected_news_dict)) _decode_with_json(expected_news_dict))
...@@ -586,32 +561,19 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -586,32 +561,19 @@ class TestComputeNode_getNewsDict(TestSlapOSHalJsonStyleMixin):
compute_node = self._makeComputeNode() compute_node = self._makeComputeNode()
instance = self._makeInstance() instance = self._makeInstance()
instance.setAggregateValue(self.partition0) instance.setAggregateValue(self.partition0)
monitor_url = 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:%s' % (compute_node.getReference())
self.tic() self.tic()
self._logFakeAccess(compute_node) self._logFakeAccess(compute_node)
news_dict = compute_node.ComputeNode_getNewsDict() news_dict = compute_node.ComputeNode_getNewsDict()
expected_news_dict = {'compute_node': expected_news_dict = {u'created_at': u'%s' % self.created_at,
{u'created_at': u'%s' % self.created_at, 'no_data_since_15_minutes': 0,
'no_data_since_15_minutes': 0, 'no_data_since_5_minutes': 0,
'no_data_since_5_minutes': 0,
'portal_type': compute_node.getPortalType(),
'reference': compute_node.getReference(),
u'since': u'%s' % self.created_at,
u'state': u'start_requested',
u'text': u'#access OK',
u'user': u'SlapOS Master'},
'partition': {self.partition0.getReference(): {'created_at': self.created_at,
'no_data': 1,
'portal_type': instance.getPortalType(),
'reference': instance.getReference(),
'since': self.created_at,
'state': '',
'text': '#error no data found for %s' % (instance.getReference()),
'user': 'SlapOS Master'}},
'portal_type': compute_node.getPortalType(), 'portal_type': compute_node.getPortalType(),
'reference': compute_node.getReference(), 'reference': compute_node.getReference(),
'monitor_url': monitor_url u'since': u'%s' % self.created_at,
u'state': u'start_requested',
u'text': u'#access OK',
u'user': u'SlapOS Master'
} }
self.assertEqual(_decode_with_json(news_dict), self.assertEqual(_decode_with_json(news_dict),
_decode_with_json(expected_news_dict)) _decode_with_json(expected_news_dict))
...@@ -634,7 +596,7 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -634,7 +596,7 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin):
self.tic() self.tic()
self._logFakeAccess(compute_node) self._logFakeAccess(compute_node)
news_dict = network.ComputerNetwork_getNewsDict() news_dict = network.ComputerNetwork_getNewsDict()
expected_news_dict = {'compute_node': expected_news_dict = {'compute_node': (
{ compute_node.getReference(): { compute_node.getReference():
{u'created_at': u'%s' % self.created_at, {u'created_at': u'%s' % self.created_at,
'no_data_since_15_minutes': 0, 'no_data_since_15_minutes': 0,
...@@ -644,24 +606,10 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -644,24 +606,10 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin):
u'since': u'%s' % self.created_at, u'since': u'%s' % self.created_at,
u'state': u'start_requested', u'state': u'start_requested',
u'text': u'#access OK', u'text': u'#access OK',
u'user': u'SlapOS Master'}}, u'user': u'SlapOS Master'}}
'monitor_url': 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:("%s")' % (
compute_node.getReference()
), ),
'portal_type': network.getPortalType(), 'portal_type': network.getPortalType(),
'reference': network.getReference(), 'reference': network.getReference()
'partition':
{ compute_node.getReference():
{self.partition0.getReference(): {'created_at': self.created_at,
'no_data': 1,
'portal_type': instance.getPortalType(),
'reference': instance.getReference(),
'since': self.created_at,
'state': '',
'text': '#error no data found for %s' % (instance.getReference()),
'user': 'SlapOS Master'}
}
}
} }
...@@ -673,8 +621,6 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -673,8 +621,6 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin):
news_dict = network.ComputerNetwork_getNewsDict() news_dict = network.ComputerNetwork_getNewsDict()
expected_news_dict = { expected_news_dict = {
'compute_node': {}, 'compute_node': {},
'partition': {},
'monitor_url': 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:()',
'portal_type': network.getPortalType(), 'portal_type': network.getPortalType(),
'reference': network.getReference()} 'reference': network.getReference()}
self.assertEqual(_decode_with_json(news_dict), self.assertEqual(_decode_with_json(news_dict),
...@@ -695,9 +641,6 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -695,9 +641,6 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin):
self._logFakeAccess(compute_node) self._logFakeAccess(compute_node)
news_dict = organisation.Organisation_getNewsDict() news_dict = organisation.Organisation_getNewsDict()
expected_news_dict = { expected_news_dict = {
'monitor_url': 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:("%s")' % (
compute_node.getReference()
),
'portal_type': 'Organisation', 'portal_type': 'Organisation',
'reference': organisation.getReference(), 'reference': organisation.getReference(),
'compute_node': 'compute_node':
...@@ -710,19 +653,7 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -710,19 +653,7 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin):
u'since': u'%s' % self.created_at, u'since': u'%s' % self.created_at,
u'state': u'start_requested', u'state': u'start_requested',
u'text': u'#access OK', u'text': u'#access OK',
u'user': u'SlapOS Master'}}, u'user': u'SlapOS Master'}}
'partition':
{ compute_node.getReference():
{self.partition0.getReference(): {'created_at': self.created_at,
'no_data': 1,
'portal_type': instance.getPortalType(),
'reference': instance.getReference(),
'since': self.created_at,
'state': '',
'text': '#error no data found for %s' % (instance.getReference()),
'user': 'SlapOS Master'}
}
}
} }
...@@ -734,8 +665,6 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin): ...@@ -734,8 +665,6 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin):
news_dict = organisation.Organisation_getNewsDict() news_dict = organisation.Organisation_getNewsDict()
expected_news_dict = { expected_news_dict = {
'compute_node': {}, 'compute_node': {},
'partition': {},
'monitor_url': 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type:"Software Instance" AND aggregate_reference:()',
'portal_type': 'Organisation', 'portal_type': 'Organisation',
'reference': organisation.getReference()} 'reference': organisation.getReference()}
self.assertEqual(_decode_with_json(news_dict), self.assertEqual(_decode_with_json(news_dict),
......
...@@ -154,12 +154,12 @@ ...@@ -154,12 +154,12 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -206,12 +206,12 @@ ...@@ -206,12 +206,12 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
...@@ -227,12 +227,12 @@ ...@@ -227,12 +227,12 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -224,12 +224,12 @@ ...@@ -224,12 +224,12 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -245,12 +245,12 @@ ...@@ -245,12 +245,12 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -179,23 +179,23 @@ ...@@ -179,23 +179,23 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
...@@ -212,34 +212,34 @@ ...@@ -212,34 +212,34 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<!-- Check on listbox --> <!-- Check on listbox -->
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
......
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