Review Board 1.6.3

HUE-913 [core] Convert new jump to column to jQuery plugin and test it

Review Request #2435 - submitted 1 year, 5 months ago

Enrice Berti Reviewers
hue
HUE-913 romain, abec
None hue-rw
commit 58974f86b9be74c6aca9ce627c0e535826a3e509
Author: Enrico Berti <hello@enricoberti.com>
Date:   Mon Nov 12 17:23:54 2012 +0100

    HUE-913 [core] Convert new jump to column to jQuery plugin and test it
    
    Refactored HUE-899 to jQuery plugin
    Added plugin to the 'sample' tab of a table
    Added basic infrastructure for jQuery plugins Jasmine tests
    Improved usability of the plugin (fixed headers, toggable tooltip with row identifier)

:100644 100644 d8cc8b4... 870183b... M	apps/beeswax/src/beeswax/templates/describe_table.mako
:100644 100644 7b28e74... e559ae4... M	apps/beeswax/src/beeswax/templates/watch_results.mako
:100644 100644 970f201... f58b07e... M	desktop/core/src/desktop/templates/common_header.mako
:000000 100644 0000000... ab57a17... A	desktop/core/src/desktop/templates/jasmine.mako
:100644 100644 7aadaca... 8828f11... M	desktop/core/src/desktop/urls.py
:100644 100644 31d42e0... f3d6e01... M	desktop/core/src/desktop/views.py
:100644 100644 fb45e94... 9e5e891... M	desktop/core/static/css/hue2.css
:000000 100644 0000000... bf43c6f... A	desktop/core/static/jasmine/jHueSelectorFixture.html
:000000 100644 0000000... 8c44753... A	desktop/core/static/jasmine/jHueSelectorSpec.js
:000000 100644 0000000... 5e415ce... A	desktop/core/static/jasmine/jHueTableExtenderFixture.html
:000000 100644 0000000... 2ce26dc... A	desktop/core/static/jasmine/jHueTableExtenderSpec.js
:000000 100644 0000000... 0013669... A	desktop/core/static/js/Source/jHue/jquery.tableextender.js
Manual FF + Chrome
Basic jasmine test to see that the plugin is applied to the element. We need a better framework for visual testing imho.
apps/beeswax/src/beeswax/templates/describe_table.mako
Revision d8cc8b4d8bb9de3dfafd09d8a2f6f47e1996ab5b New Change
... 62 lines hidden [Expand]
63
					<li><a href="${ url("beeswax.views.read_table", table=table_name) }">${_('Browse Data')}</a></li>
63
					<li><a href="${ url("beeswax.views.read_table", table=table_name) }">${_('Browse Data')}</a></li>
64
			        <li><a href="#dropTable" data-toggle="modal">${_('Drop')} ${view_or_table_noun}</a></li>
64
			    <li><a href="#dropTable" data-toggle="modal">${_('Drop')} ${view_or_table_noun}</a></li>
65
			        <li><a href="${hdfs_link}" rel="${ table.sd.location }">${_('View File Location')}</a></li>
65
			    <li><a href="${hdfs_link}" rel="${ table.sd.location }">${_('View File Location')}</a></li>
66
				</ul>
66
				</ul>
67
			</div>
67
			</div>

   
68
      <div id="jumpToColumnAlert" class="alert hide">

   
69
        <button type="button" class="close" data-dismiss="alert">&times;</button>

   
70
        <strong>${_('Did you know?')}</strong> ${_('You can click on a row to select a column you want to jump to.')}

   
71
      </div>
68
		</div>
72
		</div>
69
		<div class="span9">
73
		<div class="span9">
70
			% if table.parameters.get("comment", False):
74
			% if table.parameters.get("comment", False):
71
		    <h5>${ table.parameters.get("comment") }</h5>
75
		    <h5>${ table.parameters.get("comment") }</h5>
72
			% endif
76
			% endif
... 18 lines hidden [Expand]
91
		            <a href="${ url("beeswax.views.describe_partitions", table=table_name) }">${_('Show Partitions')}</a>
95
		            <a href="${ url("beeswax.views.describe_partitions", table=table_name) }">${_('Show Partitions')}</a>
92
		          </div>
96
		          </div>
93
		        % endif
97
		        % endif
94
				% if top_rows is not None:
98
				% if top_rows is not None:
95
					<div class="tab-pane" id="sample">
99
					<div class="tab-pane" id="sample">
96
						<table class="table table-striped table-condensed datatables">
100
						<table class="table table-striped table-condensed sampleTable">
97
			              <thead>
101
			              <thead>
98
			                <tr>
102
			                <tr>
99
			                  % for col in table.sd.cols:
103
			                  % for col in table.sd.cols:
100
			                    <th>${col.name}</th>
104
			                    <th style="white-space: nowrap">${col.name}</th>
101
			                  % endfor
105
			                  % endfor
102
			                </tr>
106
			                </tr>
103
			              </thead>
107
			              </thead>
104
			              <tbody>
108
			              <tbody>
105
			                % for i, row in enumerate(top_rows):
109
			                % for i, row in enumerate(top_rows):
106
			                  <tr>
110
			                  <tr>
107
			                    % for item in row:
111
			                    % for item in row:
108
			                      <td>${ item }</td>
112
			                      <td style="white-space: nowrap">${ item }</td>
109
			                    % endfor
113
			                    % endfor
110
			                  </tr>
114
			                  </tr>
111
			                % endfor
115
			                % endfor
112
			              </tbody>
116
			              </tbody>
113
			            </table>
117
			            </table>
... 84 lines hidden [Expand]
198
        display:none;
202
        display:none;
199
        min-height:100px;
203
        min-height:100px;
200
        overflow-y:scroll;
204
        overflow-y:scroll;
201
        margin-top:10px;
205
        margin-top:10px;
202
    }
206
    }

   
207

   

   
208
    .sampleTable td, .sampleTable th {

   
209
      white-space: nowrap;

   
210
    }
203
</style>
211
</style>
204

   
212

   
205
<script type="text/javascript" charset="utf-8">
213
<script type="text/javascript" charset="utf-8">
206
    $(document).ready(function(){
214
    $(document).ready(function(){
207
        $("#filechooser").jHueFileChooser({
215
        $("#filechooser").jHueFileChooser({
... 18 lines hidden [Expand]
226
            $(this).closest(".modal").modal("hide");
234
            $(this).closest(".modal").modal("hide");
227
        });
235
        });
228
        $(".loadPath").click(function(){
236
        $(".loadPath").click(function(){
229
            $("#filechooser").slideDown();
237
            $("#filechooser").slideDown();
230
        });
238
        });

   
239

   

   
240
      $('a[data-toggle="tab"]').on('shown', function () {

   
241
        $(".sampleTable").not('.initialized').addClass('initialized').dataTable({

   
242
          "bPaginate": false,

   
243
          "bLengthChange": false,

   
244
          "bInfo": false,

   
245
          "bFilter": false,

   
246
          "fnInitComplete": function () {

   
247
            $(".sampleTable").parent().jHueTableScroller();

   
248
            $(".sampleTable").jHueTableExtender({

   
249
              hintElement: "#jumpToColumnAlert",

   
250
              fixedHeader: true

   
251
            });

   
252
          }

   
253
        });

   
254
      })

   
255

   

   
256

   
231
    });
257
    });
232
</script>
258
</script>
233

   
259

   
234
${commonfooter(messages)}
260
${commonfooter(messages)}
apps/beeswax/src/beeswax/templates/watch_results.mako
Revision 7b28e744cec88d793e96984945e67a2b1d561a36 New Change
 
desktop/core/src/desktop/urls.py
Revision 7aadaca9eb41f112f68c6886ed40edd94d7d62f8 New Change
 
desktop/core/src/desktop/views.py
Revision 31d42e0d7458cedd024afd4b17e485e40644a3cb New Change
 
desktop/core/src/desktop/templates/common_header.mako
Revision 970f201d452caa6939083bfe6fec8656d7eafaf4 New Change
 
desktop/core/src/desktop/templates/jasmine.mako
New File
 
desktop/core/static/css/hue2.css
Revision fb45e948fa68ac432afc4779265c003b33471c9f New Change
 
desktop/core/static/jasmine/jHueSelectorFixture.html
New File
 
desktop/core/static/jasmine/jHueSelectorSpec.js
New File
 
desktop/core/static/jasmine/jHueTableExtenderFixture.html
New File
 
desktop/core/static/jasmine/jHueTableExtenderSpec.js
New File
 
desktop/core/static/js/Source/jHue/jquery.tableextender.js
New File
 
  1. apps/beeswax/src/beeswax/templates/describe_table.mako: Loading...
  2. apps/beeswax/src/beeswax/templates/watch_results.mako: Loading...
  3. desktop/core/src/desktop/urls.py: Loading...
  4. desktop/core/src/desktop/views.py: Loading...
  5. desktop/core/src/desktop/templates/common_header.mako: Loading...
  6. desktop/core/src/desktop/templates/jasmine.mako: Loading...
  7. desktop/core/static/css/hue2.css: Loading...
  8. desktop/core/static/jasmine/jHueSelectorFixture.html: Loading...
  9. desktop/core/static/jasmine/jHueSelectorSpec.js: Loading...
  10. desktop/core/static/jasmine/jHueTableExtenderFixture.html: Loading...
  11. desktop/core/static/jasmine/jHueTableExtenderSpec.js: Loading...
  12. desktop/core/static/js/Source/jHue/jquery.tableextender.js: Loading...