Updated serviceGrid to js dashboard
diff --git a/views/ngXosViews/serviceGrid/env/default.js b/views/ngXosViews/serviceGrid/env/default.js
index 5a8b48c..3d60258 100644
--- a/views/ngXosViews/serviceGrid/env/default.js
+++ b/views/ngXosViews/serviceGrid/env/default.js
@@ -8,6 +8,6 @@
module.exports = {
host: 'http://xos.dev:9999/',
- xoscsrftoken: 'VlCJNJg79Gpf48CmElpfHiFOozppc0QZ',
- xossessionid: 'qjbnydj4ujm5t07f2k22zpjwk9y5487c'
+ xoscsrftoken: 'comXS9APlpktu9OcQqcNgpqQQ5tx68L1',
+ xossessionid: '9cw4yv28j4wqcbewdxh3rucamev8tg9q'
};
diff --git a/views/ngXosViews/serviceGrid/src/templates/service-grid.tpl.html b/views/ngXosViews/serviceGrid/src/templates/service-grid.tpl.html
index c371d37..26f7281 100644
--- a/views/ngXosViews/serviceGrid/src/templates/service-grid.tpl.html
+++ b/views/ngXosViews/serviceGrid/src/templates/service-grid.tpl.html
@@ -7,8 +7,8 @@
<i class="glyphicon glyphicon-plus"></i>
Add Service
</a>
- <a href="#/graph" class="btn btn-default btn-block">
+ <!-- <a href="#/graph" class="btn btn-default btn-block">
Tenancy Graph
- </a>
+ </a> -->
</div>
</div>
\ No newline at end of file
diff --git a/views/style/bs-config.js b/views/style/bs-config.js
index 288f1cc..b2eedc4 100644
--- a/views/style/bs-config.js
+++ b/views/style/bs-config.js
@@ -5,6 +5,7 @@
'../../xos/core/xoslib/static/**/*.js',
'../../xos/core/xoslib/static/**/*.css',
'../../xos/core/dashboard/views/*.py',
+ '../../xos/core/views/*.py',
'../../xos/templates/**/*.html',
'../../xos/core/static/xos.css',
'../../xos/xos/**/*.py'
diff --git a/xos/configurations/common/fixtures.yaml b/xos/configurations/common/fixtures.yaml
index 6d9c0e8..a447e20 100644
--- a/xos/configurations/common/fixtures.yaml
+++ b/xos/configurations/common/fixtures.yaml
@@ -95,6 +95,11 @@
properties:
url: template:xosDeveloper_datatables
+ Services Grid:
+ type: tosca.nodes.DashboardView
+ properties:
+ url: template:xosServiceGrid
+
# -----------------------------------------------------------------------------
# Network Templates
# -----------------------------------------------------------------------------
diff --git a/xos/configurations/frontend/Makefile b/xos/configurations/frontend/Makefile
index 7223cf7..87f4bd8 100644
--- a/xos/configurations/frontend/Makefile
+++ b/xos/configurations/frontend/Makefile
@@ -29,11 +29,6 @@
django-restart:
sudo docker exec frontend_xos_1 touch /opt/xos/xos/settings.py
-mock-cord:
- sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/frontend/mocks/cord.yaml
- sudo docker exec frontend_xos_1 cp /opt/xos/configurations/cord-pod/xos_cord_config /opt/xos/xos_configuration/
- sudo docker exec frontend_xos_1 touch /opt/xos/xos/settings.py
-
mock-cord-pod:
echo "make sure to add '../vtn/files/xos_vtn_config:/opt/xos/xos_configuration/xos_vtn_config:ro' to volumes section of docker-compose.yml"
sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/fixtures.yaml
diff --git a/xos/configurations/frontend/docker-compose.yml b/xos/configurations/frontend/docker-compose.yml
index fae13ab..d15e98e 100644
--- a/xos/configurations/frontend/docker-compose.yml
+++ b/xos/configurations/frontend/docker-compose.yml
@@ -24,6 +24,7 @@
- ../../core/static:/opt/xos/core/static
- ../../core/dashboard:/opt/xos/core/dashboard
- ../../core/templatetags:/opt/xos/core/templatetags
+ - ../../core/views:/opt/xos/core/views
- ../../templates/admin:/opt/xos/templates/admin
- ../../configurations:/opt/xos/configurations
- ../../xos:/opt/xos/xos
diff --git a/xos/core/views/serviceGraph.py b/xos/core/views/serviceGraph.py
index 5ce0581..bf75a2b 100644
--- a/xos/core/views/serviceGraph.py
+++ b/xos/core/views/serviceGraph.py
@@ -2,12 +2,58 @@
from django.views.generic import TemplateView, View
from django import template
from core.models import *
+from core.dashboard.views import DashboardDynamicView
+from xos.config import XOS_DIR
import json
import os
import time
import tempfile
+
class ServiceGridView(TemplateView):
+
+ head_template = r"""{% extends "admin/dashboard/dashboard_base.html" %}
+ {% load admin_static %}
+ {% block content %}
+ """
+
+ tail_template = r"{% endblock %}"
+
+ def readTemplate(self, fn):
+ TEMPLATE_DIRS = [XOS_DIR + "/templates/admin/dashboard/",
+ XOS_DIR + "/core/xoslib/dashboards/"]
+
+ for template_dir in TEMPLATE_DIRS:
+ pathname = os.path.join(template_dir, fn) + ".html"
+ if os.path.exists(pathname):
+ break
+ else:
+ return "failed to find %s in %s" % (fn, TEMPLATE_DIRS)
+
+ template = open(pathname, "r").read()
+ return template
+
+ def get(self, request, name="root", *args, **kwargs):
+
+ # context = self.get_context_data(**kwargs)
+ # context = getDashboardContext(request.user, context)
+
+ dash = DashboardView.objects.get(name="Services Grid")
+
+ gridTemplate = self.readTemplate(dash.url[9:])
+
+ t = template.Template(self.head_template + gridTemplate + self.tail_template)
+
+ response_kwargs = {}
+ response_kwargs.setdefault('content_type', self.content_type)
+
+ return self.response_class(
+ request=request,
+ template=t,
+ **response_kwargs)
+
+
+class ServiceGridViewPy(TemplateView):
head_template = r"""{% extends "admin/dashboard/dashboard_base.html" %}
{% load admin_static %}
{% block content %}
diff --git a/xos/core/xoslib/dashboards/xosServiceGrid.html b/xos/core/xoslib/dashboards/xosServiceGrid.html
index 62bc24f..50a050a 100644
--- a/xos/core/xoslib/dashboards/xosServiceGrid.html
+++ b/xos/core/xoslib/dashboards/xosServiceGrid.html
@@ -1,7 +1,5 @@
<!-- browserSync -->
<!-- bower:css -->
-<link rel="stylesheet" href="vendor/bootstrap-css/css/bootstrap.min.css" />
-<link rel="stylesheet" href="vendor/angular-chart.js/dist/angular-chart.css" />
<!-- endbower -->
<!-- endcss -->
<!-- inject:css -->
@@ -13,17 +11,6 @@
</div>
<!-- bower:js -->
-<script src="vendor/jquery/dist/jquery.js"></script>
-<script src="vendor/angular/angular.js"></script>
-<script src="vendor/angular-mocks/angular-mocks.js"></script>
-<script src="vendor/angular-ui-router/release/angular-ui-router.js"></script>
-<script src="vendor/angular-cookies/angular-cookies.js"></script>
-<script src="vendor/angular-animate/angular-animate.js"></script>
-<script src="vendor/angular-resource/angular-resource.js"></script>
-<script src="vendor/lodash/lodash.js"></script>
-<script src="vendor/bootstrap-css/js/bootstrap.min.js"></script>
-<script src="vendor/Chart.js/Chart.js"></script>
-<script src="vendor/angular-chart.js/dist/angular-chart.js"></script>
<!-- endbower -->
<!-- endjs -->
<!-- inject:js -->
diff --git a/xos/core/xoslib/static/css/xosServiceGrid.css b/xos/core/xoslib/static/css/xosServiceGrid.css
index e69de29..c722065 100644
--- a/xos/core/xoslib/static/css/xosServiceGrid.css
+++ b/xos/core/xoslib/static/css/xosServiceGrid.css
@@ -0,0 +1 @@
+#xosServiceGrid service-graph{display:block;width:100%;height:600px}#xosServiceGrid .node{stroke:#337ab7;fill:white}#xosServiceGrid .node.xos{fill:#d9534f}#xosServiceGrid .link{stroke:black;stroke-width:2px}
\ No newline at end of file
diff --git a/xos/core/xoslib/static/js/xosServiceGrid.js b/xos/core/xoslib/static/js/xosServiceGrid.js
index 4214f35..38f0f5f 100644
--- a/xos/core/xoslib/static/js/xosServiceGrid.js
+++ b/xos/core/xoslib/static/js/xosServiceGrid.js
@@ -1 +1 @@
-"use strict";angular.module("xos.serviceGrid",["ngResource","ngCookies","ui.router","xos.helpers"]).config(["$stateProvider",function(e){e.state("serviceGrid",{url:"/",template:"<service-grid></service-grid>"})}]).config(["$httpProvider",function(e){e.interceptors.push("NoHyperlinks")}]).directive("serviceGrid",function(){return{restrict:"E",scope:{},bindToController:!0,controllerAs:"vm",templateUrl:"templates/service-grid.tpl.html",controller:["Services","_",function(e,r){var t=this;this.tableConfig={columns:[{label:"Status",prop:"status",type:"boolean"},{label:"Name",prop:"name",link:function(e){return""+e.view_url.replace(/\$[a-z]+\$/,e.id)}},{label:"Kind",prop:"kind"},{label:"Enabled",prop:"enabled",type:"boolean"}],filter:"field",order:!0},e.query().$promise.then(function(e){t.services=r.map(e,function(e){return e.status=0!==parseInt(e.backend_status.match(/^[0-9]/)[0]),e})})["catch"](function(e){throw new Error(e)})}]}}),angular.module("xos.serviceGrid").run(["$templateCache",function(e){e.put("templates/service-grid.tpl.html",'<div class="row">\n <div class="col-sm-2">\n <a href="/admin/core/service/add" class="btn btn-default btn-block">\n <i class="glyphicon glyphicon-plus"></i>\n Add Service\n </a>\n <!-- <a href="" class="btn btn-default btn-block"></a> -->\n </div>\n <div class="col-sm-10">\n <xos-table config="vm.tableConfig" data="vm.services"></xos-table>\n </div>\n</div>')}]),angular.module("xos.serviceGrid").run(["$location",function(e){e.path("/")}]);
\ No newline at end of file
+"use strict";angular.module("xos.serviceGrid",["ngResource","ngCookies","ui.router","xos.helpers"]).config(["$stateProvider",function(e){e.state("serviceGrid",{url:"/",template:"<service-grid></service-grid>"}).state("serviceGraph",{url:"/graph",template:"<service-graph></service-graph>"})}]).config(["$httpProvider",function(e){e.interceptors.push("NoHyperlinks")}]).directive("serviceGrid",function(){return{restrict:"E",scope:{},bindToController:!0,controllerAs:"vm",templateUrl:"templates/service-grid.tpl.html",controller:["Services","_",function(e,t){var n=this;this.tableConfig={columns:[{label:"Status",prop:"status",type:"boolean"},{label:"Name",prop:"name",link:function(e){return""+e.view_url.replace(/\$[a-z]+\$/,e.id)}},{label:"Kind",prop:"kind"},{label:"Enabled",prop:"enabled",type:"boolean"}],filter:"field",order:!0},e.query().$promise.then(function(e){n.services=t.map(e,function(e){return e.status=0!==parseInt(e.backend_status.match(/^[0-9]/)[0]),e})})["catch"](function(e){throw new Error(e)})}]}}),angular.module("xos.serviceGrid").run(["$templateCache",function(e){e.put("templates/service-graph.tpl.html",'<div class="row">\n <div class="col-sm-10">\n <h1>Graph</h1>\n <ul>\n <li>Use D3 to create a service chart based on coarse services?</li>\n </ul>\n </div>\n <div class="col-sm-2">\n <a href="/admin/core/service/add" class="btn btn-success btn-block">\n <i class="glyphicon glyphicon-plus"></i>\n Add Service\n </a>\n <a href="#/" class="btn btn-default btn-block">\n Service List\n </a>\n </div>\n</div>'),e.put("templates/service-grid.tpl.html",'<div class="row">\n <div class="col-sm-10">\n <xos-table config="vm.tableConfig" data="vm.services"></xos-table>\n </div>\n <div class="col-sm-2">\n <a href="/admin/core/service/add" class="btn btn-success btn-block">\n <i class="glyphicon glyphicon-plus"></i>\n Add Service\n </a>\n <!-- <a href="#/graph" class="btn btn-default btn-block">\n Tenancy Graph\n </a> -->\n </div>\n</div>')}]),function(){angular.module("xos.serviceGrid").directive("serviceGraph",function(){return{restrict:"E",scope:{},bindToController:!0,controllerAs:"vm",templateUrl:"templates/service-graph.tpl.html",controller:["$element","GraphService",function(e,t){var n=void 0,r=e[0],i=void 0,s=void 0,c=function(e){i.attr({transform:function(e){return"translate("+e.x+", "+e.y+")"}}),s.attr("x1",function(e){return e.source.x}).attr("y1",function(e){return e.source.y}).attr("x2",function(e){return e.target.x}).attr("y2",function(e){return e.target.y})};t.loadCoarseData().then(function(e){e.tenants=e.tenants.map(function(e){return{source:e.provider_service,target:e.subscriber_service}}),e.services.push({name:"XOS","class":"xos",x:r.clientWidth/2,y:r.clientHeight/2,fixed:!0}),a(r);var t=d3.layout.force().nodes(e.services).links(e.tenants).charge(-1060).gravity(.1).linkDistance(200).size([r.clientWidth,r.clientHeight]).on("tick",c).start();s=n.selectAll(".link").data(e.tenants).enter().insert("line").attr("class","link"),i=n.selectAll(".node").data(e.services).enter().append("g").call(t.drag).on("mousedown",function(){d3.event.stopPropagation()}),i.append("circle").attr({"class":function(e){return"node "+(e["class"]||"")},r:10}),i.append("text").attr({"text-anchor":"middle"}).text(function(e){return e.name}),i.select("circle").attr({r:function(e){var t=d3.select(this).node().parentNode,n=d3.select(t).select("text").node().getBBox();return n.width/2+10}})});var a=function(e){d3.select(e).select("svg").remove(),n=d3.select(e).append("svg").style("width",e.clientWidth+"px").style("height",e.clientHeight+"px")}}]}})}(),angular.module("xos.serviceGrid").run(["$location",function(e){e.path("/")}]);
\ No newline at end of file
diff --git a/xos/services/vrouter/templates/vrouteradmin.html b/xos/services/vrouter/templates/vrouteradmin.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/xos/services/vrouter/templates/vrouteradmin.html