From: Scott Baker Date: Tue, 28 Oct 2014 06:02:48 +0000 (-0700) Subject: the big xoslib test, WIP X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=ee45e1e25d5e1e2a33a199683cc78cd2e78631b6;p=plstackapi.git the big xoslib test, WIP --- diff --git a/planetstack/core/xoslib/dashboards/test.html b/planetstack/core/xoslib/dashboards/test.html new file mode 100644 index 0000000..f176ecc --- /dev/null +++ b/planetstack/core/xoslib/dashboards/test.html @@ -0,0 +1,298 @@ + + + + + + + + + + + + +

This shows all of the things you can see using xosLib

+ +

Deployments

+
+
+ +

Images

+
+
+ +

Network Templates

+
+
+ +

Networks

+
+
+ +

Nodes

+
+
+ +

Services

+
+
+ +

Sites

+
+
+ +

Slices

+
+
+ +

Slivers

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/planetstack/core/xoslib/static/css/test.css b/planetstack/core/xoslib/static/css/test.css new file mode 100644 index 0000000..3444fdb --- /dev/null +++ b/planetstack/core/xoslib/static/css/test.css @@ -0,0 +1,4 @@ +.test-table td, th { + border: 1px solid black; +} + diff --git a/planetstack/core/xoslib/static/js/test.js b/planetstack/core/xoslib/static/js/test.js new file mode 100644 index 0000000..bc7f955 --- /dev/null +++ b/planetstack/core/xoslib/static/js/test.js @@ -0,0 +1,71 @@ +TestApp = new Marionette.Application(); + +TestApp.addRegions({ + deploymentList: "#deploymentList", + imageList: "#imageList", + networkTemplateList: "#networkTemplateList", + networkList: "#networkList", + nodeList: "#nodeList", + serviceList: "#serviceList", + siteList: "#siteList", + sliceList: "#sliceList", + sliverList: "#sliverList", + userList: "#userList" +}); + +// ---- Deployment ---- + +TestApp.DeploymentListItemView = Marionette.ItemView.extend({ + template: '#test-deployment-listitem-template', + tagName: 'tr', + className: 'test-tablerow', +}); + +TestApp.DeploymentListView = Marionette.CompositeView.extend({ + childView: TestApp.DeploymentListItemView, + childViewContainer: 'tbody', + template: '#test-deployment-list-template', + + initialize: function() { + this.listenTo(this.collection, 'change', this._renderChildren) + }, +}); + +TestApp.on("start", function() { + var objs = ['deployment', 'image', 'networkTemplate', 'network', 'node', 'service', 'site', 'slice', 'sliver']; + + for (var index in objs) { + name = objs[index]; + tr_template = '#test-' + name + '-listitem-template'; + table_template = '#test-' + name + '-list-template'; + collection_name = name + "s"; + region_name = name + "List"; + + itemViewClass = Marionette.ItemView.extend({ + template: tr_template, + tagName: 'tr', + className: 'test-tablerow', + }); + + listViewClass = Marionette.CompositeView.extend({ + childView: itemViewClass, + childViewContainer: 'tbody', + template: table_template, + collection: xos[collection_name], + + initialize: function() { + this.listenTo(this.collection, 'change', this._renderChildren) + }, + }); + + var listView = new listViewClass(); + + TestApp[region_name].show(listView); + xos[collection_name].startPolling(); + } +}); + +$(document).ready(function(){ + TestApp.start(); +}); +