change 'name' to 'site', make label cells same width
diff --git a/planetstack/core/xoslib/dashboards/xosTenant.html b/planetstack/core/xoslib/dashboards/xosTenant.html
index 2388647..ca74d5c 100644
--- a/planetstack/core/xoslib/dashboards/xosTenant.html
+++ b/planetstack/core/xoslib/dashboards/xosTenant.html
@@ -65,7 +65,7 @@
<div id="xos-error-dialog" title="Error Message">
</div>
-<div id="contentPanel">
+<div id="xos-tenant-view-panel"> <!-- contentPanel"> -->
<div id="contentTitle">
</div>
<div id="contentButtonPanel">
diff --git a/planetstack/core/xoslib/static/js/xosTenant.js b/planetstack/core/xoslib/static/js/xosTenant.js
index cb816a8..929552c 100644
--- a/planetstack/core/xoslib/static/js/xosTenant.js
+++ b/planetstack/core/xoslib/static/js/xosTenant.js
@@ -103,6 +103,11 @@
app: XOSTenantApp,
detailFields: ["serviceClass", "default_image", "default_flavor", "network_ports", "mount_data_sets"],
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;
@@ -127,6 +132,7 @@
noDeleteColumn: true,
disablePaginate: true,
disableFilter: true,
+ fieldDisplayNames: {"name": "Site"},
});
XOSTenantApp.tenantSiteListView = tenantSiteListClass;
diff --git a/planetstack/core/xoslib/static/js/xoslib/xos-util.js b/planetstack/core/xoslib/static/js/xoslib/xos-util.js
index 1d135f4..15aa1b0 100644
--- a/planetstack/core/xoslib/static/js/xoslib/xos-util.js
+++ b/planetstack/core/xoslib/static/js/xoslib/xos-util.js
@@ -111,3 +111,10 @@
});
return result;
}
+
+function make_same_width(containerSelector, itemSelector) {
+ var maxWidth = 0;
+ $(containerSelector).find(itemSelector).each( function(index) { maxWidth = Math.max(maxWidth, $(this).width()); });
+ console.log(maxWidth);
+ $(containerSelector).find(itemSelector).each( function(index) { $(this).width(maxWidth); });
+}
diff --git a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
index f7872cc..a46fa40 100644
--- a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
+++ b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
@@ -875,6 +875,7 @@
render: function() {
var view = this;
+ var fieldDisplayNames = view.options.fieldDisplayNames || view.fieldDisplayNames || {};
view.columnsByIndex = [];
view.columnsByFieldName = {};
@@ -882,7 +883,7 @@
inputType = view.options.inputType || view.inputType || {};
mRender = undefined;
mSearchText = undefined;
- sTitle = fieldNameToHumanReadable(fieldName);
+ sTitle = fieldName in fieldDisplayNames ? fieldDisplayNames[fieldName] : fieldNameToHumanReadable(fieldName);
bSortable = true;
if (fieldName=="backend_status") {
mRender = function(x,y,z) { return xosBackendStatusIconTemplate(z); };
diff --git a/planetstack/core/xoslib/templates/xosAdmin.html b/planetstack/core/xoslib/templates/xosAdmin.html
index ca2969e..db7218d 100644
--- a/planetstack/core/xoslib/templates/xosAdmin.html
+++ b/planetstack/core/xoslib/templates/xosAdmin.html
@@ -157,7 +157,7 @@
<table>
<% args = arguments; %>
<% _.each(detailFields, function(fieldName) { %>
- <tr><td><%= fieldName in fieldDisplayNames ? fieldDisplayNames[fieldName] : fieldNameToHumanReadable(fieldName) %>:</td>
+ <tr><td class="xos-label-cell"><%= fieldName in fieldDisplayNames ? fieldDisplayNames[fieldName] : fieldNameToHumanReadable(fieldName) %>:</td>
<% readOnly = $.inArray(fieldName, model.readOnlyFields)>=0 ? " readonly" : ""; %>
<% if (fieldName in choices) { %>
<td><%= choicesToSelect(fieldName, model.attributes[fieldName], choices[fieldName]) %></td>
@@ -287,7 +287,7 @@
<script type="text/template" id="xos-sliceselector-select">
<% if (caption) { %>
- <table><tr><td><%= caption %>: </td><td><select></select></td></tr></table>
+ <table><tr><td class="xos-label-cell"><%= caption %>: </td><td><select></select></td></tr></table>
<% } else { %>
<select></select>
<% } %>