diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..9de17e17 --- /dev/null +++ b/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ +## Purpose +_Describe the problem or feature in addition to a link to the issues._ + +Example: +Fixes # . + +## Approach +_How does this change address the problem?_ + +#### Open Questions and Pre-Merge TODOs +- [ ] Use github checklists. When solved, check the box and explain the answer. + +## Learning +_Describe the research stage_ + +_Links to blog posts, patterns, libraries or addons used to solve this problem_ + +#### Blog Posts +- [How to Pull Request](https://github.com/flexyford/pull-request) Github Repo with Learning focused Pull Request Template. + diff --git a/bower.json b/bower.json index 7b986c01..37f1dbbc 100644 --- a/bower.json +++ b/bower.json @@ -21,7 +21,7 @@ "moment": "^2.17.0", "remarkable-bootstrap-notify": "^3.1.3", "animate.css": "^3.5.2", - "cytoscape": "^2.7.11", + "cytoscape": "^3.2.17", "webcola": "^3.3.0", "bootstrap": "^3.3.7", "cytoscape-cola": "^1.6.0", @@ -30,7 +30,7 @@ "bootstrap-table": "^1.11.0", "cytoscape-panzoom": "^2.4.0", "select2": "select2-dist#^4.0.3", - "cytoscape-context-menus": "^2.1.1", + "cytoscape-context-menus": "^3.0.6", "bootstrap-colorpicker": "^2.5.1" } } diff --git a/static/js/graphs_page.js b/static/js/graphs_page.js index a7f4c57a..bcc3178a 100644 --- a/static/js/graphs_page.js +++ b/static/js/graphs_page.js @@ -601,7 +601,7 @@ var graphPage = { }); layoutID.positions = corrected_positions; } - graphPage.cyGraph.layout(layoutID); + graphPage.cyGraph.layout(layoutID).run(); }, saveLayout: function (layoutName, modalNameId) { @@ -870,7 +870,7 @@ var graphPage = { }, onTapGraphElement: function (evt) { // get target - var target = evt.cyTarget; + var target = evt.Target; // target some element other than background (node/edge) if (target !== this) { var popup = target._private.data.popup; @@ -1386,7 +1386,7 @@ var graphPage = { graphPage.cyGraph.on('free', function (e) { - var selected_elements = e.cyTarget.length > 1 ? graphPage.cyGraph.elements(':selected') : e.cyTarget; + var selected_elements = e.Target.length > 1 ? graphPage.cyGraph.elements(':selected') : e.Target; graphPage.layoutEditor.undoRedoManager.update({ 'action_type': 'move_node', 'data': { @@ -1489,7 +1489,7 @@ var graphPage = { } }); - graphPage.cyGraph.elements().on('select, unselect', function () { + graphPage.cyGraph.elements().on('select unselect', function () { if (graphPage.cyGraph.nodes(':selected').length > 0) { $('#editSelectedNodesBtn').removeClass('disabled'); } else { @@ -1969,43 +1969,6 @@ var graphPage = { } return largestK; }, - applyMax: function (graph_layout) { - //Gets all nodes and edges up do the max value set - //and only renders them - var maxVal = parseInt($("#input_max").val()); - - if (!maxVal) { - return; - } - var newJSON = { - "nodes": new Array(), - "edges": new Array() - }; - - // List of node ids that should remain in the graph - var nodeNames = Array(); - - //Get all edges that meet the max quantifier - for (var i = 0; i < graph_json.elements['edges'].length; i++) { - var edge_data = graph_json.elements['edges'][i]; - if (edge_data['data']['k'] <= maxVal) { - newJSON['edges'].push(edge_data); - nodeNames.push(edge_data['data']['source']); - nodeNames.push(edge_data['data']['target']); - } - } - - //Get all nodes that meet the max quantifier - for (var i = 0; i < graph_json.elements['nodes'].length; i++) { - var node_data = graph_json.elements['nodes'][i]; - if (nodeNames.indexOf(node_data['data']['id']) > -1) { - newJSON['nodes'].push(node_data); - } - } - - graphPage.cyGraph.load(newJSON); - graphPage.filterNodesEdges.showOnlyK(); - }, showOnlyK: function () { // Returns all the id's that are > k value if ($("#input_k").val()) { @@ -2338,43 +2301,6 @@ var graphPage = { max: 50 }); }, - applyMax: function (graph_layout) { - //Gets all nodes and edges up do the max value set - //and only renders them - var maxVal = parseInt($("#input_max").val()); - - if (!maxVal) { - return; - } - var newJSON = { - "nodes": new Array(), - "edges": new Array() - }; - - // List of node ids that should remain in the graph - var nodeNames = Array(); - - //Get all edges that meet the max quantifier - for (var i = 0; i < graph_json.elements['edges'].length; i++) { - var edge_data = graph_json.elements['edges'][i]; - if (edge_data['data']['k'] <= maxVal) { - newJSON['edges'].push(edge_data); - nodeNames.push(edge_data['data']['source']); - nodeNames.push(edge_data['data']['target']); - } - } - - //Get all nodes that meet the max quantifier - for (var i = 0; i < graph_json.elements['nodes'].length; i++) { - var node_data = graph_json.elements['nodes'][i]; - if (nodeNames.indexOf(node_data['data']['id']) > -1) { - newJSON['nodes'].push(node_data); - } - } - - graphPage.cyGraph.load(newJSON); - graphPage.filterNodesEdges.showOnlyK(); - }, setBarToValueEdgeLength: function (inputId, barId) { /** * If the user enters a value greater than the max value allowed, change value of bar to max allowed value. @@ -2443,7 +2369,7 @@ var cytoscapeGraph = { title: 'edit selected nodes', selector: 'node', onClickFunction: function (event) { - graphPage.layoutEditor.nodeEditor.open(cy.collection(cy.elements(':selected')).add(event.cyTarget).select()); + graphPage.layoutEditor.nodeEditor.open(cy.collection(cy.elements(':selected')).add(event.Target).select()); }, hasTrailingDivider: true }, @@ -2453,7 +2379,7 @@ var cytoscapeGraph = { selector: 'node', show: true, onClickFunction: function (event) { - selectAllOfTheSameType(event.cyTarget); + selectAllOfTheSameType(event.Target); } }, { @@ -2462,7 +2388,7 @@ var cytoscapeGraph = { selector: 'node', show: true, onClickFunction: function (event) { - unselectAllOfTheSameType(event.cyTarget); + unselectAllOfTheSameType(event.Target); } }, { @@ -2471,7 +2397,7 @@ var cytoscapeGraph = { selector: 'edge', show: true, onClickFunction: function (event) { - selectAllOfTheSameType(event.cyTarget); + selectAllOfTheSameType(event.Target); } }, { @@ -2480,7 +2406,7 @@ var cytoscapeGraph = { selector: 'edge', show: true, onClickFunction: function (event) { - unselectAllOfTheSameType(event.cyTarget); + unselectAllOfTheSameType(event.Target); } } ] @@ -2784,7 +2710,7 @@ var cytoscapeGraph = { fit: false, avoidOverlap: false, padding: 0 - }); + }).run(); } else if (layout_name === "fill_circle") { collection.layout( { @@ -2792,7 +2718,7 @@ var cytoscapeGraph = { fit: false, avoidOverlap: false, padding: 40 - }); + }).run(); } else if (layout_name === "grid") { collection.layout( { @@ -2800,7 +2726,7 @@ var cytoscapeGraph = { fit: false, avoidOverlap: true, condense: true - }); + }).run(); } else if (layout_name === "square") { cytoscapeGraph.runSquareLayoutOnCollection(cy, collection); } else if (layout_name === "horizontal") { diff --git a/templates/graphs/error.html b/templates/graphs/error.html index 95eac32a..00b83808 100644 --- a/templates/graphs/error.html +++ b/templates/graphs/error.html @@ -18,6 +18,6 @@