From 9163b8bc05d72878268b7a06c82dafc9ac112cdc Mon Sep 17 00:00:00 2001 From: Mathis Neumann <mathis@simpletechs.net> Date: Wed, 22 Jun 2016 14:59:02 +0200 Subject: [PATCH] remove prototype files --- .../architecture-visualisation-cola.js | 142 ------------------ app/components/architecture-visualisation.js | 139 ----------------- app/templates/cola.hbs | 2 - .../components/architecture-visualisation.hbs | 1 - app/templates/cytoscape.hbs | 1 - bower.json | 1 - package.json | 7 +- tests/unit/routes/cytoscape-test.js | 11 -- 8 files changed, 1 insertion(+), 303 deletions(-) delete mode 100644 app/components/architecture-visualisation-cola.js delete mode 100644 app/components/architecture-visualisation.js delete mode 100644 app/templates/cola.hbs delete mode 100644 app/templates/components/architecture-visualisation.hbs delete mode 100644 app/templates/cytoscape.hbs delete mode 100644 tests/unit/routes/cytoscape-test.js diff --git a/app/components/architecture-visualisation-cola.js b/app/components/architecture-visualisation-cola.js deleted file mode 100644 index e7720d5..0000000 --- a/app/components/architecture-visualisation-cola.js +++ /dev/null @@ -1,142 +0,0 @@ -import Ember from 'ember'; -import d3 from 'd3'; -import cola from 'npm:webcola'; -import _ from 'npm:lodash'; - -export default Ember.Component.extend({ - init: function()Â { - this._super(); - const self = this; - const log = self.debug.bind(self); - log('loaded'); - // this.interval = setInterval(function() { - // const graph = self.get('graph'); - - // log('update interval called', graph); - - // if(!graph) { - // return; // eventual consistent - // } - // const edges = graph.edges || []; - // const index = Math.floor(Math.random()*edges.length); - // if(Math.random() > 0.5) { - // edges.splice(index, 1); - // } else { // FIXME: does not render updates - // const children = _.get(graph, 'children', []); - // const randomNodeIndex = Math.floor(Math.random()*children.length); - // const randomNodeId = children[randomNodeIndex].id; - // graph.edges = _.set(edges, `${index}.target`, randomNodeId); - // log(`updating random edge (${index}) to target a random node id ${randomNodeId}`, randomNodeIndex, edges); - // } - // self.set('graph', graph); - // self.renderGraph(); - // }, 1000); - }, - willDestroyElement() { - clearInterval(this.interval); - }, - didInsertElement: function() { - const width = window.innerWidth; - const height = window.innerHeight; - this.debug('element', this.element); - const zoom = d3.behavior.zoom() - .on("zoom", redraw); - - const svg = d3.select(this.element) - .append("svg") - .attr("width", width) - .attr("height", height) - .attr('class', 'architectureVisualisation') - .call(zoom) - .append("g"); - const root = svg.append('g').attr('class', 'root'); - - this.svg = svg; - this.layouter = cola.d3adaptor() - .linkDistance(80) - .avoidOverlaps(true) - .handleDisconnected(false) - .size([width, height]); - // group shizzle - - this.debug('element', this.element); - - function redraw() { - svg.attr("transform", "translate(" + d3.event.translate + ") scale(" + d3.event.scale + ")"); - } - - const graph = this.get('graph'); - - const nodes = graph.nodes; - const links = graph.links; - const groups = graph.groups; - this.layouter - .nodes(nodes) - .links(links) - .groups(groups) - .start(100, 0, 50, 50); - - // nodes - const nodeData = root.selectAll('.node') - .data(nodes); - /*const groupData = */ root.selectAll('.group') - .data(groups); - const nodeEnter = nodeData.enter() - .append('g'); - - nodeData - .attr('class', 'node leaf') - .attr('width', 10) - .attr('height', 10) - .attr('x', 0) - .attr('y', 0); - - const atoms = nodeEnter.append('rect'); - - nodeEnter.append('title') - .text(d => d.id); - - nodeEnter.append('text') - .attr('x', (d) => d.children? 0 : 2.5) - .attr('y', 5) - .text((d) => _.get(d, 'labels.0.text', d.id)) - .attr('font-size', '4px') - .attr('font-size', '4px'); - - nodeData.exit() - .remove(); - - // edges - // FIXME does not handle updates (neither enter() nor exit()) - const linkData = root.selectAll('.link') - .data(links, p => p.id); - /*const link = */linkData.enter() - .append('path') - .attr('class', 'link') - .attr('d', 'M0 0'); - - - linkData.exit() - .remove(); - - // apply edge routes - // linkData.transition().attr('d', (d) => { - // log('test', this.layouter); - // let path = ''; - // path += 'M' + d.sourcePoint.x + ' ' + d.sourcePoint.y + ' '; - // (d.bendPoints || []).forEach(bp => path += 'L' + bp.x + ' ' + bp.y + ' '); - // path += 'L' + d.targetPoint.x + ' ' + d.targetPoint.y + ' '; - // return path; - // }); - - // apply nodeEnter positions - nodeData.transition() - .attr('transform', (d) => 'translate(' + (d.x || 0) + ' ' + (d.y || 0) + ')'); - - atoms.transition() - .attr('width', (d) => d.width) - .attr('height', (d) => d.height); - // this.layouter.on('finish', onFinish); - // this.renderGraph(); - } -}); diff --git a/app/components/architecture-visualisation.js b/app/components/architecture-visualisation.js deleted file mode 100644 index f9a669c..0000000 --- a/app/components/architecture-visualisation.js +++ /dev/null @@ -1,139 +0,0 @@ -import Ember from 'ember'; -import d3 from 'd3'; -import klay from 'npm:klayjs-d3'; -import _ from 'npm:lodash'; - -export default Ember.Component.extend({ - init: function()Â { - this._super(); - // this.interval = setInterval(function() { - // const graph = self.get('graph'); - - // log('update interval called', graph); - - // if(!graph) { - // return; // eventual consistent - // } - // const edges = graph.edges || []; - // const index = Math.floor(Math.random()*edges.length); - // if(Math.random() > 0.5) { - // edges.splice(index, 1); - // } else { // FIXME: does not render updates - // const children = _.get(graph, 'children', []); - // const randomNodeIndex = Math.floor(Math.random()*children.length); - // const randomNodeId = children[randomNodeIndex].id; - // graph.edges = _.set(edges, `${index}.target`, randomNodeId); - // log(`updating random edge (${index}) to target a random node id ${randomNodeId}`, randomNodeIndex, edges); - // } - // self.set('graph', graph); - // self.renderGraph(); - // }, 1000); - }, - willDestroyElement() { - clearInterval(this.interval); - }, - didInsertElement: function() { - const log = this.debug.bind(this); - const width = window.innerWidth; - const height = window.innerHeight; - this.debug('element', this.element); - const zoom = d3.behavior.zoom() - .on("zoom", redraw); - - const svg = d3.select(this.element) - .append("svg") - .attr("width", width) - .attr("height", height) - .attr('class', 'architectureVisualisation') - .call(zoom) - .append("g"); - const root = svg.append('g').attr('class', 'root'); - - this.svg = svg; - this.layouter = klay.d3kgraph() - .size([width, height]) - .transformGroup(root) - .options({ - edgeRouting: "ORTHOGONAL", - aspectRatio: 1.7, - separateConnComp: true, - // layoutHierarchy: false - }); - // group shizzle - - this.debug('element', this.element); - - function redraw() { - svg.attr("transform", "translate(" + d3.event.translate + ") scale(" + d3.event.scale + ")"); - } - - const onFinish = (layout) => { - log('loaded layout', layout); - const nodes = this.layouter.nodes(); - const links = this.layouter.links(nodes); - - const nodeData = root.selectAll('.node') - .data(nodes, p => p.id); - const nodeEnter = nodeData.enter() - .append('g'); - - nodeData.exit() - .remove(); - - nodeData.attr('class', d => d.children? 'node compound' : 'node leaf'); - - const atoms = nodeEnter.append('rect') - .attr('width', 10) - .attr('height', 10) - .attr('x', 0) - .attr('y', 0); - - nodeEnter.append('title') - .text(d => d.id); - - nodeEnter.append('text') - .attr('x', (d) => d.children? 0 : 2.5) - .attr('y', 5) - .text((d) => _.get(d, 'labels.0.text', d.id)) - .attr('font-size', '4px') - .attr('font-size', '4px'); - - - // FIXME does not handle updates (neither enter() nor exit()) - const linkData = root.selectAll('.link') - .data(links, p => p.id); - /*const link = */linkData.enter() - .append('path') - .attr('class', 'link') - .attr('d', 'M0 0'); - - - linkData.exit() - .remove(); - - // apply edge routes - linkData.transition().attr('d', (d) => { - let path = ''; - path += 'M' + d.sourcePoint.x + ' ' + d.sourcePoint.y + ' '; - (d.bendPoints || []).forEach(bp => path += 'L' + bp.x + ' ' + bp.y + ' '); - path += 'L' + d.targetPoint.x + ' ' + d.targetPoint.y + ' '; - return path; - }); - - // apply nodeEnter positions - nodeData.transition() - .attr('transform', (d) => 'translate(' + (d.x || 0) + ' ' + (d.y || 0) + ')'); - - atoms.transition() - .attr('width', (d) => d.width) - .attr('height', (d) => d.height); - }; - this.layouter.on('finish', onFinish); - this.renderGraph(); - }, - renderGraph() { - this.layouter.kgraph(this.get('graph')); - } -}); - - diff --git a/app/templates/cola.hbs b/app/templates/cola.hbs deleted file mode 100644 index 959c621..0000000 --- a/app/templates/cola.hbs +++ /dev/null @@ -1,2 +0,0 @@ -Visualisierung: -{{architecture-visualisation-cola graph=model}} \ No newline at end of file diff --git a/app/templates/components/architecture-visualisation.hbs b/app/templates/components/architecture-visualisation.hbs deleted file mode 100644 index 0eddf3f..0000000 --- a/app/templates/components/architecture-visualisation.hbs +++ /dev/null @@ -1 +0,0 @@ -<!-- will only contain svg which is dynamically added --> \ No newline at end of file diff --git a/app/templates/cytoscape.hbs b/app/templates/cytoscape.hbs deleted file mode 100644 index e74a09b..0000000 --- a/app/templates/cytoscape.hbs +++ /dev/null @@ -1 +0,0 @@ -{{architecture-visualisation-cytoscape graph=model}} \ No newline at end of file diff --git a/bower.json b/bower.json index 0dc2645..3373fa3 100644 --- a/bower.json +++ b/bower.json @@ -5,7 +5,6 @@ "ember-cli-shims": "0.1.0", "ember-cli-test-loader": "0.2.2", "ember-qunit-notifications": "0.1.0", - "d3": "^3.5.16", "visionmedia-debug": "2.2", "webcola": "^3.1.3", "bootstrap-sass": "^3.3.6" diff --git a/package.json b/package.json index 48f0724..9ee82e6 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "ember-cli-app-version": "^1.0.0", "ember-cli-babel": "^5.1.5", "ember-cli-bootstrap-sassy": "0.5.3", - "ember-cli-d3": "1.1.6", "ember-cli-dependency-checker": "^1.2.0", "ember-cli-htmlbars": "^1.0.1", "ember-cli-htmlbars-inline-precompile": "^0.3.1", @@ -38,7 +37,6 @@ "ember-cli-sri": "^2.1.0", "ember-cli-uglify": "^1.2.0", "ember-cli-yuidoc": "0.8.3", - "ember-d3": "0.1.0", "ember-data": "^2.4.0", "ember-data-url-templates": "0.1.1", "ember-debug-logger": "0.2.0", @@ -54,9 +52,6 @@ "dependencies": { "cytoscape": "^2.7.3", "cytoscape-cola": "^1.4.0", - "cytoscape-cose-bilkent": "^1.3.6", - "klayjs": "^0.4.1", - "klayjs-d3": "^0.3.4", - "webcola": "^3.1.2" + "cytoscape-cose-bilkent": "^1.3.6" } } diff --git a/tests/unit/routes/cytoscape-test.js b/tests/unit/routes/cytoscape-test.js deleted file mode 100644 index 2b8e45a..0000000 --- a/tests/unit/routes/cytoscape-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { moduleFor, test } from 'ember-qunit'; - -moduleFor('route:cytoscape', 'Unit | Route | cytoscape', { - // Specify the other units that are required for this test. - // needs: ['controller:foo'] -}); - -test('it exists', function(assert) { - let route = this.subject(); - assert.ok(route); -}); -- GitLab