Commit 40eb09797def2861e78d1a248d28c489140dbad0
1 parent
93ba7167
group by and filters LN
Showing
2 changed files
with
112 additions
and
27 deletions
controllets/datalet-selection-controllet/datalet-selection-controllet.html
| @@ -224,7 +224,7 @@ | @@ -224,7 +224,7 @@ | ||
| 224 | <div id="expert_container"> | 224 | <div id="expert_container"> |
| 225 | 225 | ||
| 226 | <div class="inputs"> | 226 | <div class="inputs"> |
| 227 | - <paper-dropdown-menu id="group_by" label="GROUP BY"> | 227 | + <paper-dropdown-menu id="group_by"> |
| 228 | <paper-menu class="dropdown-content"> | 228 | <paper-menu class="dropdown-content"> |
| 229 | <template is="dom-repeat" items={{selectedFields}}> | 229 | <template is="dom-repeat" items={{selectedFields}}> |
| 230 | <paper-item id={{index}} on-tap="_showGroupedFields">{{_fieldName(item)}}</paper-item> | 230 | <paper-item id={{index}} on-tap="_showGroupedFields">{{_fieldName(item)}}</paper-item> |
| @@ -238,15 +238,16 @@ | @@ -238,15 +238,16 @@ | ||
| 238 | 238 | ||
| 239 | <template is="dom-repeat" items="{{groupedFields}}"> | 239 | <template is="dom-repeat" items="{{groupedFields}}"> |
| 240 | <div class="inputs"> | 240 | <div class="inputs"> |
| 241 | - <paper-dropdown-menu id="calculate_{{index}}" label="CALCULATE"> | 241 | + <paper-dropdown-menu id="calculate_{{index}}" label="{{_calculateLabel()}}"> |
| 242 | <paper-menu class="dropdown-content"> | 242 | <paper-menu class="dropdown-content"> |
| 243 | - <paper-item on-tap="_addGroupByInput">COUNT of {{_fieldName(item)}}</paper-item> | ||
| 244 | - <paper-item on-tap="_addGroupByInput">SUM of {{_fieldName(item)}}</paper-item> | ||
| 245 | - <paper-item on-tap="_addGroupByInput">MIN of {{_fieldName(item)}}</paper-item> | ||
| 246 | - <paper-item on-tap="_addGroupByInput">MAX of {{_fieldName(item)}}</paper-item> | ||
| 247 | - <paper-item on-tap="_addGroupByInput">AVG of {{_fieldName(item)}}</paper-item> | ||
| 248 | - <paper-item on-tap="_addGroupByInput">FIRST of {{_fieldName(item)}}</paper-item> | ||
| 249 | - <paper-item on-tap="_addGroupByInput">LAST of {{_fieldName(item)}}</paper-item> | 243 | + <!--foreach functions--> |
| 244 | + <paper-item id="0" on-tap="_addGroupByInput">{{_operationName(0)}} {{_fieldName(item)}}</paper-item> | ||
| 245 | + <paper-item id="1" on-tap="_addGroupByInput">{{_operationName(1)}} {{_fieldName(item)}}</paper-item> | ||
| 246 | + <paper-item id="2" on-tap="_addGroupByInput">{{_operationName(2)}} {{_fieldName(item)}}</paper-item> | ||
| 247 | + <paper-item id="3" on-tap="_addGroupByInput">{{_operationName(3)}} {{_fieldName(item)}}</paper-item> | ||
| 248 | + <paper-item id="4" on-tap="_addGroupByInput">{{_operationName(4)}} {{_fieldName(item)}}</paper-item> | ||
| 249 | + <paper-item id="5" on-tap="_addGroupByInput">{{_operationName(5)}} {{_fieldName(item)}}</paper-item> | ||
| 250 | + <paper-item id="6" on-tap="_addGroupByInput">{{_operationName(6)}} {{_fieldName(item)}}</paper-item> | ||
| 250 | </paper-menu> | 251 | </paper-menu> |
| 251 | </paper-dropdown-menu> | 252 | </paper-dropdown-menu> |
| 252 | <div class="info_button"> | 253 | <div class="info_button"> |
| @@ -409,6 +410,11 @@ | @@ -409,6 +410,11 @@ | ||
| 409 | value : false | 410 | value : false |
| 410 | }, | 411 | }, |
| 411 | 412 | ||
| 413 | + functions : { | ||
| 414 | + type : Array, | ||
| 415 | + value : ["COUNT", "SUM", "MIN", "MAX", "AVG", "FIRST", "LAST"] | ||
| 416 | + }, | ||
| 417 | + | ||
| 412 | modify : { | 418 | modify : { |
| 413 | type : Boolean, | 419 | type : Boolean, |
| 414 | value : false | 420 | value : false |
| @@ -542,6 +548,7 @@ | @@ -542,6 +548,7 @@ | ||
| 542 | this.$.base_description.label = ln["description_" + ln["localization"]]; | 548 | this.$.base_description.label = ln["description_" + ln["localization"]]; |
| 543 | 549 | ||
| 544 | this.$.groupBy.innerHTML = ln["groupBy_" + ln["localization"]]; | 550 | this.$.groupBy.innerHTML = ln["groupBy_" + ln["localization"]]; |
| 551 | + this.$.group_by.setAttribute("label", ln["groupBy_" + ln["localization"]]); | ||
| 545 | 552 | ||
| 546 | if(this.modify) | 553 | if(this.modify) |
| 547 | this.$.add_button.innerHTML = ln["modifyDatalet_" + ln["localization"]]; | 554 | this.$.add_button.innerHTML = ln["modifyDatalet_" + ln["localization"]]; |
| @@ -799,12 +806,14 @@ | @@ -799,12 +806,14 @@ | ||
| 799 | this.aggregators.push({"field": label, "operation": "GROUP BY"}); | 806 | this.aggregators.push({"field": label, "operation": "GROUP BY"}); |
| 800 | } | 807 | } |
| 801 | if(id.indexOf("calculate") > -1) { | 808 | if(id.indexOf("calculate") > -1) { |
| 802 | - var label = $(ddls[i]).find("paper-menu")[0].selectedItem.textContent.trim(); | ||
| 803 | -// var field = label.substring(label.lastIndexOf(" ")+1, label.length); | ||
| 804 | - var index = label.split(" ", 2).join(" ").length; | ||
| 805 | - var field = label.substring(index+1, label.length); | ||
| 806 | - var operation = label.substring(0, label.indexOf(" ")); | ||
| 807 | - this.aggregators.push({"field": field, "operation": operation}); | 809 | + var menu = $(ddls[i]).find("paper-menu")[0]; |
| 810 | + var label = menu.selectedItem.textContent.trim(); | ||
| 811 | + var index = menu.selectedItem.id; | ||
| 812 | + var ii = label.split(" ", 2).join(" ").length; | ||
| 813 | + //attenzione BUG --> non funziona se la traduzione non ha solo 1 spazio | ||
| 814 | + var field = label.substring(ii+1, label.length); | ||
| 815 | +// var operation = label.substring(0, label.indexOf(" ")); | ||
| 816 | + this.aggregators.push({"field": field, "operation": this.functions[index]}); | ||
| 808 | } | 817 | } |
| 809 | } | 818 | } |
| 810 | }, | 819 | }, |
| @@ -917,6 +926,15 @@ | @@ -917,6 +926,15 @@ | ||
| 917 | return ln[key + "_" +ln["localization"]]; | 926 | return ln[key + "_" +ln["localization"]]; |
| 918 | }, | 927 | }, |
| 919 | 928 | ||
| 929 | + _calculateLabel: function() { | ||
| 930 | + return ln["calculate" + "_" +ln["localization"]]; | ||
| 931 | + }, | ||
| 932 | + | ||
| 933 | + _operationName: function(index) { | ||
| 934 | + var key = this.functions[index]; | ||
| 935 | + return ln[key + "_" +ln["localization"]]; | ||
| 936 | + }, | ||
| 937 | + | ||
| 920 | _resize : function(){ | 938 | _resize : function(){ |
| 921 | var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16; | 939 | var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16; |
| 922 | h = h - 64 - 8; //height with page scroller | 940 | h = h - 64 - 8; //height with page scroller |
locales/controllet_ln.js
| @@ -28,18 +28,25 @@ ln["dataletPreview_it"] = "ANTEPRIMA"; | @@ -28,18 +28,25 @@ ln["dataletPreview_it"] = "ANTEPRIMA"; | ||
| 28 | ln["addDatalet_it"] = "AGGIUNGI"; | 28 | ln["addDatalet_it"] = "AGGIUNGI"; |
| 29 | ln["modifyDatalet_it"] = "MODIFICA"; | 29 | ln["modifyDatalet_it"] = "MODIFICA"; |
| 30 | 30 | ||
| 31 | -ln["addFilters_en"] = "ADD FILTERS"; | ||
| 32 | -ln["filterField_en"] = "Field"; | ||
| 33 | -ln["filterOperation_en"] = "Operation"; | ||
| 34 | -ln["filterValue_en"] = "Value"; | ||
| 35 | -ln["contains_en"] = "contains"; | ||
| 36 | -ln["start_en"] = "start with"; | ||
| 37 | -ln["ends_en"] = "ends with"; | ||
| 38 | -ln["sortAscending_en"] = "sorted ascending"; | ||
| 39 | -ln["sortDescending_en"] = "sorted descending"; | ||
| 40 | -ln["unsort_en"] = "unsorted"; | ||
| 41 | -//ln["countOf_en"] = "COUNT of"; | ||
| 42 | -ln["groupBy_en"] = "GROUP BY"; | 31 | +ln["addFilters_it"] = "AGGIUNGI FILTRI"; |
| 32 | +ln["filterField_it"] = "Campo"; | ||
| 33 | +ln["filterOperation_it"] = "Operazione"; | ||
| 34 | +ln["filterValue_it"] = "Valore"; | ||
| 35 | +ln["contains_it"] = "contiene"; | ||
| 36 | +ln["start_it"] = "inizia con"; | ||
| 37 | +ln["ends_it"] = "finisce con"; | ||
| 38 | +ln["sortAscending_it"] = "ordinamento crescente"; | ||
| 39 | +ln["sortDescending_it"] = "ordinamento decrescente"; | ||
| 40 | +ln["unsort_it"] = "non ordinato"; | ||
| 41 | +ln["groupBy_it"] = "RAGGRUPPA"; | ||
| 42 | +ln["calculate_it"] = "CALCOLA"; | ||
| 43 | +ln["COUNT_it"] = "CONTEGGIO di"; | ||
| 44 | +ln["SUM_it"] = "SOMMA di"; | ||
| 45 | +ln["MIN_it"] = "MINIMO di"; | ||
| 46 | +ln["MAX_it"] = "MASSIMO di"; | ||
| 47 | +ln["AVG_it"] = "MEDIA di"; | ||
| 48 | +ln["FIRST_it"] = "PRIMO di"; | ||
| 49 | +ln["LAST_it"] = "ULTIMO di"; | ||
| 43 | 50 | ||
| 44 | ln["datatable_it"] = "tabella"; | 51 | ln["datatable_it"] = "tabella"; |
| 45 | ln["barchart_it"] = "bar-chart"; | 52 | ln["barchart_it"] = "bar-chart"; |
| @@ -131,6 +138,26 @@ ln["dataletPreview_en"] = "PREVIEW"; | @@ -131,6 +138,26 @@ ln["dataletPreview_en"] = "PREVIEW"; | ||
| 131 | ln["addDatalet_en"] = "ADD"; | 138 | ln["addDatalet_en"] = "ADD"; |
| 132 | ln["modifyDatalet_en"] = "MODIFY"; | 139 | ln["modifyDatalet_en"] = "MODIFY"; |
| 133 | 140 | ||
| 141 | +ln["addFilters_en"] = "ADD FILTERS"; | ||
| 142 | +ln["filterField_en"] = "Field"; | ||
| 143 | +ln["filterOperation_en"] = "Operation"; | ||
| 144 | +ln["filterValue_en"] = "Value"; | ||
| 145 | +ln["contains_en"] = "contains"; | ||
| 146 | +ln["start_en"] = "start with"; | ||
| 147 | +ln["ends_en"] = "ends with"; | ||
| 148 | +ln["sortAscending_en"] = "sorted ascending"; | ||
| 149 | +ln["sortDescending_en"] = "sorted descending"; | ||
| 150 | +ln["unsort_en"] = "unsorted"; | ||
| 151 | +ln["groupBy_en"] = "GROUP BY"; | ||
| 152 | +ln["calculate_en"] = "CALCULATE"; | ||
| 153 | +ln["COUNT_en"] = "COUNT of"; | ||
| 154 | +ln["SUM_en"] = "SUM of"; | ||
| 155 | +ln["MIN_en"] = "MIN of"; | ||
| 156 | +ln["MAX_en"] = "MAX of"; | ||
| 157 | +ln["AVG_en"] = "AVG of"; | ||
| 158 | +ln["FIRST_en"] = "FIRST of"; | ||
| 159 | +ln["LAST_en"] = "LAST of"; | ||
| 160 | + | ||
| 134 | ln["datatable_en"] = "table"; | 161 | ln["datatable_en"] = "table"; |
| 135 | ln["barchart_en"] = "bar-chart"; | 162 | ln["barchart_en"] = "bar-chart"; |
| 136 | //ln["bar-chart_en"] = "DDR bar-chart"; | 163 | //ln["bar-chart_en"] = "DDR bar-chart"; |
| @@ -224,6 +251,26 @@ ln["dataletPreview_fr"] = "PREVISUALISATION"; | @@ -224,6 +251,26 @@ ln["dataletPreview_fr"] = "PREVISUALISATION"; | ||
| 224 | ln["addDatalet_fr"] = "AJOUTER"; | 251 | ln["addDatalet_fr"] = "AJOUTER"; |
| 225 | ln["modifyDatalet_fr"] = "MODIFIER"; | 252 | ln["modifyDatalet_fr"] = "MODIFIER"; |
| 226 | 253 | ||
| 254 | +ln["addFilters_fr"] = "ADD FILTERS"; | ||
| 255 | +ln["filterField_fr"] = "Field"; | ||
| 256 | +ln["filterOperation_fr"] = "Operation"; | ||
| 257 | +ln["filterValue_fr"] = "Value"; | ||
| 258 | +ln["contains_fr"] = "contains"; | ||
| 259 | +ln["start_fr"] = "start with"; | ||
| 260 | +ln["ends_fr"] = "ends with"; | ||
| 261 | +ln["sortAscending_fr"] = "sorted ascending"; | ||
| 262 | +ln["sortDescending_fr"] = "sorted descending"; | ||
| 263 | +ln["unsort_fr"] = "unsorted"; | ||
| 264 | +ln["groupBy_fr"] = "GROUP BY"; | ||
| 265 | +ln["calculate_fr"] = "CALCULATE"; | ||
| 266 | +ln["COUNT_fr"] = "COUNT of"; | ||
| 267 | +ln["SUM_fr"] = "SUM of"; | ||
| 268 | +ln["MIN_fr"] = "MIN of"; | ||
| 269 | +ln["MAX_fr"] = "MAX of"; | ||
| 270 | +ln["AVG_fr"] = "AVG of"; | ||
| 271 | +ln["FIRST_fr"] = "FIRST of"; | ||
| 272 | +ln["LAST_fr"] = "LAST of"; | ||
| 273 | + | ||
| 227 | ln["datatable_fr"] = "table fr"; | 274 | ln["datatable_fr"] = "table fr"; |
| 228 | ln["barchart_fr"] = "barchart"; | 275 | ln["barchart_fr"] = "barchart"; |
| 229 | ln["columnchart_fr"] = "columnchart"; | 276 | ln["columnchart_fr"] = "columnchart"; |
| @@ -314,6 +361,26 @@ ln["dataletPreview_nl"] = "VOORBEELD"; | @@ -314,6 +361,26 @@ ln["dataletPreview_nl"] = "VOORBEELD"; | ||
| 314 | ln["addDatalet_nl"] = "TOEVOEGEN"; | 361 | ln["addDatalet_nl"] = "TOEVOEGEN"; |
| 315 | ln["modifyDatalet_nl"] = "WIJZIGEN"; | 362 | ln["modifyDatalet_nl"] = "WIJZIGEN"; |
| 316 | 363 | ||
| 364 | +ln["addFilters_nl"] = "ADD FILTERS"; | ||
| 365 | +ln["filterField_nl"] = "Field"; | ||
| 366 | +ln["filterOperation_nl"] = "Operation"; | ||
| 367 | +ln["filterValue_nl"] = "Value"; | ||
| 368 | +ln["contains_nl"] = "contains"; | ||
| 369 | +ln["start_nl"] = "start with"; | ||
| 370 | +ln["ends_nl"] = "ends with"; | ||
| 371 | +ln["sortAscending_nl"] = "sorted ascending"; | ||
| 372 | +ln["sortDescending_nl"] = "sorted descending"; | ||
| 373 | +ln["unsort_nl"] = "unsorted"; | ||
| 374 | +ln["groupBy_nl"] = "GROUP BY"; | ||
| 375 | +ln["calculate_nl"] = "CALCULATE"; | ||
| 376 | +ln["COUNT_nl"] = "COUNT of"; | ||
| 377 | +ln["SUM_nl"] = "SUM of"; | ||
| 378 | +ln["MIN_nl"] = "MIN of"; | ||
| 379 | +ln["MAX_nl"] = "MAX of"; | ||
| 380 | +ln["AVG_nl"] = "AVG of"; | ||
| 381 | +ln["FIRST_nl"] = "FIRST of"; | ||
| 382 | +ln["LAST_nl"] = "LAST of"; | ||
| 383 | + | ||
| 317 | ln["datatable_nl"] = "tafel"; | 384 | ln["datatable_nl"] = "tafel"; |
| 318 | ln["barchart_nl"] = "barchart"; | 385 | ln["barchart_nl"] = "barchart"; |
| 319 | ln["columnchart_nl"] = "columnchart"; | 386 | ln["columnchart_nl"] = "columnchart"; |