data-sevc-controllet.html
5.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/********************************************************************************************************************************
<!--<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">
/********************************************************************************************************************************
<link rel="import" href="../../bower_components/polymer/polymer.html">
<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">
<dom-module id="data-sevc-controllet">
<template>
<page-slider-controllet id="slider">
<neon-animatable>
<dataset-selection-controllet id="dataset_selection" datasets={{datasets}}></dataset-selection-controllet>
</neon-animatable>
<neon-animatable>
<tree-view-multi-table-controllet id="tree_view_multi_table" data-url={{dataUrl}}></tree-view-multi-table-controllet>
</neon-animatable>
<neon-animatable>
<datalet-selection-controllet id="datalet_selection" deep-url={{deepUrl}} datalets-list-url={{dataletsListUrl}} data-url={{dataUrl}} fields={{fields}}></datalet-selection-controllet>
</neon-animatable>
</page-slider-controllet>
</template>
<script>
Polymer({
is : 'data-sevc-controllet',
listeners : {
'page-slider-controllet_selected' : '_updateSlider',
'dataset-selection-controllet_data-url' : '_allowSecondStep',
'tree-view-controllet_selected-fields' : '_allowThirdStep'
},
properties : {
deepUrl : {
type : String,
value : undefined
},
dataletsListUrl : {
type : String ,
value : undefined
},
datasets : {
type : Array,
value : undefined
},
dataUrl : {
type : String,
value : undefined
},
jsonData : {
type : Object,
value : undefined
}
},
ready : function(){
},
_updateSlider : function(e){
switch (e.detail.selected) {
case 0:
slider.setTitle("SELECT DATASET", "Search or copy and paste the url of dataset.");
slider.chevronLeft("invisible");
slider.chevronRight(false);
this.$.dataset_selection._fireDataUrl();
// http://designpieces.com/palette/google-new-logo-2015-color-palette-hex-and-rgb/
break;
case 1:
slider.setTitle("SELECT FIELDS", "Select the fields from tree-view. The multi-table will show the values related to the selected fields.");
slider.chevronLeft(true);
slider.chevronRight(false);
this.$.tree_view_multi_table.ready();
this._allowThirdStep({detail: {fields: tree_view_multi_table.getFlatFields()}})
break;
case 2:
slider.setTitle("SELECT DATALET", "Select a visualization, fill out inputs and labels (optional).");
slider.chevronLeft(true);
slider.chevronRight("invisible");
//reset when?
this.$.datalet_selection.setFields(tree_view_multi_table.getFlatFields());//???
this.$.datalet_selection.ready();//???
}
},
_allowSecondStep : function(e){
this.dataUrl = e.detail.url;
$.ajax({
url: e.detail.url,
dataType: "json",
success: function(data){
// this.dataUrl = e.detail.url
// this.jsonData = JSON.stringify(data);
slider.chevronRight(true);
},
error: function(){
// this.jsonData = undefined;
slider.chevronRight(false);
}
});
},
_allowThirdStep : function(e){
if(e.detail.fields.length > 0)
slider.chevronRight(true);
else
slider.chevronRight(false);
}
});
</script>
</dom-module>