Blame view

controllets/data-sevc-controllet/data-sevc-controllet.html 5.34 KB
0f6424fe   root   update new data-s...
1
2
3
4
5
6
  /********************************************************************************************************************************

  <!--<script src="../shared_js/jquery-1.11.2.min.js"></script>-->

  <!--<script src="../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>-->

  <script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>

  <link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">

  /********************************************************************************************************************************

ae17a8dc   Luigi Serra   Controllet and da...
7
  

938d1928   Luigi Serra   Update documentat...
8
  <link rel="import" href="../../bower_components/polymer/polymer.html">

938d1928   Luigi Serra   Update documentat...
9
  

0f6424fe   root   update new data-s...
10
11
12
13
  <link rel="import" href="../page-slider-controllet/page-slider-controllet.html">

  <link rel="import" href="../dataset-selection-controllet/dataset-selection-controllet.html">

  <link rel="import" href="../tree-view-multi-table-controllet/tree-view-multi-table-controllet.html" />

  <link rel="import" href="../datalet-selection-controllet/datalet-selection-controllet.html">

938d1928   Luigi Serra   Update documentat...
14
15
  

  <dom-module id="data-sevc-controllet">

73bcce88   luigser   COMPONENTS
16
  

0f6424fe   root   update new data-s...
17
      <template>

74249687   Luigi Serra   Cross browser con...
18
  

0f6424fe   root   update new data-s...
19
          <page-slider-controllet id="slider">

486a1c48   Luigi Serra   selection control...
20
  

0f6424fe   root   update new data-s...
21
              <neon-animatable>

486a1c48   Luigi Serra   selection control...
22
  

0f6424fe   root   update new data-s...
23
                  <dataset-selection-controllet id="dataset_selection" datasets={{datasets}}></dataset-selection-controllet>

24be6abb   Luigi Serra   selection control...
24
  

0f6424fe   root   update new data-s...
25
              </neon-animatable>

24be6abb   Luigi Serra   selection control...
26
  

0f6424fe   root   update new data-s...
27
              <neon-animatable>

a31f0660   root   sevc-controllet i...
28
  

29124159   root   ckan tree-view up...
29
                  <tree-view-multi-table-controllet id="tree_view_multi_table" data-url={{dataUrl}}></tree-view-multi-table-controllet>

a31f0660   root   sevc-controllet i...
30
  

0f6424fe   root   update new data-s...
31
              </neon-animatable>

73bcce88   luigser   COMPONENTS
32
  

0f6424fe   root   update new data-s...
33
              <neon-animatable>

73bcce88   luigser   COMPONENTS
34
  

0f6424fe   root   update new data-s...
35
                  <datalet-selection-controllet id="datalet_selection" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}} data-url={{dataUrl}} fields={{fields}}></datalet-selection-controllet>

73bcce88   luigser   COMPONENTS
36
  

0f6424fe   root   update new data-s...
37
              </neon-animatable>

73bcce88   luigser   COMPONENTS
38
  

0f6424fe   root   update new data-s...
39
          </page-slider-controllet>

c011cd54   Luigi Serra   selection control...
40
  

73bcce88   luigser   COMPONENTS
41
      </template>

74249687   Luigi Serra   Cross browser con...
42
  

73bcce88   luigser   COMPONENTS
43
44
      <script>

  

73bcce88   luigser   COMPONENTS
45
46
47
48
          Polymer({

  

              is : 'data-sevc-controllet',

  

73bcce88   luigser   COMPONENTS
49
              listeners : {

0f6424fe   root   update new data-s...
50
                  'page-slider-controllet_selected' : '_updateSlider',

707a1508   root   update data-table...
51
52
                  'dataset-selection-controllet_data-url' : '_allowSecondStep',

                  'tree-view-controllet_selected-fields' : '_allowThirdStep'

73bcce88   luigser   COMPONENTS
53
54
55
56
              },

  

              properties : {

  

73bcce88   luigser   COMPONENTS
57
58
                  deepUrl : {

                      type : String,

24be6abb   Luigi Serra   selection control...
59
                      value : undefined

73bcce88   luigser   COMPONENTS
60
                  },

0f6424fe   root   update new data-s...
61
62
63
  

                  dataletsListUrl : {

                      type : String ,

24be6abb   Luigi Serra   selection control...
64
                      value : undefined

73bcce88   luigser   COMPONENTS
65
                  },

0f6424fe   root   update new data-s...
66
67
  

                  datasets : {

73bcce88   luigser   COMPONENTS
68
                      type : Array,

24be6abb   Luigi Serra   selection control...
69
70
                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
71
  

0f6424fe   root   update new data-s...
72
73
74
75
                  dataUrl : {

                      type  : String,

                      value : undefined

                  },

a31f0660   root   sevc-controllet i...
76
  

0f6424fe   root   update new data-s...
77
78
79
                  jsonData : {

                      type  : Object,

                      value : undefined

a31f0660   root   sevc-controllet i...
80
81
                  }

  

035bbee3   Luigi Serra   Datalets and cont...
82
              },

035bbee3   Luigi Serra   Datalets and cont...
83
  

0f6424fe   root   update new data-s...
84
              ready : function(){

73bcce88   luigser   COMPONENTS
85
              },

74249687   Luigi Serra   Cross browser con...
86
  

0f6424fe   root   update new data-s...
87
88
              _updateSlider : function(e){

                  switch (e.detail.selected) {

74249687   Luigi Serra   Cross browser con...
89
                      case 0:

0f6424fe   root   update new data-s...
90
                          slider.setTitle("SELECT DATASET", "Search or copy and paste the url of dataset.");

707a1508   root   update data-table...
91
                          slider.chevronLeft("invisible");

0f6424fe   root   update new data-s...
92
93
94
95
                          slider.chevronRight(false);

                          this.$.dataset_selection._fireDataUrl();

  //                        http://designpieces.com/palette/google-new-logo-2015-color-palette-hex-and-rgb/

                                  break;

74249687   Luigi Serra   Cross browser con...
96
                      case 1:

0f6424fe   root   update new data-s...
97
                          slider.setTitle("SELECT FIELDS", "Select the fields from tree-view. The multi-table will show the values related to the selected fields.");

707a1508   root   update data-table...
98
99
                          slider.chevronLeft(true);

                          slider.chevronRight(false);

0f6424fe   root   update new data-s...
100
                          this.$.tree_view_multi_table.ready();

707a1508   root   update data-table...
101
                          this._allowThirdStep({detail: {fields: tree_view_multi_table.getFlatFields()}})

0f6424fe   root   update new data-s...
102
                          break;

74249687   Luigi Serra   Cross browser con...
103
                      case 2:

0f6424fe   root   update new data-s...
104
                          slider.setTitle("SELECT DATALET", "Select a visualization, fill out inputs and labels (optional).");

707a1508   root   update data-table...
105
106
107
                          slider.chevronLeft(true);

                          slider.chevronRight("invisible");

                              //reset when?

0f6424fe   root   update new data-s...
108
109
                          this.$.datalet_selection.setFields(tree_view_multi_table.getFlatFields());//???

                          this.$.datalet_selection.ready();//???

74249687   Luigi Serra   Cross browser con...
110
                  }

c011cd54   Luigi Serra   selection control...
111
              },

2b235978   Luigi Serra   Controllet cross ...
112
  

707a1508   root   update data-table...
113
              _allowSecondStep : function(e){

0f6424fe   root   update new data-s...
114
                  this.dataUrl = e.detail.url;

c011cd54   Luigi Serra   selection control...
115
  

0f6424fe   root   update new data-s...
116
117
118
119
120
121
122
                  $.ajax({

                      url: e.detail.url,

                      dataType: "json",

                      success: function(data){

  //                        this.dataUrl = e.detail.url

  //                        this.jsonData = JSON.stringify(data);

                          slider.chevronRight(true);

a31f0660   root   sevc-controllet i...
123
                      },

0f6424fe   root   update new data-s...
124
125
126
127
128
                      error: function(){

  //                        this.jsonData = undefined;

                          slider.chevronRight(false);

                      }

                  });

707a1508   root   update data-table...
129
130
131
132
133
134
135
              },

  

              _allowThirdStep : function(e){

                  if(e.detail.fields.length > 0)

                      slider.chevronRight(true);

                  else

                      slider.chevronRight(false);

0f6424fe   root   update new data-s...
136
              }

73bcce88   luigser   COMPONENTS
137
138
139
140
141
142
  

          });

  

      </script>

  

  </dom-module>