X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetstack%2Fcore%2Fxoslib%2Fstatic%2Fjs%2FxosTenant.js;h=0ab8e819378a4d045a08b817979b9f7b03ae3cb2;hb=f6f70ea6c7bb44df898b085ba27120a8d72ae6f2;hp=48ac835e34511feee66dadf629ff8cad7c331bef;hpb=9a0cf3ac9db8a99b8f9477b8798c076d87645b42;p=plstackapi.git diff --git a/planetstack/core/xoslib/static/js/xosTenant.js b/planetstack/core/xoslib/static/js/xosTenant.js index 48ac835..0ab8e81 100644 --- a/planetstack/core/xoslib/static/js/xosTenant.js +++ b/planetstack/core/xoslib/static/js/xosTenant.js @@ -102,7 +102,12 @@ XOSTenantApp.buildViews = function() { tenantSummaryClass = XOSDetailView.extend({template: "#xos-detail-template", app: XOSTenantApp, detailFields: ["serviceClass", "default_image", "default_flavor", "network_ports", "mount_data_sets"], - fieldDisplayNames: {serviceClass: "Service Level", "default_flavor": "Flavor", "default_image": "Image"}, + fieldDisplayNames: {serviceClass: "Service Level", "default_flavor": "Flavor", "default_image": "Image", "mount_data_sets": "Data Sets"}, + + onShow: function() { + // the slice selector is in a different table, so make every label cell the maximal width + make_same_width("#xos-tenant-view-panel", ".xos-label-cell"); + }, }); XOSTenantApp.tenantSummaryView = tenantSummaryClass; @@ -125,6 +130,9 @@ XOSTenantApp.buildViews = function() { title: "sites", inputType: {allocated: "spinner"}, noDeleteColumn: true, + disablePaginate: true, + disableFilter: true, + fieldDisplayNames: {"name": "Site"}, }); XOSTenantApp.tenantSiteListView = tenantSiteListClass; @@ -168,12 +176,19 @@ XOSTenantApp.adjustCollectionField = function(collectionName, id, fieldName, amo XOSTenantApp.addSlice = function() { var app=this; + + if (!xos.tenant().current_user_can_create_slice) { + window.alert("You do not have sufficient rights to create a slice on your site"); + return; + } + model = new xos.slicesPlus.model({site: xos.tenant().current_user_site_id, - name: xos.tenant().current_user_login_base + "_"}); + name: xos.tenant().current_user_login_base + "_", + creator: xos.tenant().current_user_id}); console.log(model); var detailView = new XOSTenantApp.tenantAddView({model: model, - collection: xos.slicesPlus, - noSubmitButton: true, + collection: xos.slicesPlus, + noSubmitButton: true, }); detailView.dialog = $("#tenant-addslice-dialog"); app.tenantAddSliceInterior.show(detailView); @@ -250,6 +265,8 @@ XOSTenantApp.viewSlice = function(model) { tenantSites = new XOSTenantSiteCollection(); tenantSites.getFromSlice(model); model.usersBuffer = model.attributes.users; /* save a copy of 'users' that we can edit. This prevents another view (developer) from overwriting our copy with a fetch from the server */ + model.usersOrig = model.attributes.users; /* save an immutable copy that we'll use for username lookups */ + model.user_namesOrig = model.attributes.user_names; model.tenantSiteCollection = tenantSites; XOSTenantApp.tenantSites = tenantSites; @@ -283,6 +300,9 @@ XOSTenantApp.sanityCheck = function() { if (xos.tenant().blessed_sites.length == 0) { errors.push("no blessed sites"); } + if (xos.tenant().current_user_site_id == null) { + errors.push("current user does not have a site"); + } if (errors.length > 0) { $("#tenantSummary").html("Tenant view sanity check failed
" + errors.join("
"));