change 'name' to 'site', make label cells same width
Scott Baker [Thu, 15 Jan 2015 01:07:30 +0000 (17:07 -0800)]
planetstack/core/xoslib/dashboards/xosTenant.html
planetstack/core/xoslib/static/js/xosTenant.js
planetstack/core/xoslib/static/js/xoslib/xos-util.js
planetstack/core/xoslib/static/js/xoslib/xosHelper.js
planetstack/core/xoslib/templates/xosAdmin.html

index 2388647..ca74d5c 100644 (file)
@@ -65,7 +65,7 @@
 <div id="xos-error-dialog" title="Error Message">
 </div>\r
 \r
-<div id="contentPanel">\r
+<div id="xos-tenant-view-panel"> <!-- contentPanel"> -->\r
 <div id="contentTitle">
 </div>
 <div id="contentButtonPanel">
index cb816a8..929552c 100644 (file)
@@ -103,6 +103,11 @@ XOSTenantApp.buildViews = function() {
                                                 app: XOSTenantApp,\r
                                                 detailFields: ["serviceClass", "default_image", "default_flavor", "network_ports", "mount_data_sets"],\r
                                                 fieldDisplayNames: {serviceClass: "Service Level", "default_flavor": "Flavor", "default_image": "Image", "mount_data_sets": "Data Sets"},\r
+\r
+                                                onShow: function() {\r
+                                                    // the slice selector is in a different table, so make every label cell the maximal width\r
+                                                    make_same_width("#xos-tenant-view-panel", ".xos-label-cell");\r
+                                                },\r
                                                 });\r
 \r
      XOSTenantApp.tenantSummaryView = tenantSummaryClass;\r
@@ -127,6 +132,7 @@ XOSTenantApp.buildViews = function() {
                                                noDeleteColumn: true,\r
                                                disablePaginate: true,\r
                                                disableFilter: true,\r
+                                               fieldDisplayNames: {"name": "Site"},\r
                                                });\r
 \r
      XOSTenantApp.tenantSiteListView = tenantSiteListClass;\r
index 1d135f4..15aa1b0 100644 (file)
@@ -111,3 +111,10 @@ function all_options(selector) {
     });
     return result;
 }
+
+function make_same_width(containerSelector, itemSelector) {
+    var maxWidth = 0;
+    $(containerSelector).find(itemSelector).each( function(index) { maxWidth = Math.max(maxWidth, $(this).width()); });\r
+    console.log(maxWidth);\r
+    $(containerSelector).find(itemSelector).each( function(index) { $(this).width(maxWidth); });
+}
index f7872cc..a46fa40 100644 (file)
@@ -875,6 +875,7 @@ XOSDataTableView = Marionette.View.extend( {
 
     render: function() {
         var view = this;
+        var fieldDisplayNames = view.options.fieldDisplayNames || view.fieldDisplayNames || {};
 
         view.columnsByIndex = [];
         view.columnsByFieldName = {};
@@ -882,7 +883,7 @@ XOSDataTableView = Marionette.View.extend( {
             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); };
index ca2969e..db7218d 100644 (file)
   <table>\r
   <% args = arguments; %>\r
   <% _.each(detailFields, function(fieldName) { %>\r
-     <tr><td><%= fieldName in fieldDisplayNames ? fieldDisplayNames[fieldName] : fieldNameToHumanReadable(fieldName) %>:</td>\r
+     <tr><td class="xos-label-cell"><%= fieldName in fieldDisplayNames ? fieldDisplayNames[fieldName] : fieldNameToHumanReadable(fieldName) %>:</td>\r
         <% readOnly = $.inArray(fieldName, model.readOnlyFields)>=0 ? " readonly" : "";  %>\r
         <% if (fieldName in choices) { %>\r
             <td><%= choicesToSelect(fieldName, model.attributes[fieldName], choices[fieldName]) %></td>\r
 
 <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>
     <% } %>