Commit aea85df9a84ea9d44552febd5a6152d6576bcb26

Authored by Luigi Serra
1 parent f6703091

demo page updated

Showing 1 changed file with 66 additions and 27 deletions
demo.html
... ... @@ -12,7 +12,8 @@
12 12 <link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html">
13 13 <link rel="import" href="bower_components/iron-ajax/iron-ajax.html">
14 14  
15   - <link rel="import" href="controllets/items-slider-controllet/items-slider-controllet.html">
  15 + <link rel="import" href="controllets/animated-button-container-controllet/animated-button-container-controllet.html">
  16 + <link rel="import" href="controllets/items-list-controllet/item-list-controllet.html">
16 17 <link rel="import" href="controllets/draggable-element-controllet/draggable-element-controllet.html">
17 18 <link rel="import" href="controllets/treeview-controllet/treeview-controllet.html">
18 19 <link rel="import" href="controllets/text-element-controllet/text-element-controllet.html">
... ... @@ -34,7 +35,7 @@
34 35  
35 36 $(document).ready(function () {
36 37 window.addEventListener("treeview-controllet_fileds-selected", DEEP._fieldsSelected, false);
37   - window.addEventListener("items-slider-controllet_item-selected", DEEP._dataletSelected, false);
  38 + window.addEventListener("items-list-controllet_item-selected", DEEP._dataletSelected, false);
38 39 window.addEventListener("draggable-element-controllet_content-dragged", DEEP._fieldsMapped, false);
39 40 window.addEventListener("text-element-controllet_content-changed", DEEP._textElementChanged, false);
40 41  
... ... @@ -93,8 +94,7 @@
93 94 #visualization_slider_area
94 95 {
95 96 min-width: 566px;
96   - min-height: 200px;
97   - height: 175px;
  97 + height: 100px;
98 98 }
99 99 .content-card {
100 100 position: relative;
... ... @@ -264,8 +264,8 @@
264 264  
265 265 //DEEP.deepUrl = "http://deep.routetopa.eu/DEEP/";
266 266 //DEEP.datasetsList = "http://deep.routetopa.eu/DEEP/datalets-list";
267   - DEEP.deepUrl = "http://192.168.186.137/DEEalerProvider/DEEP/";
268   - DEEP.datasetsList = "http://192.168.186.137/DEEalerProvider/DEEP/datalets-list";
  267 + DEEP.deepUrl = "http://192.168.164.128/DatalEts-Ecosystem-Provider/DEEP/";
  268 + DEEP.datasetsList = "http://192.168.164.128/DatalEts-Ecosystem-Provider/DEEP/datalets-list";
269 269  
270 270 DEEP.Datasets = {
271 271 names:[
... ... @@ -308,6 +308,8 @@
308 308 ]
309 309 };
310 310  
  311 + DEEP.selected_fields = undefined;
  312 +
311 313 DEEP.handleResponseData = function(e){
312 314 DEEP.$.fields_treeview.init(e.detail.response);
313 315 $("#fields_placeholder").perfectScrollbar();
... ... @@ -324,8 +326,12 @@
324 326 DEEP.datalets_list.push(datalet_info);
325 327 }
326 328  
327   - DEEP.$.visualization_slider_area.innerHTML = '<items-slider-controllet items=\'' + JSON.stringify(DEEP.datalets_list) + '\'' +
328   - '\'></items-slider-controllet>';
  329 + DEEP.$.visualization_slider_area.innerHTML = '<animated-button-container-controllet height="300" width="450" icon="assessment" icon-width="64" icon-height="64" background-button-color="#2196F3">' +
  330 + '<items-list-controllet' +
  331 + ' replace-string="-datalet"' +
  332 + ' items=\'' + JSON.stringify(DEEP.datalets_list) + '\'>' +
  333 + '</items-list-controllet>' +
  334 + '</animated-button-container-controllet>';
329 335 };
330 336  
331 337 DEEP.handleSelectedDatalet = function(e){
... ... @@ -334,34 +340,67 @@
334 340 DEEP.$.datalet_idm_fields_container.innerHTML = "";
335 341 DEEP.$.idm_layout_container.innerHTML = "";
336 342  
  343 + var input;
  344 + var layouts = jQuery.extend(true, {}, response.idm.inputs.layouts);
  345 +
337 346 if(response.idm.inputs.input.constructor == Object) {
338   - var input = response.idm.inputs.input;
339   - if(input.selection == "*") {
340   - var input_selected_fields = Polymer.dom(DEEP.$.selected_fields_container).querySelectorAll('draggable-element-controllet');
341   - for (var j = 0; j < input_selected_fields.length; j++) {
342   - DEEP.$.datalet_idm_fields_container.innerHTML += '<draggable-element-controllet is-target="true" heading="Field ' + (j + 1) + '" description="' + input.description + '" number="' + (j + 1) + '"></draggable-element-controllet><br>';
  347 + if(response.idm.inputs.input.selection == "*")
  348 + {
  349 + var fields = this.$.selectedFields_container.querySelectorAll('draggable-element-controllet');
  350 + input = response.idm.inputs.input;
  351 + response.idm.inputs.input = new Array();
  352 + for(var i=0;i<fields.length;i++){
  353 + var newInput = jQuery.extend(true, {}, input);
  354 + newInput.name = input.name + ' ' + (i + 1);
  355 + response.idm.inputs.input.push(newInput);
343 356 }
344 357 }
345   - }else{
346   - for(var i =0; i < response.idm.inputs.input.length; i++){
347   - var input = response.idm.inputs.input[i];
348   - DEEP.$.datalet_idm_fields_container.innerHTML += '<draggable-element-controllet is-target="true" id="' + input.name + '" heading="' + input.name + '" description="' + input.description + '" number="' + (i + 1) + '"></draggable-element-controllet><br>';
  358 + }
  359 +
  360 + var heading;
  361 + var id;
  362 +
  363 + for(var i =0; i < response.idm.inputs.input.length; i++) {
  364 + var html = '<draggable-element-controllet is-target="true" ';
  365 + input = response.idm.inputs.input[i];
  366 +
  367 + heading = ' heading="' + input.name + '"';
  368 + id = ' id="' + (i + 1) + '"';
  369 +
  370 + html += heading + id;
  371 + html += ' description="' + input.description + '"' +
  372 + ' number="' + (i + 1) + '"';
  373 +
  374 + if(DEEP.selected_fields != undefined) {
  375 + if(this.selected_fields[i] != undefined) {
  376 + html += ' value="' + this.selected_fields[i] + '"' +
  377 + ' label="' + this.selected_fields[i].split(",")[this.selected_fields[i].split(",").length - 1] + '"';
  378 + }
349 379 }
  380 +
  381 + html += '></draggable-element-controllet>';
  382 + this.$.datalet_idm_fields_container.innerHTML += html;
  383 +
350 384 }
351 385  
352   - if(response.idm.inputs.layouts.input.constructor == Object) {
353   - var input = response.idm.inputs.layouts.input;
354   - DEEP.$.idm_layout_container.innerHTML += '<text-element-controllet heading="' + input.name + '" description="' + input.description + '" number="1"></text-element-controllet>';
355   - }else{
356   - for(var i =0; i < response.idm.inputs.layouts.input.length; i++){
357   - var input = response.idm.inputs.layouts.input[i];
358   - DEEP.$.idm_layout_container.innerHTML += '<text-element-controllet heading="' + input.name + '" ' +
359   - 'description="' + input.description + '" ' +
360   - 'number="' + (i+1) + '">' +
361   - '</text-element-controllet>';
  386 + if(layouts.input != undefined) {
  387 + if(layouts.input.constructor == Object){
  388 + layouts.input = new Array(jQuery.extend(true, {}, layouts.input));
362 389 }
  390 +
  391 + html = '<text-element-controllet ';
  392 + for (var i = 0; i < layouts.input.length; i++) {
  393 + html += '<text-element-controllet heading="' + layouts.input[i].name + '" ' +
  394 + 'description="' + layouts.input[i].description + '" ' +
  395 + 'number="' + (i + 1) + '" ';
  396 +
  397 + html += '></text-element-controllet>';
  398 + }
  399 + DEEP.$.idm_layout_container.innerHTML = html;
363 400 }
364 401  
  402 + if(DEEP.selected_fields != undefined) DEEP.generateDataletPreview();
  403 +
365 404 $("#selected_fields_main_container").perfectScrollbar();
366 405 $("#idm_fields_main_container").perfectScrollbar();
367 406 $("#idm_layout_main_container").perfectScrollbar();
... ...