summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static/js/table.js
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-06-05 12:30:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-12 00:01:48 +0100
commitc941743c9a1310c1b5ef942fa6e6d1ed31a7faa7 (patch)
tree19a7e7c37848359f98f50fb260fe1b45be8ceb56 /bitbake/lib/toaster/toastergui/static/js/table.js
parent58600cf8e76f270969ded6ec63ac0908f39dae09 (diff)
downloadpoky-c941743c9a1310c1b5ef942fa6e6d1ed31a7faa7.tar.gz
bitbake: toaster: ToasterTables add computational fields
This patch adds the ability to pass a function to be computed for generating a field value in setting up a column in ToasterTables. Also adding "displayable" property that can be turned False for columns that are present in JSON data but are not part of the UI. Add the "id" column by default for all rows. (Bitbake rev: fb683135348b074412da154585c75865aad1eab0) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/table.js')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/table.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/table.js b/bitbake/lib/toaster/toastergui/static/js/table.js
index 80e9ec2392..45c61848da 100644
--- a/bitbake/lib/toaster/toastergui/static/js/table.js
+++ b/bitbake/lib/toaster/toastergui/static/js/table.js
@@ -110,9 +110,13 @@ function tableInit(ctx){
110 setupTableChrome(tableData); 110 setupTableChrome(tableData);
111 111
112 /* Add table data rows */ 112 /* Add table data rows */
113 var column_index;
113 for (var i in tableData.rows){ 114 for (var i in tableData.rows){
115 /* only display if the column is display-able */
114 var row = $("<tr></tr>"); 116 var row = $("<tr></tr>");
117 column_index = -1;
115 for (var key_j in tableData.rows[i]){ 118 for (var key_j in tableData.rows[i]){
119
116 /* if we have a static: version of a key, prefer the static: version for rendering */ 120 /* if we have a static: version of a key, prefer the static: version for rendering */
117 var orig_key_j = key_j; 121 var orig_key_j = key_j;
118 122
@@ -125,6 +129,12 @@ function tableInit(ctx){
125 key_j = "static:" + key_j; 129 key_j = "static:" + key_j;
126 } 130 }
127 131
132 /* we skip over un-displayable column entries */
133 column_index += 1;
134 if (! tableData.columns[column_index].displayable) {
135 continue;
136 }
137
128 var td = $("<td></td>"); 138 var td = $("<td></td>");
129 td.prop("class", orig_key_j); 139 td.prop("class", orig_key_j);
130 if (tableData.rows[i][key_j]){ 140 if (tableData.rows[i][key_j]){
@@ -206,6 +216,9 @@ function tableInit(ctx){
206 /* Add table header and column toggle menu */ 216 /* Add table header and column toggle menu */
207 for (var i in tableData.columns){ 217 for (var i in tableData.columns){
208 var col = tableData.columns[i]; 218 var col = tableData.columns[i];
219 if (col.displayable === false) {
220 continue;
221 }
209 var header = $("<th></th>"); 222 var header = $("<th></th>");
210 header.prop("class", col.field_name); 223 header.prop("class", col.field_name);
211 224