diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..fb1a1a6 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,29 @@ +{ + "browser": true, + "esnext": true, + "predef": ["angular", "horizon", "$"], + "globalstrict": true, + "quotmark": true, + "smarttabs": true, + "strict": false, + "trailing": true, + "undef": true, + "unused": true, + "bitwise": true, + "boss": true, + "curly": true, + "eqeqeq": false, + "eqnull": true, + "evil": false, + "forin": true, + "immed": true, + "latedef": true, + "laxbreak": true, + "loopfunc": true, + "newcap": true, + "noarg": true, + "noempty": true, + "nonew": true, + "supernew": true, + "validthis": true +} \ No newline at end of file diff --git a/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.directive.js b/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.directive.js new file mode 100644 index 0000000..6ed73c3 --- /dev/null +++ b/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.directive.js @@ -0,0 +1,90 @@ +angular + .module('horizon.dashboard.project.vitrage') + .directive('sunburst', sunburst); + +function sunburst() { + var directive = { + link: link, + templateUrl: 'dashboard/project/components/sunburst/sunburst.html', + restrict: 'E' + }; + return directive; + + function link(scope, element, attrs) { + var width = 960, + height = 700, + radius = Math.min(width, height) / 2; + + var x = d3.scale.linear() + .range([0, 2 * Math.PI]); + + var y = d3.scale.sqrt() + .range([0, radius]); + + var color = d3.scale.category20c(); + + var svg = d3.select("#canvas").append("svg") + .attr("width", width) + .attr("height", height) + .append("g") + .attr("transform", "translate(" + width / 2 + "," + (height / 2 + 10) + ")"); + + var partition = d3.layout.partition() + .value(function (d) { + return d.size; + }); + + var arc = d3.svg.arc() + .startAngle(function (d) { + return Math.max(0, Math.min(2 * Math.PI, x(d.x))); + }) + .endAngle(function (d) { + return Math.max(0, Math.min(2 * Math.PI, x(d.x + d.dx))); + }) + .innerRadius(function (d) { + return Math.max(0, y(d.y)); + }) + .outerRadius(function (d) { + return Math.max(0, y(d.y + d.dy)); + }); + + d3.json("/static/dashboard/project/topology/graph.json", function (error, root) { + if (error) throw error; + + var path = svg.selectAll("path") + .data(partition.nodes(root)) + .enter().append("path") + .attr("d", arc) + .style("fill", function (d) { + return color((d.children ? d : d.parent).name); + }) + .on("click", click); + + function click(d) { + path.transition() + .duration(750) + .attrTween("d", arcTween(d)); + } + }); + + d3.select(self.frameElement).style("height", height + "px"); + +// Interpolate the scales! + function arcTween(d) { + var xd = d3.interpolate(x.domain(), [d.x, d.x + d.dx]), + yd = d3.interpolate(y.domain(), [d.y, 1]), + yr = d3.interpolate(y.range(), [d.y ? 20 : 0, radius]); + return function (d, i) { + return i + ? function (t) { + return arc(d); + } + : function (t) { + x.domain(xd(t)); + y.domain(yd(t)).range(yr(t)); + return arc(d); + }; + }; + } + } +} diff --git a/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.html b/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.html new file mode 100644 index 0000000..fbb90ec --- /dev/null +++ b/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.scss b/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.scss new file mode 100644 index 0000000..4f50553 --- /dev/null +++ b/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.scss @@ -0,0 +1,3 @@ +.vitrage-sunburst { + +} \ No newline at end of file diff --git a/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.test.js b/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.test.js new file mode 100644 index 0000000..0751737 --- /dev/null +++ b/vitragedashboard/static/dashboard/project/components/sunburst/sunburst.test.js @@ -0,0 +1 @@ +// TODO... diff --git a/vitragedashboard/static/dashboard/project/layout/system-health.controller.js b/vitragedashboard/static/dashboard/project/layout/system-health.controller.js new file mode 100644 index 0000000..6b05a52 --- /dev/null +++ b/vitragedashboard/static/dashboard/project/layout/system-health.controller.js @@ -0,0 +1,15 @@ +(function () { + 'use strict'; + + angular + .module('horizon.dashboard.project.vitrage') + .controller('SystemHealthController', SystemHealthController); + + SystemHealthController.$inject = ['$scope', 'vitrageTopologySrv']; + + function SystemHealthController($scope, vitrageTopologySrv) { + $scope.STATIC_URL = STATIC_URL; + var srv = vitrageTopologySrv; + } + +})(); diff --git a/vitragedashboard/static/dashboard/project/layout/system-health.html b/vitragedashboard/static/dashboard/project/layout/system-health.html new file mode 100644 index 0000000..59f034d --- /dev/null +++ b/vitragedashboard/static/dashboard/project/layout/system-health.html @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/vitragedashboard/static/dashboard/project/layout/system-health.scss b/vitragedashboard/static/dashboard/project/layout/system-health.scss new file mode 100644 index 0000000..4d8ad21 --- /dev/null +++ b/vitragedashboard/static/dashboard/project/layout/system-health.scss @@ -0,0 +1,3 @@ +.vitrage-system-health { + margin-bottom: 4px; +} \ No newline at end of file diff --git a/vitragedashboard/static/dashboard/project/topology/vitrage_topology.service.js b/vitragedashboard/static/dashboard/project/services/vitrage_topology.service.js similarity index 96% rename from vitragedashboard/static/dashboard/project/topology/vitrage_topology.service.js rename to vitragedashboard/static/dashboard/project/services/vitrage_topology.service.js index c4044cf..701e12d 100644 --- a/vitragedashboard/static/dashboard/project/topology/vitrage_topology.service.js +++ b/vitragedashboard/static/dashboard/project/services/vitrage_topology.service.js @@ -1,7 +1,3 @@ -/** - * Created by oetrog on 11/17/15. - */ - (function(){ 'use strict'; diff --git a/vitragedashboard/static/dashboard/project/topology/main_panel.html b/vitragedashboard/static/dashboard/project/topology/main_panel.html deleted file mode 100644 index 1e34812..0000000 --- a/vitragedashboard/static/dashboard/project/topology/main_panel.html +++ /dev/null @@ -1,3 +0,0 @@ -
- Hello World -
\ No newline at end of file diff --git a/vitragedashboard/static/dashboard/project/topology/vitrage_topology.controller.js b/vitragedashboard/static/dashboard/project/topology/vitrage_topology.controller.js deleted file mode 100644 index 1b96dac..0000000 --- a/vitragedashboard/static/dashboard/project/topology/vitrage_topology.controller.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Created by oetrog on 11/17/15. - */ - -(function(){ -'use strict'; - - angular - .module('horizon.dashboard.project.vitrage') - .controller('vitrageTopologyCtrl',VitrageTopologyCtrl); - - VitrageTopologyCtrl.$inject = ['$scope','vitrageTopologySrv']; - - function VitrageTopologyCtrl($scope,vitrageTopologySrv){ - $scope.STATIC_URL = STATIC_URL; - var srv = vitrageTopologySrv; - } - -})(); diff --git a/vitragedashboard/static/dashboard/project/topology/vitrage_topology.scss b/vitragedashboard/static/dashboard/project/topology/vitrage_topology.scss deleted file mode 100644 index e69de29..0000000 diff --git a/vitragedashboard/static/dashboard/project/vitrage.module.js b/vitragedashboard/static/dashboard/project/vitrage.module.js index 1e413dd..e522d1e 100644 --- a/vitragedashboard/static/dashboard/project/vitrage.module.js +++ b/vitragedashboard/static/dashboard/project/vitrage.module.js @@ -1,10 +1,6 @@ -/** - * Created by oetrog on 11/17/15. - */ - (function(){ 'use strict'; - angular.module('horizon.dashboard.project.vitrage',[]) + angular.module('horizon.dashboard.project.vitrage',[]); })(); diff --git a/vitragedashboard/templates/topology/index.html b/vitragedashboard/templates/topology/index.html index 1f3e922..dd7ebef 100644 --- a/vitragedashboard/templates/topology/index.html +++ b/vitragedashboard/templates/topology/index.html @@ -3,13 +3,13 @@ {% block title %}{% trans "Topology" %}{% endblock %} {% block page_header %} -{% include "horizon/common/_page_header.html" with title=_("Topology") %} + {% endblock page_header %} {% block main %} -
- +
+
{% endblock %}