Commit 4cbf138046df7a19cfe9342ff35f2dc0d635246e
1 parent
c71ea236
preview cache
Showing
3 changed files
with
187 additions
and
6 deletions
controllets/data-sevc-controllet/datalets-modifier-controllet.html
0 → 100755
| 1 | +<script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script> | |
| 2 | +<link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css"> | |
| 3 | + | |
| 4 | +<script src="../../locales/controllet_ln.js"></script> | |
| 5 | + | |
| 6 | +<link rel="import" href="../../bower_components/polymer/polymer.html"> | |
| 7 | + | |
| 8 | +<link rel="import" href="../page-slider-controllet/page-slider-controllet.html"> | |
| 9 | + | |
| 10 | +<link rel="import" href="../select-data-controllet/select-data-controllet.html" /> | |
| 11 | +<link rel="import" href="../select-visualization-controllet/select-visualization-controllet.html" /> | |
| 12 | + | |
| 13 | +<dom-module id="data-sevc-controllet"> | |
| 14 | + | |
| 15 | + <template> | |
| 16 | + | |
| 17 | + <page-slider-controllet id="slider"> | |
| 18 | + | |
| 19 | + <neon-animatable> | |
| 20 | + | |
| 21 | + <select-data-controllet id="select_data"></select-data-controllet> | |
| 22 | + | |
| 23 | + </neon-animatable> | |
| 24 | + | |
| 25 | + <neon-animatable> | |
| 26 | + | |
| 27 | + <select-visualization-controllet id="select_visualization" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}}></select-visualization-controllet> | |
| 28 | + | |
| 29 | + </neon-animatable> | |
| 30 | + | |
| 31 | + </page-slider-controllet> | |
| 32 | + | |
| 33 | + </template> | |
| 34 | + | |
| 35 | + <script> | |
| 36 | + | |
| 37 | + Polymer({ | |
| 38 | + | |
| 39 | + is : 'data-sevc-controllet', | |
| 40 | + | |
| 41 | + listeners : { | |
| 42 | + 'page-slider-controllet_selected' : '_updateSlider', | |
| 43 | + 'dataset-selection-controllet_data-url' : '_allowSecondStep', | |
| 44 | + 'tree-view-controllet_selected-fields' : '_allowThirdStep' | |
| 45 | + }, | |
| 46 | + | |
| 47 | + properties : { | |
| 48 | +// dataUrl : { | |
| 49 | +// type : String, | |
| 50 | +// value : undefined | |
| 51 | +// }, | |
| 52 | + | |
| 53 | + preselectedDatalet : { //datalet | |
| 54 | + type : String, | |
| 55 | + value : undefined | |
| 56 | + }, | |
| 57 | + | |
| 58 | + preselectedFields : { //fields | |
| 59 | + type : Array, | |
| 60 | + value : undefined | |
| 61 | + }, | |
| 62 | + | |
| 63 | + dataletPreset : { //params | |
| 64 | + type : String, | |
| 65 | + value : undefined | |
| 66 | + }, | |
| 67 | + | |
| 68 | + deepUrl : { | |
| 69 | + type : String, | |
| 70 | + value : undefined | |
| 71 | + }, | |
| 72 | + | |
| 73 | + dataletsListUrl : { | |
| 74 | + type : String , | |
| 75 | + value : undefined | |
| 76 | + }, | |
| 77 | + | |
| 78 | + localization : { | |
| 79 | + type : String, | |
| 80 | + value : "en" | |
| 81 | + } | |
| 82 | + | |
| 83 | + }, | |
| 84 | + | |
| 85 | + ready : function(){ | |
| 86 | + if(this.selectedDatalet){ | |
| 87 | + this.modify = true; | |
| 88 | + this.$.slider.selected = 1; | |
| 89 | + this.dataUrl = this.dataletPreset["data-url"]; | |
| 90 | + } | |
| 91 | + ln["localization"] = this.localization; | |
| 92 | + }, | |
| 93 | + | |
| 94 | + _updateSlider : function(e){ | |
| 95 | + switch (e.detail.selected) { | |
| 96 | + case 0: | |
| 97 | + slider.setTitle(ln["slide1Title_" + this.localization], ln["slide1Subtitle_" + this.localization]); | |
| 98 | + slider.chevronLeft("invisible"); | |
| 99 | + slider.chevronRight(false); | |
| 100 | + if(slider.getPrevSelected() == 1) | |
| 101 | + slider.chevronRight(true); | |
| 102 | + break; | |
| 103 | + case 1: | |
| 104 | + slider.setTitle(ln["slide2Title_" + this.localization], ln["slide2Subtitle_" + this.localization]); | |
| 105 | + if(this.modify){ | |
| 106 | + slider.chevronLeft("invisible"); | |
| 107 | + } | |
| 108 | + else{ | |
| 109 | + slider.chevronLeft(true); | |
| 110 | + } | |
| 111 | + slider.chevronRight(false); | |
| 112 | + this._allowThirdStep({detail: {fields: select_data.getSelectedFields()}}); | |
| 113 | + if(this.modify){ | |
| 114 | + this.$.select_visualization.setFields(select_data.getSelectedFields()); | |
| 115 | + this.$.select_visualization.setFilters(select_data.getFilters()); | |
| 116 | + } | |
| 117 | + break; | |
| 118 | + case 2: | |
| 119 | + slider.setTitle(ln["slide3Title_" + this.localization], ln["slide3Subtitle_" + this.localization]); | |
| 120 | + slider.chevronLeft(true); | |
| 121 | + slider.chevronRight("invisible"); | |
| 122 | + | |
| 123 | + this.$.select_visualization.setFields(select_data.getSelectedFields()); | |
| 124 | + this.$.select_visualization.setFilters(select_data.getFilters()); | |
| 125 | + if(this.modify) { | |
| 126 | + this.$.select_visualization.show();//resize | |
| 127 | + } | |
| 128 | + } | |
| 129 | + }, | |
| 130 | + | |
| 131 | + _allowSecondStep : function(e){ | |
| 132 | + if(e.detail.url == "") { | |
| 133 | + slider.chevronRight(false); | |
| 134 | + select_dataset.$.selected_url.invalid = false; | |
| 135 | + return; | |
| 136 | + } | |
| 137 | + | |
| 138 | + this.dataUrl = e.detail.url; | |
| 139 | + | |
| 140 | + var that = this; | |
| 141 | + | |
| 142 | + $.ajax({ | |
| 143 | + url: e.detail.url, | |
| 144 | + dataType: "json", | |
| 145 | + success: function(data){ | |
| 146 | +// this.dataUrl = e.detail.url | |
| 147 | +// this.jsonData = JSON.stringify(data); | |
| 148 | + slider.chevronRight(true); | |
| 149 | + select_dataset.$.selected_url.invalid = false; | |
| 150 | + | |
| 151 | + that.$.select_data._init(); | |
| 152 | + }, | |
| 153 | + error: function(){ | |
| 154 | +// this.jsonData = undefined; | |
| 155 | + slider.chevronRight(false); | |
| 156 | + select_dataset.$.selected_url.invalid = true; | |
| 157 | + | |
| 158 | + that.$.select_data._reset(); | |
| 159 | + } | |
| 160 | + }); | |
| 161 | + | |
| 162 | + //NOT HERE ma quando VADO al secondo passo e l'url è cambiato | |
| 163 | +// this.$.select_data._init(); | |
| 164 | + this.$.select_visualization.reset(); | |
| 165 | + }, | |
| 166 | + | |
| 167 | + _allowThirdStep : function(e){ | |
| 168 | + if(e.detail.fields.length > 0) | |
| 169 | + slider.chevronRight(true); | |
| 170 | + else | |
| 171 | + slider.chevronRight(false); | |
| 172 | + | |
| 173 | + //this.$.select_visualization.reset(); | |
| 174 | + } | |
| 175 | + | |
| 176 | + }); | |
| 177 | + | |
| 178 | + </script> | |
| 179 | + | |
| 180 | +</dom-module> | |
| 0 | 181 | \ No newline at end of file | ... | ... |
controllets/select-visualization-controllet/select-visualization-controllet.html
| ... | ... | @@ -342,7 +342,8 @@ |
| 342 | 342 | |
| 343 | 343 | this.selectedFields = inputs.getSelectedFields(); |
| 344 | 344 | |
| 345 | - this.params = {'data-url' : this.dataUrl}; | |
| 345 | + this.params = {'data-url' : this.dataUrl};//?????????????????? | |
| 346 | +// this.params = {}; | |
| 346 | 347 | |
| 347 | 348 | this.params["filters"] = JSON.stringify(this.filters); |
| 348 | 349 | this.params["aggregators"] = JSON.stringify(inputs.getAggregators()); |
| ... | ... | @@ -355,12 +356,12 @@ |
| 355 | 356 | |
| 356 | 357 | var data = alasql_complexSelectData(this.data, this.selectedFields, this.filters, inputs.getAggregators(), inputs.getOrders()); |
| 357 | 358 | data = transformData(data, this.selectedFields, true); |
| 358 | - this.params["data"] = JSON.stringify(data); | |
| 359 | + this.params["data"] = JSON.stringify(data).replace(/'/g, "'"); | |
| 359 | 360 | |
| 360 | 361 | var dataletParams ={ |
| 361 | 362 | component: this.selectedDatalet+"-datalet", |
| 362 | - params: this.params, | |
| 363 | 363 | fields: this.selectedFields, |
| 364 | + params: this.params, | |
| 364 | 365 | placeHolder: this.$.datalet_selection_datalet_placeholder, |
| 365 | 366 | }; |
| 366 | 367 | |
| ... | ... | @@ -375,9 +376,9 @@ |
| 375 | 376 | |
| 376 | 377 | var data = { |
| 377 | 378 | dataUrl: this.dataUrl, |
| 378 | - params: this.params, | |
| 379 | - fields: this.selectedFields, | |
| 380 | 379 | datalet: this.selectedDatalet+"-datalet", |
| 380 | + fields: this.selectedFields, | |
| 381 | + params: this.params, | |
| 381 | 382 | staticData: JSON.stringify(this.$.datalet_selection_datalet_placeholder.children[1].behavior.data) |
| 382 | 383 | } |
| 383 | 384 | ... | ... |
datalets/base-ajax-json-alasql-datalet/base-ajax-json-alasql-datalet.html
| ... | ... | @@ -64,7 +64,7 @@ Example : |
| 64 | 64 | <base-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}" export_menu="{{export_menu}}"></base-datalet> |
| 65 | 65 | </template> |
| 66 | 66 | |
| 67 | - <script src="static/js/alasql.min.js"></script> | |
| 67 | + <!--<script src="static/js/alasql.min.js"></script>--> | |
| 68 | 68 | <script src="static/js/AjaxJsonAlasqlBehavior.js"></script> |
| 69 | 69 | |
| 70 | 70 | <script> | ... | ... |