display 'no slices' when there are no slices
diff --git a/planetstack/core/xoslib/dashboards/xosTenant.html b/planetstack/core/xoslib/dashboards/xosTenant.html
index 16e60f0..01b354c 100644
--- a/planetstack/core/xoslib/dashboards/xosTenant.html
+++ b/planetstack/core/xoslib/dashboards/xosTenant.html
@@ -26,6 +26,12 @@
</div>
</script>
+<script type="text/template" id="xos-tenant-buttons-noslice-template">
+ <div class="box save-box">
+ <button class="btn btn-high btn-tenant-create">Create New Slice</button>
+ </div>
+</script>
+
<script type="text/template" id="xos-log-template">
<tr id="<%= logMessageId %>" class="xos-log xos-<%= statusclass %>">
<td><%= what %><br>
diff --git a/planetstack/core/xoslib/static/js/xosTenant.js b/planetstack/core/xoslib/static/js/xosTenant.js
index fc510f3..4c70f70 100644
--- a/planetstack/core/xoslib/static/js/xosTenant.js
+++ b/planetstack/core/xoslib/static/js/xosTenant.js
@@ -231,31 +231,40 @@
model = xos.slicesPlus.models[0];
}
- sliceSelector = new XOSTenantApp.tenantSliceSelectorView({collection: xos.slicesPlus,
- selectedID: model.id,
- } );
- XOSTenantApp.sliceSelector = sliceSelector;
- XOSTenantApp.tenantSliceSelector.show(sliceSelector);
+ if (model) {
+ sliceSelector = new XOSTenantApp.tenantSliceSelectorView({collection: xos.slicesPlus,
+ selectedID: model ? model.id : null,
+ } );
+ XOSTenantApp.sliceSelector = sliceSelector;
+ XOSTenantApp.tenantSliceSelector.show(sliceSelector);
- tenantSummary = new XOSTenantApp.tenantSummaryView({model: model,
- choices: {mount_data_sets: make_choices(xos.tenant().public_volume_names, null),
- serviceClass: make_choices(xos.tenant().blessed_service_class_names, xos.tenant().blessed_service_classes),
- default_image: make_choices(xos.tenant().blessed_image_names, xos.tenant().blessed_images),
- default_flavor: make_choices(xos.tenant().blessed_flavor_names, xos.tenant().blessed_flavors),},
- });
- XOSTenantApp.tenantSummary.show(tenantSummary);
+ tenantSummary = new XOSTenantApp.tenantSummaryView({model: model,
+ choices: {mount_data_sets: make_choices(xos.tenant().public_volume_names, null),
+ serviceClass: make_choices(xos.tenant().blessed_service_class_names, xos.tenant().blessed_service_classes),
+ default_image: make_choices(xos.tenant().blessed_image_names, xos.tenant().blessed_images),
+ default_flavor: make_choices(xos.tenant().blessed_flavor_names, xos.tenant().blessed_flavors),},
+ });
+ XOSTenantApp.tenantSummary.show(tenantSummary);
- tenantSites = new XOSTenantSiteCollection();
- tenantSites.getFromSlice(model);
- model.tenantSiteCollection = tenantSites;
- XOSTenantApp.tenantSites = tenantSites;
+ tenantSites = new XOSTenantSiteCollection();
+ tenantSites.getFromSlice(model);
+ model.tenantSiteCollection = tenantSites;
+ XOSTenantApp.tenantSites = tenantSites;
- tenantSiteList = new XOSTenantApp.tenantSiteListView({collection: tenantSites });
- XOSTenantApp.tenantSiteList.show(tenantSiteList);
- // on xos.slicePlus.sort, need to update xostenantapp.tenantSites
+ tenantSiteList = new XOSTenantApp.tenantSiteListView({collection: tenantSites });
+ XOSTenantApp.tenantSiteList.show(tenantSiteList);
+ // on xos.slicePlus.sort, need to update xostenantapp.tenantSites
- XOSTenantApp.tenantButtons.show( new XOSTenantButtonView( { app: XOSTenantApp,
- linkedView: tenantSummary } ) );
+ XOSTenantApp.tenantButtons.show( new XOSTenantButtonView( { app: XOSTenantApp,
+ linkedView: tenantSummary } ) );
+ } else {
+ XOSTenantApp.tenantSliceSelector.show(new HTMLView({html: ""}));
+ XOSTenantApp.tenantSummary.show(new HTMLView({html: "You have no slices"}));
+ XOSTenantApp.tenantSiteList.show(new HTMLView({html: ""}));
+ XOSTenantApp.tenantButtons.show( new XOSTenantButtonView( { template: "#xos-tenant-buttons-noslice-template",
+ app: XOSTenantApp,
+ linkedView: tenantSummary } ) );
+ }
};
XOSTenantApp.sanityCheck = function() {