Commit 39d5ab708a752243b293ce4955cb9a7621307fe6
1 parent
7a8b7446
update filters
Showing
5 changed files
with
11 additions
and
193 deletions
controllets/datalet-selection-controllet/datalet-selection-controllet.html
@@ -219,7 +219,7 @@ | @@ -219,7 +219,7 @@ | ||
219 | 219 | ||
220 | <!-- EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE --> | 220 | <!-- EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE EXPERT MODE --> |
221 | 221 | ||
222 | - <div id="expert_header" on-click="_showExpertMode"><span id="expert">ADVANCED: GROUP BY</span></div> | 222 | + <div id="expert_header" on-click="_showExpertMode"><span id="expert">GROUP BY</span></div> |
223 | 223 | ||
224 | <div id="expert_container"> | 224 | <div id="expert_container"> |
225 | 225 |
controllets/filters-controllet/filters-controllet.html
@@ -106,7 +106,7 @@ | @@ -106,7 +106,7 @@ | ||
106 | 106 | ||
107 | <div id="filters_container"> | 107 | <div id="filters_container"> |
108 | 108 | ||
109 | - <div id="filters_header" class="filters_header" on-click="_showFiltersPanel"><span id="filters">ADVANCED: FILTERS</span></div> | 109 | + <div id="filters_header" class="filters_header" on-click="_showFiltersPanel"><span id="filters">ADD FILTERS</span></div> |
110 | 110 | ||
111 | <div id="filters_panel"> | 111 | <div id="filters_panel"> |
112 | 112 | ||
@@ -114,7 +114,7 @@ | @@ -114,7 +114,7 @@ | ||
114 | <tr> | 114 | <tr> |
115 | <th> | 115 | <th> |
116 | <paper-dropdown-menu id="filter_field" label="Field"> | 116 | <paper-dropdown-menu id="filter_field" label="Field"> |
117 | - <paper-menu class="dropdown-content"> | 117 | + <paper-menu id="filter_field_menu" class="dropdown-content"> |
118 | <template is="dom-repeat" items={{fields}}> | 118 | <template is="dom-repeat" items={{fields}}> |
119 | <paper-item id={{index}} on-tap="">{{_fieldName(item)}}</paper-item> | 119 | <paper-item id={{index}} on-tap="">{{_fieldName(item)}}</paper-item> |
120 | </template> | 120 | </template> |
@@ -123,7 +123,7 @@ | @@ -123,7 +123,7 @@ | ||
123 | </th> | 123 | </th> |
124 | <th> | 124 | <th> |
125 | <paper-dropdown-menu id="filter_operation" label="Operation"> | 125 | <paper-dropdown-menu id="filter_operation" label="Operation"> |
126 | - <paper-menu class="dropdown-content"> | 126 | + <paper-menu id="filter_operation_menu" class="dropdown-content"> |
127 | <template is="dom-repeat" items={{operations}}> | 127 | <template is="dom-repeat" items={{operations}}> |
128 | <paper-item id={{index}} on-tap="">{{item}}</paper-item> | 128 | <paper-item id={{index}} on-tap="">{{item}}</paper-item> |
129 | </template> | 129 | </template> |
@@ -131,7 +131,7 @@ | @@ -131,7 +131,7 @@ | ||
131 | </paper-dropdown-menu> | 131 | </paper-dropdown-menu> |
132 | </th> | 132 | </th> |
133 | <th> | 133 | <th> |
134 | - <paper-input id="filter_value" class="base_input"></paper-input> | 134 | + <paper-input id="filter_value" label="Value" class="base_input" maxlength="16" auto-validate pattern="^[_a-zA-Z0-9]*" error-message="Invalid value!"></paper-input> |
135 | </th> | 135 | </th> |
136 | <th class="filters_cell_button"> | 136 | <th class="filters_cell_button"> |
137 | <paper-icon-button on-click="_addFilter" icon="add-circle" class="add"></paper-icon-button> | 137 | <paper-icon-button on-click="_addFilter" icon="add-circle" class="add"></paper-icon-button> |
@@ -187,10 +187,6 @@ | @@ -187,10 +187,6 @@ | ||
187 | $(this.$.filters_panel).perfectScrollbar(); | 187 | $(this.$.filters_panel).perfectScrollbar(); |
188 | }, | 188 | }, |
189 | 189 | ||
190 | - attached : function() { | ||
191 | -// this.fire('filters-controllet_filters', {filters: this.filters}); | ||
192 | - }, | ||
193 | - | ||
194 | setFields : function(fields) { | 190 | setFields : function(fields) { |
195 | this.fields = this._copy(fields); | 191 | this.fields = this._copy(fields); |
196 | }, | 192 | }, |
@@ -219,7 +215,6 @@ | @@ -219,7 +215,6 @@ | ||
219 | }, | 215 | }, |
220 | 216 | ||
221 | _addFilter : function() { | 217 | _addFilter : function() { |
222 | -// var field = "["+this.$.filter_field.value+"]"; | ||
223 | var field = this.$.filter_field.value; | 218 | var field = this.$.filter_field.value; |
224 | var operation = this.$.filter_operation.value; | 219 | var operation = this.$.filter_operation.value; |
225 | var value = this.$.filter_value.value; | 220 | var value = this.$.filter_value.value; |
@@ -228,6 +223,10 @@ | @@ -228,6 +223,10 @@ | ||
228 | filters.push({"field": field, "operation": operation, "value": value}); | 223 | filters.push({"field": field, "operation": operation, "value": value}); |
229 | this.filters = this._copy(filters); | 224 | this.filters = this._copy(filters); |
230 | 225 | ||
226 | + this.$.filter_field_menu.select(-1); | ||
227 | + this.$.filter_operation_menu.select(-1); | ||
228 | + this.$.filter_value.value = ""; | ||
229 | + | ||
231 | this.fire('filters-controllet_filters', {filters: this.filters}); | 230 | this.fire('filters-controllet_filters', {filters: this.filters}); |
232 | }, | 231 | }, |
233 | 232 |
controllets/select-data-controllet/demo/index.html
@@ -13,8 +13,8 @@ | @@ -13,8 +13,8 @@ | ||
13 | 13 | ||
14 | <body> | 14 | <body> |
15 | 15 | ||
16 | - <select-data-controllet id="tvmt" root-name="data" opened-path="records,geometry" preselected-fields='["nhits", "records,datasetid", "records,recordid"]' data-url="https://data.issy.com/api/records/1.0/search?dataset=liste-des-restaurants-a-issy-les-moulineaux&sort=type&facet=type&facet=terrasse"></select-data-controllet> | ||
17 | - <!--<tree-view-multi-table-controllet id="tvmt" root-name="data" data-url="http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52&limit=5"></tree-view-multi-table-controllet>--> | 16 | + <!--<select-data-controllet id="tvmt" root-name="data" opened-path="records,geometry" preselected-fields='["nhits", "records,datasetid", "records,recordid"]' data-url="http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52&limit=5"></select-data-controllet>--> |
17 | + <select-data-controllet id="tvmt" root-name="data" data-url="http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52&limit=5"></select-data-controllet> | ||
18 | 18 | ||
19 | <script> | 19 | <script> |
20 | var tvmt = document.getElementById('tvmt'); | 20 | var tvmt = document.getElementById('tvmt'); |
controllets/tree-view-multi-table-controllet/demo/index.html deleted
1 | -<html> | ||
2 | - | ||
3 | -<head> | ||
4 | - <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> | ||
5 | - | ||
6 | - <script src="../../shared_js/jquery-1.11.2.min.js"></script> | ||
7 | - | ||
8 | - <script src="../../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script> | ||
9 | - <link rel="stylesheet" href="../../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css"> | ||
10 | - | ||
11 | - <link rel="import" href="../../tree-view-multi-table-controllet/tree-view-multi-table-controllet.html" /> | ||
12 | -</head> | ||
13 | - | ||
14 | -<body> | ||
15 | - | ||
16 | - <tree-view-multi-table-controllet id="tvmt" root-name="data" opened-path="records,geometry" preselected-fields='["nhits", "records,datasetid", "records,recordid"]' data-url="https://data.issy.com/api/records/1.0/search?dataset=liste-des-restaurants-a-issy-les-moulineaux&sort=type&facet=type&facet=terrasse"></tree-view-multi-table-controllet> | ||
17 | - <!--<tree-view-multi-table-controllet id="tvmt" root-name="data" data-url="http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52&limit=5"></tree-view-multi-table-controllet>--> | ||
18 | - | ||
19 | - <script> | ||
20 | - var tvmt = document.getElementById('tvmt'); | ||
21 | - | ||
22 | - tvmt.addEventListener("tree-view-controllet_selected-fields", function (e) { | ||
23 | - console.log(tvmt.getFlatFields()); | ||
24 | - console.log(tvmt.getFields()); | ||
25 | - }); | ||
26 | - | ||
27 | - </script> | ||
28 | - | ||
29 | -</body> | ||
30 | - | ||
31 | -</html> | ||
32 | - | ||
33 | -<!--urls:--> | ||
34 | -<!--http://dati.lazio.it/catalog/api/action/datastore_search?resource_id=114baf3d-6d4f-42ff-b4af-481beef59ae1--> | ||
35 | -<!--url: 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52&limit=5',--> | ||
36 | -<!--url: 'https://data.issy.com/api/records/1.0/search?dataset=liste-des-restaurants-a-issy-les-moulineaux&sort=type&facet=type&facet=terrasse',--> | ||
37 | -<!--url: 'https://data.issy.com/api/records/1.0/search?dataset=flux-rss-des-offres-demplois-a-issy-les-moulineaux&sort=published&facet=published&refine.published=2015',--> | ||
38 | \ No newline at end of file | 0 | \ No newline at end of file |
controllets/tree-view-multi-table-controllet/tree-view-multi-table-controllet.html deleted
1 | -<link rel="import" href="../../bower_components/polymer/polymer.html" /> | ||
2 | - | ||
3 | -<link rel="import" href="../../bower_components/paper-material/paper-material.html" /> | ||
4 | - | ||
5 | -<link rel="import" href="../tree-view-controllet/tree-view-controllet.html" /> | ||
6 | -<link rel="import" href="../multi-table-controllet/multi-table-controllet.html" /> | ||
7 | - | ||
8 | -<dom-module id="tree-view-multi-table-controllet"> | ||
9 | - | ||
10 | - <style is="custom-style"> | ||
11 | - .div_container { | ||
12 | - display: flex; | ||
13 | - flex-direction: row; | ||
14 | - } | ||
15 | - #material_tree_view { | ||
16 | - position: relative; | ||
17 | - width: 25%; | ||
18 | - min-width: 200px; | ||
19 | - height: 100vh; | ||
20 | - } | ||
21 | - #material_multi_table { | ||
22 | - position: relative; | ||
23 | - width: 75%; | ||
24 | - | ||
25 | - margin-left: 64px; | ||
26 | - margin-top: 8px; | ||
27 | - } | ||
28 | - </style> | ||
29 | - | ||
30 | - <template> | ||
31 | - | ||
32 | - <div class="div_container"> | ||
33 | - <paper-material id="material_tree_view" elevation="5"> | ||
34 | - <tree-view-controllet id="tree_view" root-name={{rootName}} opened-path={{openedPath}} preselected-fields={{preselectedFields}}></tree-view-controllet> | ||
35 | - </paper-material> | ||
36 | - <paper-material id="material_multi_table" elevation="5"> | ||
37 | - <multi-table-controllet id="multi_table" data-url={{dataUrl}}></multi-table-controllet> | ||
38 | - </paper-material> | ||
39 | - </div> | ||
40 | - | ||
41 | - </template> | ||
42 | - | ||
43 | - <script> | ||
44 | - Polymer({ | ||
45 | - | ||
46 | - is : 'tree-view-multi-table-controllet', | ||
47 | - | ||
48 | - properties : { | ||
49 | - | ||
50 | - rootName : { | ||
51 | - type : String, | ||
52 | - value : "root" | ||
53 | - }, | ||
54 | - | ||
55 | - preselectedFields : { | ||
56 | - type : Array, | ||
57 | - value : [] | ||
58 | - }, | ||
59 | - | ||
60 | - openedPath : { | ||
61 | - type : String, | ||
62 | - value : undefined | ||
63 | - }, | ||
64 | - | ||
65 | - dataUrl : { | ||
66 | - type : String, | ||
67 | - value : undefined, | ||
68 | - observer : '_init' | ||
69 | - } | ||
70 | - | ||
71 | - }, | ||
72 | - | ||
73 | - listeners: { | ||
74 | - 'tree-view-controllet_selected-fields': '_updateSelectedFields' | ||
75 | - }, | ||
76 | - | ||
77 | - ready : function() { | ||
78 | -// if(this.dataUrl) | ||
79 | -// this._init(); | ||
80 | - | ||
81 | - $(this.$.material_tree_view).perfectScrollbar(); | ||
82 | - $(this.$.material_multi_table).perfectScrollbar(); | ||
83 | - }, | ||
84 | - | ||
85 | - attached : function(){ | ||
86 | - this._resize(); | ||
87 | - var that = this; | ||
88 | - window.addEventListener("resize", function() { that._resize(); }); | ||
89 | - }, | ||
90 | - | ||
91 | - getFields : function() { | ||
92 | - return this.$.tree_view.getFields(); | ||
93 | - }, | ||
94 | - | ||
95 | - getFlatFields : function() { | ||
96 | - return this.$.tree_view.getFlatFields(); | ||
97 | - }, | ||
98 | - | ||
99 | - _init : function() { | ||
100 | - var tree = document.getElementById('tree_view'); | ||
101 | - var that = this; | ||
102 | - | ||
103 | - $.ajax({ | ||
104 | - url: this.dataUrl, | ||
105 | - dataType: "json", | ||
106 | - success: function(data){ | ||
107 | - that.rootName = "data" | ||
108 | - data = that._filterJson(data); | ||
109 | - tree.setAttribute("json-data", JSON.stringify(data)); | ||
110 | - tree.selectedFields = []; | ||
111 | - that._updateSelectedFields(); | ||
112 | - tree.ready(); | ||
113 | - } | ||
114 | - }); | ||
115 | - | ||
116 | - this.$.multi_table.ready(); | ||
117 | - }, | ||
118 | - | ||
119 | - _filterJson : function(data){ | ||
120 | -// console.log(data); | ||
121 | -// console.log(this.dataUrl); | ||
122 | - if(data.result != undefined && data.result.resource_id != undefined) { | ||
123 | - this.rootName = "result,records" | ||
124 | - return data.result.records; | ||
125 | - } | ||
126 | - return data; | ||
127 | - }, | ||
128 | - | ||
129 | - _updateSelectedFields : function() { | ||
130 | - var fields = this.$.tree_view.getFields(); | ||
131 | - this.$.multi_table.setSelectedFields(fields); | ||
132 | - }, | ||
133 | - | ||
134 | - _resize : function(){ | ||
135 | - var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - 16; | ||
136 | - h = h - 64; //height with page scroller | ||
137 | - $("#material_tree_view").height(h); | ||
138 | - } | ||
139 | - | ||
140 | - }); | ||
141 | - | ||
142 | - </script> | ||
143 | - | ||
144 | -</dom-module> | ||
145 | \ No newline at end of file | 0 | \ No newline at end of file |