Commit 0b7cbd3379a95013b5815e0f0130e04b735090bb

Authored by Renato De Donato
1 parent 59100bec

title-desciption

controllets/data-sevc-controllet/data-sevc-controllet.html
... ... @@ -135,7 +135,7 @@
135 135 // slider.setTitle("SELECT DATA", "Select the fields from tree-view. The multi-table will show the values related to the selected fields.");
136 136 if(this.modify){
137 137 slider.chevronLeft("invisible");
138   - slider.setAvatar("2");
  138 +// slider.setAvatar("2");
139 139 }
140 140 else{
141 141 slider.chevronLeft(true);
... ...
controllets/datalet-selection-controllet/datalet-selection-controllet.html
... ... @@ -209,7 +209,7 @@
209 209 <paper-dropdown-menu id={{ddl_index}} label={{item.name}}>
210 210 <paper-menu class="dropdown-content">
211 211 <template is="dom-repeat" items={{fields}}>
212   - <paper-item id={{index}} on-tap="_addInput">{{item}}</paper-item>
  212 + <paper-item id={{index}} on-tap="_addInput">{{_fieldName(item)}}</paper-item>
213 213 <!--{{_fieldName(item)}}-->
214 214 </template>
215 215 </paper-menu>
... ... @@ -374,8 +374,10 @@
374 374  
375 375 //this.modify = true;//da eliminare in futuro
376 376 if(this.preselectedDatalet){
  377 + if(this.modify)
  378 + this._preselectDatalet();
  379 +
377 380 this.modify = true;
378   - this._preselectDatalet();
379 381 this.preselectedDatalet = undefined;
380 382 }
381 383 },
... ... @@ -425,22 +427,29 @@
425 427 },
426 428  
427 429 _preselectDatalet : function() {
  430 + this.type = "undefined";
  431 + this.$.selectedDatalet_request.url = this.deepUrl + this.preselectedDatalet + "-datalet";
  432 + this.$.selectedDatalet_request.generateRequest();
  433 +
428 434 this.selectedDatalet = this.preselectedDatalet;
429 435 this.selectedFields = this._copy(this.fields);
430 436  
431   - var inputs = document.getElementsByTagName("paper-dropdown-menu");
432   - for(var i=0; i < inputs.length; i++)
433   - $(inputs[i]).find("paper-menu")[0].select(i);
  437 + this.async(function() {
  438 + this.selectedFields = this._copy(this.fields);
434 439  
435   - //set info labels options
436   - var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
437   - for (var i = 0; i < labels.length; i++)
438   - labels[i].value = this.dataletPreset[labels[i].label];
  440 + var inputs = document.getElementsByTagName("paper-dropdown-menu");
  441 + for (var i = 0; i < inputs.length; i++)
  442 + $(inputs[i]).find("paper-menu")[0].select(i);
439 443  
440   - var labels = this.$.datalet_selection_labels.querySelectorAll("paper-input");
441   - for (var i = 0; i < labels.length; i++)
442   - labels[i].value = this.dataletPreset[labels[i].label];
  444 + //set info labels options
  445 + var labels = this.$.datalet_selection_labels.querySelectorAll("paper-textarea");
  446 + for (var i = 0; i < labels.length; i++)
  447 + labels[i].value = this.dataletPreset[labels[i].label];
443 448  
  449 + var labels = this.$.datalet_selection_labels.querySelectorAll("paper-input");
  450 + for (var i = 0; i < labels.length; i++)
  451 + labels[i].value = this.dataletPreset[labels[i].label];
  452 + }, 300);
444 453  
445 454 this.loadPreview = true;
446 455 this._loadDatalet(this.selectedFields);
... ... @@ -461,6 +470,7 @@
461 470 var selection = inputs.selection;
462 471 inputs = [];
463 472 for (var i in this.fields)
  473 +// for (var i = 0; i < Math.max(this.fields.length, 8); i++)//error
464 474 inputs.push({name: name + " " + i, description: description, selection: selection});
465 475 }
466 476  
... ... @@ -482,8 +492,12 @@
482 492 _addInput : function(e){
483 493 var selectedFields = this._copy(this.selectedFields);
484 494  
485   - var index = $(e.target).parents("paper-dropdown-menu")[0].id;
486   - selectedFields[index] = e.target.innerHTML.trim();
  495 +// var index = $(e.target).parents("paper-dropdown-menu")[0].id;
  496 +// selectedFields[index] = e.target.innerHTML.trim();
  497 +
  498 + var ddl_index = $(e.target).parents("paper-dropdown-menu")[0].id;
  499 + var index = e.target.id;
  500 + selectedFields[ddl_index] = this.fields[index];
487 501  
488 502 this.selectedFields = this._copy(selectedFields);
489 503  
... ... @@ -546,8 +560,12 @@
546 560 ComponentService.deep_url = this.deepUrl;
547 561 ComponentService.getComponent(dataletParams);
548 562  
549   -// this.async(function(){this.$.add_button.removeAttribute("disabled");}, 1000);
550   - this.$.add_button.removeAttribute("disabled");
  563 + //300???
  564 + if(this.$.datalet_selection_datalet_placeholder.children[1])
  565 + this.async(function(){this.$.datalet_selection_datalet_placeholder.children[1].behavior.setParameters(this.params)}, 300);
  566 + this.async(function(){this.$.add_button.removeAttribute("disabled");}, 300);
  567 +
  568 +// this.$.add_button.removeAttribute("disabled");
551 569 },
552 570  
553 571 _addDatalet : function(){
... ... @@ -557,7 +575,7 @@
557 575 if(this.selectedFields[i])
558 576 selectedFields.push(this.selectedFields[i]);
559 577  
560   - console.log(this.params);
  578 +// console.log(this.params);
561 579  
562 580 var data = {
563 581 dataUrl : this.dataUrl,
... ...
controllets/dataset-selection-controllet/dataset-selection-controllet.html
... ... @@ -281,7 +281,7 @@
281 281 var h = $("#material_container").height() - 48;
282 282 var w = $("#material_container").width();
283 283 // /oxwall_x.y.z
284   - this.$.div_datasetexplorer.innerHTML = "<datasetexplorer-datalet width=\""+w+"\" height=\""+h+"\" data-url=\"/openwall/api/datasetTree\" fields='[\"result,provider_name\",\"result,organization_name\",\"result,package_name\",\"result,resource_name\",\"result,url\",\"result,w\"]'></datasetexplorer-datalet>";
  284 + this.$.div_datasetexplorer.innerHTML = "<datasetexplorer-datalet width=\""+w+"\" height=\""+h+"\" data-url=\"/oxwall_x.y.z/openwall/api/datasetTree\" fields='[\"result,provider_name\",\"result,organization_name\",\"result,package_name\",\"result,resource_name\",\"result,url\",\"result,w\"]'></datasetexplorer-datalet>";
285 285 },
286 286  
287 287 _selectDataUrl_treeMap : function(e) {
... ...
datalets/base-datalet/base-datalet.html
... ... @@ -83,22 +83,26 @@ Example :
83 83 font-size: small;
84 84 }
85 85 #rtpalogo {
86   - height:32px;
  86 + height: 32px;
87 87 width: 32px;
88 88 }
89 89 #base_datalet_spin {
90   - height:64px;
  90 + height: 64px;
91 91 width: 100%;
  92 + margin-top: 64px;
92 93 }
93   - /*#base_datalet_info{*/
94   - /*padding-top: 8px;*/
95   - /*/!*background-color: green;*!/*/
96   - /*width: 100%;*/
97   - /*/!*font-size: small;*!/*/
98   - /*}*/
  94 +
99 95 #base_datalet_source_link{
100 96 padding-top: 12px;
101 97 }
  98 +
  99 + #span_title{
  100 + font-size: small;
  101 + }
  102 +
  103 + #span_description{
  104 + color: #727272;
  105 + }
102 106 </style>
103 107  
104 108 <div id="base_datalet_imgWaitDatalet">
... ... @@ -108,7 +112,7 @@ Example :
108 112 <div id="base_datalet_container">
109 113  
110 114 <div id="base_datalet_title_description">
111   - <span id="span_title" style="font-size: small"><b>{{title}}</b><span id="span_description" style="color: #727272"> - {{description}}</span></span>
  115 + <span id="span_title"><b>{{title}}</b> <span id="span_description">{{description}}</span></span>
112 116 </div>
113 117  
114 118 <div id="base_datalet_source_link">
... ... @@ -141,11 +145,6 @@ Example :
141 145 description : {
142 146 type : String,
143 147 value : ""
144   - },
145   -
146   - hideFooter : {
147   - type : Boolean,
148   - value : false
149 148 }
150 149  
151 150 },
... ... @@ -164,17 +163,25 @@ Example :
164 163 }
165 164 },
166 165  
167   - _setFooter: function() {
168   - if (this.title == "" && this.description == "")
169   - this.$.base_datalet_title_description.innerHTML = "";
170   - else if (this.description == "")
171   - this.$.span_description.innerHTML = "";
  166 + hideFooter: function() {
  167 + this.$.base_datalet_container.innerHTML = "";
  168 + this.$.base_datalet_container.style.border = 0;
172 169  
173   - if (this.hideFooter) {
174   - this.$.base_datalet_source_link.innerHTML = "";
175   - this.$.base_datalet_rtp.innerHTML = "";
176   - }
  170 +// this.$.base_datalet_source_link.innerHTML = "";
  171 +// this.$.base_datalet_rtp.innerHTML = "";
  172 + },
177 173  
  174 + setFooter: function(title, description) {
  175 + this.title = title;
  176 + if(title != "" && description != "")
  177 + this.description = "- " + description;
  178 + else
  179 + this.description = description;
  180 +
  181 + if (this.title == "" && this.description == "")
  182 + this.$.base_datalet_title_description.style.display = "none";
  183 + else
  184 + this.$.base_datalet_title_description.style.display = "block";
178 185 },
179 186  
180 187 /**
... ... @@ -189,8 +196,6 @@ Example :
189 196 * @method ready
190 197 */
191 198 ready: function(){
192   - this._setFooter();
193   -
194 199 if(this.dataUrl != undefined) {
195 200  
196 201 //cKan organized with or not catalog
... ...
datalets/base-datalet/static/js/BaseDataletBehavior.js
... ... @@ -2,7 +2,7 @@
2 2 @license
3 3 The MIT License (MIT)
4 4  
5   - Copyright (c) 2015 Dipartimento di Informatica - Universitร  di Salerno - Italy
  5 + Copyright (c) 2015 Dipartimento di Informatica - Universitรฏยฟยฝ di Salerno - Italy
6 6  
7 7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 8 of this software and associated documentation files (the "Software"), to deal
... ... @@ -74,6 +74,11 @@ var BaseDataletBehavior ={
74 74 factoryImpl: function(data_url, fields) {
75 75 this.data_url = data_url;
76 76 this.fields = fields;
77   - }
  77 + },
  78 +
  79 + setParameters: function(params)
  80 + {
  81 + $(this._component).find("base-datalet")[0].setFooter(params['title'], params['description']);
  82 + },
78 83  
79 84 };
80 85 \ No newline at end of file
... ...
datalets/base-datalet/static/js/BaseDataletBehaviors.js deleted
1   -/*
2   -@license
3   - The MIT License (MIT)
4   -
5   - Copyright (c) 2015 Dipartimento di Informatica - Universitร  di Salerno - Italy
6   -
7   - Permission is hereby granted, free of charge, to any person obtaining a copy
8   - of this software and associated documentation files (the "Software"), to deal
9   - in the Software without restriction, including without limitation the rights
10   - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11   - copies of the Software, and to permit persons to whom the Software is
12   - furnished to do so, subject to the following conditions:
13   -
14   - The above copyright notice and this permission notice shall be included in
15   - all copies or substantial portions of the Software.
16   -
17   - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18   - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19   - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20   - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21   - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22   - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23   - THE SOFTWARE.
24   -*/
25   -
26   -var BaseDataletBehavior ={
27   -
28   - properties: {
29   -
30   - /**
31   - * It represent the dataset api url
32   - *
33   - * @attribute dataUrl
34   - * @type string
35   - * @default 'null'
36   - */
37   - dataUrl: {
38   - type: String,
39   - value: ""
40   - },
41   -
42   - /**
43   - * It represents one or multiple fields selected by user
44   - *
45   - * @attribute fields
46   - * @type Array
47   - * @default empty
48   - */
49   - fields: {
50   - type: String,
51   - value: ""
52   - },
53   -
54   - /**
55   - * The selected and transformed data you can use in presentation phase
56   - *
57   - * @attribute data
58   - * @type Array
59   - * @default empty
60   - */
61   - data: {
62   - type: Array,
63   - value: []
64   - }
65   -
66   - },
67   -
68   - factoryImpl: function(data_url, fields) {
69   - this.data_url = data_url;
70   - this.fields = fields;
71   - }
72   -
73   -};
74   -
75   -var WorkcycleBehavior = {
76   - /**
77   - * A reference to Polymer object
78   - *
79   - */
80   - _component: null,
81   -
82   - /**
83   - * Request data from source(e.g. CKAN by api) using some kind of technology(e.g. Ajax)
84   - *
85   - * @method requestData
86   - */
87   - requestData: function(){
88   - },
89   -
90   - /**
91   - * Select the fields from data(typically json) previously retrieved by ajax request. The selection could be done by jsonPath but
92   - * it depends on the representation data format(CKAN apies return a json representation of the dataset).
93   - *
94   - * @method selectData
95   - */
96   - selectData: function(){
97   - },
98   -
99   - /**
100   - * Filter data previously selected. An example of filterting could be an expression such "fields > 30" or "fields = 'AAA'"
101   - * If you are using jsonPath to select the datas you can apply an expression directly in the jsonPath query string.
102   - *
103   - * @method filterData
104   - */
105   - filterData: function(){
106   - },
107   -
108   - /**
109   - * Transform the selected data in order to build the structure that the presentation phase needs.
110   - *
111   - * @method transformData
112   - */
113   - transformData: function(){
114   - },
115   -
116   - /**
117   - * Build the object/s for presentation layer.
118   - *
119   - * @method presentData
120   - */
121   - presentData: function(){
122   -
123   - },
124   -
125   - /**
126   - * This method represents the entire datalet workcycle.
127   - *
128   - * @method runWorkcycle
129   - */
130   - runWorkcycle: function() {
131   - this.selectData();
132   - this.filterData();
133   - this.transformData();
134   - this.presentData();
135   - },
136   -
137   - /**
138   - * This method save the reference to the polymer object related to the datalet.
139   - *
140   - * @method init
141   - */
142   - init: function(component){
143   - this._component = component;
144   -
145   - if(this.properties.data.length == 0){
146   - this.requestData();
147   - }else{
148   - this.transformData();
149   - this.presentData();
150   - }
151   - }
152   -
153   -};
154 0 \ No newline at end of file
datalets/datasetexplorer-datalet/datasetexplorer-datalet.html
... ... @@ -64,7 +64,7 @@ Example:
64 64 :host ::content #treemap_placeholder {
65 65 width: 100%;
66 66 height: 70%;
67   - min-height: 500px;
  67 + /*min-height: 500px;*/
68 68 background: #ffffff;
69 69 position: relative;
70 70 }
... ... @@ -125,8 +125,7 @@ Example:
125 125 children : []
126 126 },
127 127  
128   - transformData: function(e)
129   - {
  128 + transformData: function(e){
130 129 var treemapData = [];
131 130 DatasetexplorerBehavior.map.name = this._component.title;
132 131  
... ... @@ -225,6 +224,8 @@ Example:
225 224 },
226 225  
227 226 ready: function(){
  227 + $(this).find("base-datalet")[0].hideFooter();
  228 +
228 229 this.behavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, DatasetexplorerBehavior);
229 230 this.async(function(){this.behavior.init(this)},0);
230 231 }
... ...
datalets/dynamic-datatable-datalet/dynamic-datatable-datalet.html
... ... @@ -121,6 +121,8 @@ Example:
121 121 },
122 122  
123 123 ready: function(){
  124 + $(this).find("base-datalet")[0].hideFooter();
  125 +
124 126 this.behavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonJsonPathBehavior, DynamicDatatableBehavior);
125 127 this.async(function(){this.behavior.init(this)}, 0);
126 128 },
... ...
datalets/highcharts-datalet/highcharts-datalet.html
... ... @@ -137,6 +137,8 @@ Example :
137 137  
138 138 setParameters: function(params)
139 139 {
  140 + $(this._component).find("base-datalet")[0].setFooter(params['title'], params['description']);
  141 +
140 142 var chart = $(this._component.$.charts.$.container).highcharts();
141 143  
142 144 chart.setTitle({text: params['title']});
... ...