X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fscreens%2Fmainscreen.py;h=df110c64a95554feb25642445b8340626464a466;hp=c25403bd5cf6f7d4ca5c125cf5db211382e895e1;hb=bc9cce47260c4847c2c613548ca3b2e0eaa6b510;hpb=8fb1ea6942cc6effcc52b93bf0cc4fe204fbc701 diff --git a/sface/screens/mainscreen.py b/sface/screens/mainscreen.py index c25403b..df110c6 100644 --- a/sface/screens/mainscreen.py +++ b/sface/screens/mainscreen.py @@ -75,6 +75,11 @@ class NodeView(QTreeView): def toggleSelection(self): index = self.currentIndex() model = index.model() + + if (model == None): + # probably no rspec downloaded yet + return + status_index = model.index(index.row(), MEMBERSHIP_STATUS_COLUMN, index.parent()) status_data = status_index.data().toString() node_index = model.index(index.row(), NAME_COLUMN, index.parent()) @@ -125,6 +130,11 @@ class NodeView(QTreeView): # Right click index = self.currentIndex() model = index.model() + + if (model == None): + # probably no rspec downloaded yet + return + status_index = model.index(index.row(), 1, index.parent()) status_data = status_index.data().toString() node_index = model.index(index.row(), 0, index.parent()) @@ -626,10 +636,17 @@ class SliceWidget(QWidget): self.nodeView.appendRow(nodeItem, tagstring, membership=tag_status['in'], kind = "attribute") for node in sliver_nodes: + nodeType = None + if ("hardware_types" in node): + hardware_types = [x["name"] for x in node["hardware_types"]] + nodeType = ",".join(hardware_types) + nodeStatus = node.get("boot_state", "") + if nodeStatus == None: + nodeStatus="" nodeItem = self.nodeView.appendRow(networkItem, node["component_name"], - nodeStatus=node.get("boot_state", ""), - #nodeType=node.get("rspec.get_node_sliver_type(node, network), + nodeStatus=nodeStatus, + nodeType=nodeType, membership=node_status['in'], kind="node") @@ -643,10 +660,17 @@ class SliceWidget(QWidget): kind="attribute") for node in available_nodes: + nodeType = None + if ("hardware_types" in node): + hardware_types = [x["name"] for x in node["hardware_types"]] + nodeType = ",".join(hardware_types) + nodeStatus = node.get("boot_state", "") + if nodeStatus == None: + nodeStatus="" self.nodeView.appendRow(networkItem, node["component_name"], - nodeStatus = node.get("boot_state", ""), - #nodeType= resources.get_node_sliver_type(node, network), + nodeStatus=nodeStatus, + nodeType=nodeType, membership=node_status['out'], kind="node")