xosDeveloper view working
diff --git a/planetstack/core/xoslib/dashboards/xosDeveloper.html b/planetstack/core/xoslib/dashboards/xosDeveloper.html
index c6002d7..33d7ee7 100644
--- a/planetstack/core/xoslib/dashboards/xosDeveloper.html
+++ b/planetstack/core/xoslib/dashboards/xosDeveloper.html
@@ -24,6 +24,6 @@
</script>
<script type="text/template" id="developer-slicedetail-template">
- <td><%= name %></td>
+ <td><%= name %></td><td><%= sliceInfo.roles[0] %></td><td><%= sliceInfo.sliverCount %></td><td><%= sliceInfo.siteCount %></td>
</script>
diff --git a/planetstack/core/xoslib/methods/__init__.py b/planetstack/core/xoslib/methods/__init__.py
index 6c75063..0b891eb 100644
--- a/planetstack/core/xoslib/methods/__init__.py
+++ b/planetstack/core/xoslib/methods/__init__.py
@@ -37,9 +37,9 @@
for view_url in view_urls:
if view_url[0] == "list":
- urlpatterns.append(url(r'^xoslib/' + view_url[1] + '/$', view_url[3].as_view(), name=view_url[1]+'list'))
+ urlpatterns.append(url(r'^' + view_url[1] + '/$', view_url[3].as_view(), name=view_url[1]+'list'))
elif view_url[0] == "detail":
- urlpatterns.append(url(r'^xoslib/' + view_url[1] + '/(?P<pk>[a-zA-Z0-9\-]+)/$', view_url[3].as_view(), name=view_url[1]+'list'))
+ urlpatterns.append(url(r'^' + view_url[1] + '/(?P<pk>[a-zA-Z0-9\-]+)/$', view_url[3].as_view(), name=view_url[1]+'detail'))
finally:
sys.path = sys_path_save
diff --git a/planetstack/core/xoslib/methods/sliceplus.py b/planetstack/core/xoslib/methods/sliceplus.py
index 79aae3b..f990275 100644
--- a/planetstack/core/xoslib/methods/sliceplus.py
+++ b/planetstack/core/xoslib/methods/sliceplus.py
@@ -13,7 +13,7 @@
sliceInfo = serializers.SerializerMethodField("getSliceInfo")
def getSliceInfo(self, slice):
- return slice.getSliceInfo()
+ return slice.getSliceInfo(user=self.context['request'].user)
networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
availableNetworks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
@@ -26,6 +26,9 @@
queryset = SlicePlus.objects.select_related().all()
serializer_class = SlicePlusIdSerializer
+ method_kind = "list"
+ method_name = "slicesplus"
+
def get_queryset(self):
return SlicePlus.select_by_user(self.request.user)
@@ -41,6 +44,9 @@
queryset = SlicePlus.objects.select_related().all()
serializer_class = SlicePlusIdSerializer
+ method_kind = "detail"
+ method_name = "slicesplus"
+
def get_queryset(self):
return SlicePlus.select_by_user(self.request.user)
diff --git a/planetstack/core/xoslib/objects/sliceplus.py b/planetstack/core/xoslib/objects/sliceplus.py
index e35f4d1..2542fd7 100644
--- a/planetstack/core/xoslib/objects/sliceplus.py
+++ b/planetstack/core/xoslib/objects/sliceplus.py
@@ -27,12 +27,9 @@
@staticmethod
def select_by_user(user):
- print "XX"
if user.is_admin:
qs = SlicePlus.objects.all()
else:
slice_ids = [sp.slice.id for sp in SlicePrivilege.objects.filter(user=user)]
qs = SlicePlus.objects.filter(id__in=slice_ids)
- print qs
- print qs.all()
return qs
diff --git a/planetstack/core/xoslib/static/js/xosDeveloper.js b/planetstack/core/xoslib/static/js/xosDeveloper.js
index 5e81d85..eb83efe 100644
--- a/planetstack/core/xoslib/static/js/xosDeveloper.js
+++ b/planetstack/core/xoslib/static/js/xosDeveloper.js
@@ -10,20 +10,30 @@
className: 'developer_slicedetail'
});
+/*
DeveloperApp.SliceListView = Marionette.CollectionView.extend({
tagName: "table",
+ className: "table table-hover",
+ template: "#developer-slicetable-template",
+ childView: DeveloperApp.SliceDetailView,
+});
+*/
+
+DeveloperApp.SliceListView = Marionette.CompositeView.extend({
+ tagName: "table",
className: "table-striped table-bordered",
template: "#developer-slicetable-template",
childView: DeveloperApp.SliceDetailView,
+ childViewContainer: "tbody",
});
DeveloperApp.on("start", function() {
var developerSliceListView = new DeveloperApp.SliceListView({
- collection: xos.slices
+ collection: xos.slicesPlus
});
console.log(developerSliceListView);
DeveloperApp.mainRegion.show(developerSliceListView);
- xos.slices.fetch();
+ xos.slicesPlus.fetch();
});
$(document).ready(function(){
diff --git a/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js b/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js
index b113535..59645e7 100644
--- a/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js
+++ b/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js
@@ -5,6 +5,8 @@
USER_API = "/plstackapi/users/";
DEPLOYMENT_API = "/plstackapi/deployments";
+SLICEPLUS_API = "/xoslib/slicesplus/";
+
XOSModel = Backbone.Model.extend({
/* from backbone-tastypie.js */
//idAttribute: 'resource_uri',
@@ -119,6 +121,7 @@
});
function xoslib() {
+ // basic REST
this.sliver = XOSModel.extend({ urlRoot: SLIVER_API });
this.sliverCollection = XOSCollection.extend({ urlRoot: SLIVER_API,
model: this.sliver});
@@ -149,6 +152,12 @@
model: this.deployment});
this.deployments = new this.deploymentCollection();
+ // enhanced REST
+ this.slicePlus = XOSModel.extend({ urlRoot: SLICEPLUS_API });
+ this.slicePlusCollection = XOSCollection.extend({ urlRoot: SLICEPLUS_API,
+ model: this.slicePlus});
+ this.slicesPlus = new this.slicePlusCollection();
+
this.listObjects = function() { return ["slivers", "slices", "nodes", "sites", "users", "deployments"]; };
};