add userDeployments to xoslib test
diff --git a/planetstack/core/xoslib/static/js/test.js b/planetstack/core/xoslib/static/js/test.js
index 76d131c..54d5835 100644
--- a/planetstack/core/xoslib/static/js/test.js
+++ b/planetstack/core/xoslib/static/js/test.js
@@ -49,7 +49,7 @@
};
TestApp.on("start", function() {
- var objs = ['deployment', 'image', 'networkTemplate', 'network', 'networkSliver', 'node', 'service', 'site', 'slice', 'sliceDeployment', 'slicePrivilege', 'sliver', 'user', 'sliceRole'];
+ var objs = ['deployment', 'image', 'networkTemplate', 'network', 'networkSliver', 'node', 'service', 'site', 'slice', 'sliceDeployment', 'slicePrivilege', 'sliver', 'user', 'sliceRole', 'userDeployment'];
for (var index in objs) {
name = objs[index];
diff --git a/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js b/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js
index 87660df..af97303 100644
--- a/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js
+++ b/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js
@@ -9,6 +9,7 @@
NODE_API = "/plstackapi/nodes/";
SITE_API = "/plstackapi/sites/";
USER_API = "/plstackapi/users/";
+ USERDEPLOYMENT_API = "/plstackapi/user_deployments/";
DEPLOYMENT_API = "/plstackapi/deployments/";
IMAGE_API = "/plstackapi/images/";
NETWORKTEMPLATE_API = "/plstackapi/networktemplates/";
@@ -224,9 +225,17 @@
this.user = XOSModel.extend({ urlRoot: USER_API });
this.userCollection = XOSCollection.extend({ urlRoot: USER_API,
+ relatedCollections: {"slicePrivileges": "user", "slices": "owner", "userDeployments": "user"},
+ foreignCollections: ["sites"],
model: this.user});
this.users = new this.userCollection();
+ this.userDeployment = XOSModel.extend({ urlRoot: USER_API });
+ this.userDeploymentCollection = XOSCollection.extend({ urlRoot: USERDEPLOYMENT_API,
+ foreignCollections: ["users","deployments"],
+ model: this.user});
+ this.userDeployments = new this.userDeploymentCollection();
+
this.deployment = XOSModel.extend({ urlRoot: DEPLOYMENT_API });
this.deploymentCollection = XOSCollection.extend({ urlRoot: DEPLOYMENT_API,
model: this.deployment});
diff --git a/planetstack/core/xoslib/templates/xosAdmin.html b/planetstack/core/xoslib/templates/xosAdmin.html
index 9b75bce..443b654 100644
--- a/planetstack/core/xoslib/templates/xosAdmin.html
+++ b/planetstack/core/xoslib/templates/xosAdmin.html
@@ -527,7 +527,7 @@
<td><%= lastname %></td>
<td><%= phone %></td>
<td><%= user_url %></td>
- <td><%= site %></td>
+ <td><%= idToName(site,"sites","name") %></td>
</script>
<script type="text/template" id="xosAdmin-user-detail-template">
@@ -545,3 +545,37 @@
</form>
</script>
+<!-- UserDeployments -->
+
+<script type="text/template" id="xosAdmin-userDeployment-list-template">
+ <h3><%= title %></h3>
+ <table class="test-table">
+ <thead><tr>
+ <th>id</th>
+ <th>user</th>
+ <th>deployment</th>
+ <th>kuser_id</th>
+ </tr></thead>
+ <tbody></tbody>
+ </table>
+</script>
+
+
+<script type="text/template" id="xosAdmin-userDeployment-listitem-template">
+ <td class="objectLink"><%= id %></td>
+ <td><%= idToName(user,"users","username") %></td>
+ <td><%= idToName(deployment,"deployments","name") %></td>
+ <td><%= kuser_id %></td>
+</script>
+
+<script type="text/template" id="xosAdmin-userDeployment-detail-template">
+ <h3>Detail View: User</h3>
+ <form>
+ <table>
+ <tr><td>User:</td><td><input type="text" name="user" value="<%= user %>"></td></tr>
+ <tr><td>Deployment:</td><td><input type="text" name="deployment" value="<%= deployment %>"></td></tr>
+ <tr><td>kuser_id:</td><td><input type="text" name="kuser_id" value="<%= kuser_id %>"></td></tr>
+ <tr><td colspan=2><button class="btn js-submit">Save</button></td></tr>
+ </table>
+ </form>
+</script>