cadets / cadets-ui

Web-based user interface to CADETS/OPUS
Apache License 2.0
0 stars 0 forks source link

Differentiate internal vs external nodes in machine view #23

Closed trombonehero closed 7 years ago

trombonehero commented 7 years ago

It would be nice to more clearly differentiate in the high-level machine view between:

amstrnad commented 7 years ago

I've differentiated based on the external field, which I believe corresponds to the first checkbox. See the machine-view branch.

trombonehero commented 7 years ago

Hi @alsz,

I've pulled in d730a154e783d8a2d34068d9f252b5051622e61c but still see the following:

internal-external

Do the nodes look different for you?

trombonehero commented 7 years ago

Sorry, the previous screen shot was from the worksheet rather than the machines view. However, I still see the same thing in the machines view:

screen shot 2017-06-30 at 12 24 17 pm

trombonehero commented 7 years ago

Aha:

--- a/playground/templates/machine-view.html                            [1/6683]
+++ b/playground/templates/machine-view.html
@@ -35,18 +35,20 @@ load_graph_style([ view ]);

 $.getJSON('machines', function(result) {
   for (let machine of result.nodes) {
+    let classes = machine.type;
+    if (machine.external) {
+      classes += ' machine-external';
+    } else {
+      classes += ' machine-internal';
+    }
+
     let node = {
-      classes: machine.type,
+      classes: classes,
       data: machine,
     };
     node.data.label = node_metadata(machine).label;

     graph_node = view.add(node);
-    if (machine.external) {
-        graph_node.addClass('machine-external')
-    } else {
-        graph_node.addClass('machine-internal')
-    }
   }

   for (let e of result.edges) {

screen shot 2017-06-30 at 12 30 57 pm

Weird that retroactive class modification worked for you but not me. This way seems to work for me too, however, so I'll commit this.

trombonehero commented 7 years ago

Resolved by d730a154e783d8a2d34068d9f252b5051622e61c, 091f550a69a60ff6950c6b57d196299417f0090e and b71aea627491bb08791d4d8aa8deb667bacb0efd.