From 31e340af19e689e4550759a1228de179370a652a Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Sun, 2 Nov 2014 22:28:59 -0800 Subject: [PATCH] use html select in detail views --- planetstack/core/xoslib/static/js/test.js | 23 +++++++++++++++++++ .../xoslib/static/js/xoslib/xos-backbone.js | 1 + .../core/xoslib/templates/xosAdmin.html | 18 +++++++-------- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/planetstack/core/xoslib/static/js/test.js b/planetstack/core/xoslib/static/js/test.js index 9d55526..9de80b7 100644 --- a/planetstack/core/xoslib/static/js/test.js +++ b/planetstack/core/xoslib/static/js/test.js @@ -48,6 +48,29 @@ idToName = function(id, collectionName, fieldName) { } }; +idToOptions = function(id, collectionName, fieldName) { + result="" + for (index in xos[collectionName].models) { + linkedObject = xos[collectionName].models[index]; + linkedId = linkedObject["id"]; + linkedName = linkedObject.attributes[fieldName]; + if (linkedId == id) { + selected = " selected"; + } else { + selected = ""; + } + result = result + ''; + } + return result; +}; + +idToSelect = function(variable, id, collectionName, fieldName) { + result = ''; + return result; +} + TestApp.on("start", function() { var objs = ['deployment', 'image', 'networkTemplate', 'network', 'networkSliver', 'networkDeployment', 'node', 'service', 'site', 'slice', 'sliceDeployment', 'slicePrivilege', 'sliver', 'user', 'sliceRole', 'userDeployment']; diff --git a/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js b/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js index ac16b60..6216396 100644 --- a/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js +++ b/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js @@ -239,6 +239,7 @@ if (! window.XOSLIB_LOADED ) { this.deployment = XOSModel.extend({ urlRoot: DEPLOYMENT_API }); this.deploymentCollection = XOSCollection.extend({ urlRoot: DEPLOYMENT_API, + relatedCollections: {"slivers": "deployment", "networkDeployments": "deployment", "userDeployments": "deployment"}, model: this.deployment}); this.deployments = new this.deploymentCollection(); diff --git a/planetstack/core/xoslib/templates/xosAdmin.html b/planetstack/core/xoslib/templates/xosAdmin.html index 26119b8..0ba63ec 100644 --- a/planetstack/core/xoslib/templates/xosAdmin.html +++ b/planetstack/core/xoslib/templates/xosAdmin.html @@ -146,10 +146,10 @@
- + - +
Name:
Template:
Template:<%= idToSelect("template",template,"networkTemplates","name") %>
Ports:
Labels:
Owner:
Owner:<%= idToSelect("owner",owner,"slices","name") %>
@@ -254,8 +254,8 @@
- - + +
Name:
Site:
Deployment:
Site:<%= idToSelect("site",site,"sites","name") %>
Deployment:<%= idToSelect("deployment",deployment,"deployments","name") %>
@@ -415,7 +415,7 @@ - +