Updated truckroll dashboard to new generator
diff --git a/views/ngXosLib/karma.conf.views.js b/views/ngXosLib/karma.conf.views.js
index a337b77..fc05c83 100644
--- a/views/ngXosLib/karma.conf.views.js
+++ b/views/ngXosLib/karma.conf.views.js
@@ -14,7 +14,10 @@
let viewFiles = fs.readdirSync(viewDir);
// hack to avoid testing backbone implementation (they need to be removed)
-viewFiles = viewFiles.filter(f => f.indexOf('xosAdminSite') === -1).filter(f => f.indexOf('xosCord') === -1);
+viewFiles = viewFiles
+ .filter(f => f.indexOf('xosAdminSite') === -1)
+ .filter(f => f.indexOf('xosCord') === -1)
+ .filter(f => f.indexOf('xosTenant') === -1);
viewFiles = viewFiles.filter(f => f.indexOf('js') >= 0).filter(f => f.match(/^xos[A-Z][a-z]+/)).map(f => `${viewDir}${f}`);
diff --git a/views/ngXosViews/truckroll/bower.json b/views/ngXosViews/truckroll/bower.json
index 1208905..0cc10f7 100644
--- a/views/ngXosViews/truckroll/bower.json
+++ b/views/ngXosViews/truckroll/bower.json
@@ -14,7 +14,8 @@
"test",
"tests"
],
- "dependencies": {},
+ "dependencies": {
+ },
"devDependencies": {
"jquery": "2.1.4",
"angular-mocks": "1.4.7",
@@ -25,9 +26,7 @@
"angular-resource": "1.4.7",
"lodash": "~4.11.1",
"bootstrap-css": "3.3.6",
- "angular-chart.js": "~0.10.2"
- },
- "resolutions": {
- "angular": "1.4.7"
+ "angular-chart.js": "~0.10.2",
+ "d3": "~3.5.17"
}
}
diff --git a/views/ngXosViews/truckroll/spec/sample.test.js b/views/ngXosViews/truckroll/spec/sample.test.js
index 75a8a56..06ebc1b 100644
--- a/views/ngXosViews/truckroll/spec/sample.test.js
+++ b/views/ngXosViews/truckroll/spec/sample.test.js
@@ -11,7 +11,7 @@
httpBackend = $httpBackend;
// Setting up mock request
- $httpBackend.expectGET('/api/core/users/?no_hyperlinks=1').respond([
+ $httpBackend.expectGET('/api/tenant/cord/subscriber/?no_hyperlinks=1').respond([
{
email: 'teo@onlab.us',
firstname: 'Matteo',
@@ -20,7 +20,7 @@
]);
scope = $rootScope.$new();
- element = angular.element('<users-list></users-list>');
+ element = angular.element('<truckroll></truckroll>');
$compile(element)(scope);
scope.$digest();
isolatedScope = element.isolateScope().vm;
@@ -28,10 +28,7 @@
it('should load 1 users', () => {
httpBackend.flush();
- expect(isolatedScope.users.length).toBe(1);
- expect(isolatedScope.users[0].email).toEqual('teo@onlab.us');
- expect(isolatedScope.users[0].firstname).toEqual('Matteo');
- expect(isolatedScope.users[0].lastname).toEqual('Scandolo');
+ expect(isolatedScope.subscribers.length).toBe(1);
});
});
\ No newline at end of file
diff --git a/views/ngXosViews/truckroll/src/index.html b/views/ngXosViews/truckroll/src/index.html
index b10d06b..bb4f072 100644
--- a/views/ngXosViews/truckroll/src/index.html
+++ b/views/ngXosViews/truckroll/src/index.html
@@ -27,6 +27,7 @@
<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>
+<script src="vendor/d3/d3.js"></script>
<!-- endbower -->
<!-- endjs -->
<!-- inject:js -->
diff --git a/views/ngXosViews/truckroll/src/js/main.js b/views/ngXosViews/truckroll/src/js/main.js
index 20692c8..1004cb1 100644
--- a/views/ngXosViews/truckroll/src/js/main.js
+++ b/views/ngXosViews/truckroll/src/js/main.js
@@ -29,12 +29,6 @@
this.subscribers = subscribers;
});
- $log.log('Truckorll Component!');
- $log.info('Truckorll Component!');
- $log.warn('Truckorll Component!');
- $log.error('Truckorll Component!');
- $log.debug('Truckorll Component!');
-
this.loader = false;
this.runTest = () => {
diff --git a/xos/core/xoslib/dashboards/xosTruckroll.html b/xos/core/xoslib/dashboards/xosTruckroll.html
index e8bb216..2068e6c 100644
--- a/xos/core/xoslib/dashboards/xosTruckroll.html
+++ b/xos/core/xoslib/dashboards/xosTruckroll.html
@@ -1,14 +1,16 @@
<!-- browserSync -->
+<!-- endcss -->
<!-- inject:css -->
<link rel="stylesheet" href="/static/css/xosTruckroll.css">
<!-- endinject -->
-<div id="xosTruckroll">
- <div ui-view></div>
+<div ng-app="xos.truckroll" id="xosTruckroll" class="container-fluid">
+ <div ui-view></div>
</div>
+<!-- endjs -->
<!-- inject:js -->
<script src="/static/js/xosTruckroll.js"></script>
-<!-- endinject -->
+<!-- endinject -->
\ No newline at end of file
diff --git a/xos/core/xoslib/static/css/xosTruckroll.css b/xos/core/xoslib/static/css/xosTruckroll.css
index 66136da..3d1fd2f 100644
--- a/xos/core/xoslib/static/css/xosTruckroll.css
+++ b/xos/core/xoslib/static/css/xosTruckroll.css
@@ -1 +1,2 @@
+
.row+.row{margin-top:20px}.animate-vertical.ng-hide-add{animation:.5s slideOutDown ease-in-out}.animate-vertical.ng-hide-remove{animation:.5s slideInUp ease-in-out}@keyframes slideInUp{from{transform:translate3d(0,100%,0);opacity:0}to{transform:translate3d(0,0,0);opacity:1}}@keyframes slideOutDown{from{transform:translate3d(0,0,0);opacity:1}to{opacity:0;transform:translate3d(0,100%,0)}}.loader{font-size:10px;margin:0 auto;text-indent:-9999em;width:11em;height:11em;border-radius:50%;background:#fff;background:linear-gradient(to right,#fff 10%,rgba(255,255,255,0) 42%);position:relative;animation:load3 1.4s infinite linear;transform:translateZ(0)}.loader:before{width:50%;height:50%;background:#105e9e;border-radius:100% 0 0;position:absolute;top:0;left:0;content:''}.loader:after{background:#fff;width:75%;height:75%;border-radius:50%;content:'';margin:auto;position:absolute;top:0;left:0;bottom:0;right:0}@keyframes load3{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}
\ No newline at end of file
diff --git a/xos/core/xoslib/static/js/xosTruckroll.js b/xos/core/xoslib/static/js/xosTruckroll.js
index f231499..f6bc6dd 100644
--- a/xos/core/xoslib/static/js/xosTruckroll.js
+++ b/xos/core/xoslib/static/js/xosTruckroll.js
@@ -1 +1 @@
-"use strict";angular.module("xos.truckroll",["ngResource","ngCookies","ngLodash","ui.router","xos.helpers"]).config(["$stateProvider",function(l){l.state("user-list",{url:"/",template:"<truckroll></truckroll>"})}]).config(["$httpProvider",function(l){l.interceptors.push("NoHyperlinks")}]).service("Subscribers",["$resource",function(l){return l("/xos/subscribers/:id")}]).service("Truckroll",["$resource",function(l){return l("/xoslib/truckroll/:id")}]).directive("truckroll",function(){return{restrict:"E",scope:{},bindToController:!0,controllerAs:"vm",templateUrl:"templates/truckroll.tpl.html",controller:["$timeout","Subscribers","Truckroll",function(l,n,t){var s=this;n.query().$promise.then(function(l){s.subscribers=l}),this.loader=!1,this.runTest=function(){delete s.truckroll.result,delete s.truckroll.is_synced,delete s.truckroll.result_code,delete s.truckroll.backend_status;var l=new t(s.truckroll);s.loader=!0,l.$save().then(function(l){s.waitForTest(l.id)})},this.waitForTest=function(n){t.get({id:n}).$promise.then(function(r){r.backend_status.indexOf("2")>=0||r.result_code&&r.result_code.indexOf("2")>=0||r.is_synced?(s.truckroll=angular.copy(r),s.loader=!1,t["delete"]({id:n})):l(function(){s.waitForTest(n)},2e3)})}}]}}),angular.module("xos.truckroll").run(["$templateCache",function(l){l.put("templates/truckroll.tpl.html",'<div class="row">\n <div class="col-xs-12">\n <h2>Virtual Truck Roll</h2>\n <p>Use this page to run test against your subscriber</p>\n </div>\n</div>\n<form ng-submit="vm.runTest()">\n <div class="row">\n <div class="col-xs-12">\n <label>Target:</label>\n </div>\n <div class="col-xs-12">\n <select class="form-control" ng-model="vm.truckroll.target_id" ng-options="s.id as s.humanReadableName for s in vm.subscribers"></select>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Scope:</label>\n </div>\n <div class="col-xs-6">\n <a \n ng-click="vm.truckroll.scope = \'container\'"\n ng-class="{\'btn-default\': vm.truckroll.scope !== \'container\', \'btn-primary\': vm.truckroll.scope === \'container\'}"\n class="btn btn-block"\n >\n Container\n </a>\n </div>\n <div class="col-xs-6">\n <a \n ng-click="vm.truckroll.scope = \'vm\'"\n ng-class="{\'btn-default\': vm.truckroll.scope !== \'vm\', \'btn-primary\': vm.truckroll.scope === \'vm\'}"\n class="btn btn-block"\n >\n VM\n </a>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Test:</label>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'ping\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'ping\', \'btn-primary\': vm.truckroll.test === \'ping\'}"\n class="btn btn-block">Ping</a>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'traceroute\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'traceroute\', \'btn-primary\': vm.truckroll.test === \'traceroute\'}"\n class="btn btn-block">Traceroute</a>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'tcpdump\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'tcpdump\', \'btn-primary\': vm.truckroll.test === \'tcpdump\'}"\n class="btn btn-block">Tcp Dump</a>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Argument:</label>\n </div>\n <div class="col-xs-12">\n <input type="text" class="form-control" ng-model="vm.truckroll.argument" required />\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12" ng-show="!vm.loader">\n <button class="btn btn-success btn-block">Run test</button>\n </div>\n </div>\n</form>\n<div class="row">\n <div class="col-xs-12 animate-vertical" ng-show="vm.loader">\n <div class="loader"></div>\n </div>\n </div>\n <div class="row" ng-hide="!vm.truckroll.result_code">\n <div class="col-xs-12">\n <label>Result Code</label>\n </div>\n <div class="col-xs-12">\n <pre>{{vm.truckroll.result_code}}</pre>\n </div>\n </div>\n <div class="row" ng-hide="!vm.truckroll.result">\n <div class="col-xs-12">\n <label>\n Result:\n </label>\n </div>\n <div class="col-xs-12">\n <pre>{{vm.truckroll.result}}</pre>\n </div>\n </div>\n <div class="row" ng-hide="!vm.truckroll.backend_status">\n <div class="col-xs-12">\n <label>Backend Status</label>\n </div>\n <div class="col-xs-12">\n <pre>{{vm.truckroll.backend_status}}</pre>\n </div>\n </div>')}]),angular.module("xos.truckroll").run(["$location",function(l){l.path("/")}]),angular.bootstrap(angular.element("#xosTruckroll"),["xos.truckroll"]);
\ No newline at end of file
+"use strict";angular.module("xos.truckroll",["ngResource","ngCookies","ui.router","xos.helpers"]).config(["$stateProvider",function(l){l.state("user-list",{url:"/",template:"<truckroll></truckroll>"})}]).config(["$httpProvider",function(l){l.interceptors.push("NoHyperlinks")}]).directive("truckroll",function(){return{restrict:"E",scope:{},bindToController:!0,controllerAs:"vm",templateUrl:"templates/truckroll.tpl.html",controller:["$timeout","$log","Subscribers","Truckroll",function(l,n,t,s){var r=this;t.query().$promise.then(function(l){r.subscribers=l}),this.loader=!1,this.runTest=function(){delete r.truckroll.result,delete r.truckroll.is_synced,delete r.truckroll.result_code,delete r.truckroll.backend_status;var l=new s(r.truckroll);r.loader=!0,l.$save().then(function(l){r.waitForTest(l.id)})},this.waitForTest=function(n){s.get({id:n}).$promise.then(function(t){t.backend_status.indexOf("2")>=0||t.result_code&&t.result_code.indexOf("2")>=0||t.is_synced?(r.truckroll=angular.copy(t),r.loader=!1,s["delete"]({id:n})):l(function(){r.waitForTest(n)},2e3)})}}]}}),angular.module("xos.truckroll").run(["$templateCache",function(l){l.put("templates/truckroll.tpl.html",'<div class="row">\n <div class="col-xs-12">\n <h2>Virtual Truck Roll</h2>\n <p>Use this page to run test against your subscriber</p>\n </div>\n</div>\n<form ng-submit="vm.runTest()">\n <div class="row">\n <div class="col-xs-12">\n <label>Target:</label>\n </div>\n <div class="col-xs-12">\n <select class="form-control" ng-model="vm.truckroll.target_id" ng-options="s.id as s.humanReadableName for s in vm.subscribers"></select>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Scope:</label>\n </div>\n <div class="col-xs-6">\n <a \n ng-click="vm.truckroll.scope = \'container\'"\n ng-class="{\'btn-default\': vm.truckroll.scope !== \'container\', \'btn-primary\': vm.truckroll.scope === \'container\'}"\n class="btn btn-block"\n >\n Container\n </a>\n </div>\n <div class="col-xs-6">\n <a \n ng-click="vm.truckroll.scope = \'vm\'"\n ng-class="{\'btn-default\': vm.truckroll.scope !== \'vm\', \'btn-primary\': vm.truckroll.scope === \'vm\'}"\n class="btn btn-block"\n >\n VM\n </a>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Test:</label>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'ping\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'ping\', \'btn-primary\': vm.truckroll.test === \'ping\'}"\n class="btn btn-block">Ping</a>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'traceroute\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'traceroute\', \'btn-primary\': vm.truckroll.test === \'traceroute\'}"\n class="btn btn-block">Traceroute</a>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'tcpdump\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'tcpdump\', \'btn-primary\': vm.truckroll.test === \'tcpdump\'}"\n class="btn btn-block">Tcp Dump</a>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Argument:</label>\n </div>\n <div class="col-xs-12">\n <input type="text" class="form-control" ng-model="vm.truckroll.argument" required />\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12" ng-show="!vm.loader">\n <button class="btn btn-success btn-block">Run test</button>\n </div>\n </div>\n</form>\n<div class="row">\n <div class="col-xs-12 animate-vertical" ng-show="vm.loader">\n <div class="loader"></div>\n </div>\n </div>\n <div class="row" ng-hide="!vm.truckroll.result_code">\n <div class="col-xs-12">\n <label>Result Code</label>\n </div>\n <div class="col-xs-12">\n <pre>{{vm.truckroll.result_code}}</pre>\n </div>\n </div>\n <div class="row" ng-hide="!vm.truckroll.result">\n <div class="col-xs-12">\n <label>\n Result:\n </label>\n </div>\n <div class="col-xs-12">\n <pre>{{vm.truckroll.result}}</pre>\n </div>\n </div>\n <div class="row" ng-hide="!vm.truckroll.backend_status">\n <div class="col-xs-12">\n <label>Backend Status</label>\n </div>\n <div class="col-xs-12">\n <pre>{{vm.truckroll.backend_status}}</pre>\n </div>\n </div>'),l.put("templates/users-list.tpl.html",'<xos-table config="vm.tableConfig" data="vm.users"></xos-table>')}]),angular.module("xos.truckroll").run(["$location",function(l){l.path("/")}]);
\ No newline at end of file