Browse Source

HUE-702 Beeswax save result form is now styled

Enrico Berti 13 năm trước cách đây
mục cha
commit
0aab97e60c
72 tập tin đã thay đổi với 154 bổ sung40 xóa
  1. BIN
      TempStatsStore/log/log.ctrl
  2. BIN
      TempStatsStore/log/log1.dat
  3. BIN
      TempStatsStore/log/logmirror.ctrl
  4. BIN
      TempStatsStore/seg0/c10.dat
  5. BIN
      TempStatsStore/seg0/c101.dat
  6. BIN
      TempStatsStore/seg0/c111.dat
  7. BIN
      TempStatsStore/seg0/c121.dat
  8. BIN
      TempStatsStore/seg0/c130.dat
  9. BIN
      TempStatsStore/seg0/c141.dat
  10. BIN
      TempStatsStore/seg0/c150.dat
  11. BIN
      TempStatsStore/seg0/c161.dat
  12. BIN
      TempStatsStore/seg0/c171.dat
  13. BIN
      TempStatsStore/seg0/c180.dat
  14. BIN
      TempStatsStore/seg0/c191.dat
  15. BIN
      TempStatsStore/seg0/c1a1.dat
  16. BIN
      TempStatsStore/seg0/c1b1.dat
  17. BIN
      TempStatsStore/seg0/c1c0.dat
  18. BIN
      TempStatsStore/seg0/c1d1.dat
  19. BIN
      TempStatsStore/seg0/c1e0.dat
  20. BIN
      TempStatsStore/seg0/c1f1.dat
  21. BIN
      TempStatsStore/seg0/c20.dat
  22. BIN
      TempStatsStore/seg0/c200.dat
  23. BIN
      TempStatsStore/seg0/c211.dat
  24. BIN
      TempStatsStore/seg0/c221.dat
  25. BIN
      TempStatsStore/seg0/c230.dat
  26. BIN
      TempStatsStore/seg0/c241.dat
  27. BIN
      TempStatsStore/seg0/c251.dat
  28. BIN
      TempStatsStore/seg0/c260.dat
  29. BIN
      TempStatsStore/seg0/c271.dat
  30. BIN
      TempStatsStore/seg0/c281.dat
  31. BIN
      TempStatsStore/seg0/c290.dat
  32. BIN
      TempStatsStore/seg0/c2a1.dat
  33. BIN
      TempStatsStore/seg0/c2b1.dat
  34. BIN
      TempStatsStore/seg0/c2c1.dat
  35. BIN
      TempStatsStore/seg0/c2d0.dat
  36. BIN
      TempStatsStore/seg0/c2e1.dat
  37. BIN
      TempStatsStore/seg0/c2f0.dat
  38. BIN
      TempStatsStore/seg0/c300.dat
  39. BIN
      TempStatsStore/seg0/c31.dat
  40. BIN
      TempStatsStore/seg0/c311.dat
  41. BIN
      TempStatsStore/seg0/c321.dat
  42. BIN
      TempStatsStore/seg0/c331.dat
  43. BIN
      TempStatsStore/seg0/c340.dat
  44. BIN
      TempStatsStore/seg0/c351.dat
  45. BIN
      TempStatsStore/seg0/c361.dat
  46. BIN
      TempStatsStore/seg0/c371.dat
  47. BIN
      TempStatsStore/seg0/c380.dat
  48. BIN
      TempStatsStore/seg0/c391.dat
  49. BIN
      TempStatsStore/seg0/c3a1.dat
  50. BIN
      TempStatsStore/seg0/c3b1.dat
  51. BIN
      TempStatsStore/seg0/c3c0.dat
  52. BIN
      TempStatsStore/seg0/c3d1.dat
  53. BIN
      TempStatsStore/seg0/c3e1.dat
  54. BIN
      TempStatsStore/seg0/c3f1.dat
  55. BIN
      TempStatsStore/seg0/c400.dat
  56. BIN
      TempStatsStore/seg0/c41.dat
  57. BIN
      TempStatsStore/seg0/c411.dat
  58. BIN
      TempStatsStore/seg0/c51.dat
  59. BIN
      TempStatsStore/seg0/c60.dat
  60. BIN
      TempStatsStore/seg0/c71.dat
  61. BIN
      TempStatsStore/seg0/c81.dat
  62. BIN
      TempStatsStore/seg0/c90.dat
  63. BIN
      TempStatsStore/seg0/ca1.dat
  64. BIN
      TempStatsStore/seg0/cb1.dat
  65. BIN
      TempStatsStore/seg0/cc0.dat
  66. BIN
      TempStatsStore/seg0/cd1.dat
  67. BIN
      TempStatsStore/seg0/ce1.dat
  68. BIN
      TempStatsStore/seg0/cf0.dat
  69. 22 0
      TempStatsStore/service.properties
  70. 10 6
      apps/beeswax/src/beeswax/templates/beeswax_components.mako
  71. 58 5
      apps/beeswax/src/beeswax/templates/save_results.mako
  72. 64 29
      apps/beeswax/src/beeswax/templates/watch_results.mako

BIN
TempStatsStore/log/log.ctrl


BIN
TempStatsStore/log/log1.dat


BIN
TempStatsStore/log/logmirror.ctrl


BIN
TempStatsStore/seg0/c10.dat


BIN
TempStatsStore/seg0/c101.dat


BIN
TempStatsStore/seg0/c111.dat


BIN
TempStatsStore/seg0/c121.dat


BIN
TempStatsStore/seg0/c130.dat


BIN
TempStatsStore/seg0/c141.dat


BIN
TempStatsStore/seg0/c150.dat


BIN
TempStatsStore/seg0/c161.dat


BIN
TempStatsStore/seg0/c171.dat


BIN
TempStatsStore/seg0/c180.dat


BIN
TempStatsStore/seg0/c191.dat


BIN
TempStatsStore/seg0/c1a1.dat


BIN
TempStatsStore/seg0/c1b1.dat


BIN
TempStatsStore/seg0/c1c0.dat


BIN
TempStatsStore/seg0/c1d1.dat


BIN
TempStatsStore/seg0/c1e0.dat


BIN
TempStatsStore/seg0/c1f1.dat


BIN
TempStatsStore/seg0/c20.dat


BIN
TempStatsStore/seg0/c200.dat


BIN
TempStatsStore/seg0/c211.dat


BIN
TempStatsStore/seg0/c221.dat


BIN
TempStatsStore/seg0/c230.dat


BIN
TempStatsStore/seg0/c241.dat


BIN
TempStatsStore/seg0/c251.dat


BIN
TempStatsStore/seg0/c260.dat


BIN
TempStatsStore/seg0/c271.dat


BIN
TempStatsStore/seg0/c281.dat


BIN
TempStatsStore/seg0/c290.dat


BIN
TempStatsStore/seg0/c2a1.dat


BIN
TempStatsStore/seg0/c2b1.dat


BIN
TempStatsStore/seg0/c2c1.dat


BIN
TempStatsStore/seg0/c2d0.dat


BIN
TempStatsStore/seg0/c2e1.dat


BIN
TempStatsStore/seg0/c2f0.dat


BIN
TempStatsStore/seg0/c300.dat


BIN
TempStatsStore/seg0/c31.dat


BIN
TempStatsStore/seg0/c311.dat


BIN
TempStatsStore/seg0/c321.dat


BIN
TempStatsStore/seg0/c331.dat


BIN
TempStatsStore/seg0/c340.dat


BIN
TempStatsStore/seg0/c351.dat


BIN
TempStatsStore/seg0/c361.dat


BIN
TempStatsStore/seg0/c371.dat


BIN
TempStatsStore/seg0/c380.dat


BIN
TempStatsStore/seg0/c391.dat


BIN
TempStatsStore/seg0/c3a1.dat


BIN
TempStatsStore/seg0/c3b1.dat


BIN
TempStatsStore/seg0/c3c0.dat


BIN
TempStatsStore/seg0/c3d1.dat


BIN
TempStatsStore/seg0/c3e1.dat


BIN
TempStatsStore/seg0/c3f1.dat


BIN
TempStatsStore/seg0/c400.dat


BIN
TempStatsStore/seg0/c41.dat


BIN
TempStatsStore/seg0/c411.dat


BIN
TempStatsStore/seg0/c51.dat


BIN
TempStatsStore/seg0/c60.dat


BIN
TempStatsStore/seg0/c71.dat


BIN
TempStatsStore/seg0/c81.dat


BIN
TempStatsStore/seg0/c90.dat


BIN
TempStatsStore/seg0/ca1.dat


BIN
TempStatsStore/seg0/cb1.dat


BIN
TempStatsStore/seg0/cc0.dat


BIN
TempStatsStore/seg0/cd1.dat


BIN
TempStatsStore/seg0/ce1.dat


BIN
TempStatsStore/seg0/cf0.dat


+ 22 - 0
TempStatsStore/service.properties

@@ -0,0 +1,22 @@
+#/home/hue/development/hue/TempStatsStore
+# ********************************************************************
+# ***                Please do NOT edit this file.                 ***
+# *** CHANGING THE CONTENT OF THIS FILE MAY CAUSE DATA CORRUPTION. ***
+# ********************************************************************
+#Fri May 04 14:04:31 PDT 2012
+SysschemasIndex2Identifier=225
+SyscolumnsIdentifier=144
+SysconglomeratesIndex1Identifier=49
+SysconglomeratesIdentifier=32
+SyscolumnsIndex2Identifier=177
+SysschemasIndex1Identifier=209
+SysconglomeratesIndex3Identifier=81
+SystablesIndex2Identifier=129
+SyscolumnsIndex1Identifier=161
+derby.serviceProtocol=org.apache.derby.database.Database
+SysschemasIdentifier=192
+derby.storage.propertiesId=16
+SysconglomeratesIndex2Identifier=65
+derby.serviceLocale=en_US
+SystablesIdentifier=96
+SystablesIndex1Identifier=113

+ 10 - 6
apps/beeswax/src/beeswax/templates/beeswax_components.mako

@@ -63,14 +63,14 @@
   if klass:
     classes.append(klass)
   if hidden:
-    classes.append("jframe-hidden")
+    classes.append("hidden")
   cls = ' '.join(classes)
 
   title_classes = []
   if title_klass:
     title_classes.append(title_klass)
   if notitle or hidden:
-    title_classes.append("jframe-hidden")
+    title_classes.append("hidden")
   titlecls = ' '.join(title_classes)
 %>
 	${field.label_tag() | n}
@@ -92,7 +92,8 @@
   dd_attrs=None,
   dt_attrs=None,
   title_klass=None,
-  button_text=False
+  button_text=False,
+  placeholder=None
   )">
 <%
   if value is None:
@@ -120,15 +121,18 @@
   if klass:
     classes.append(klass)
   if hidden:
-    classes.append("jframe-hidden")
+    classes.append("hidden")
   cls = ' '.join(classes)
 
   title_classes = []
   if title_klass:
     title_classes.append(title_klass)
   if notitle or hidden:
-    title_classes.append("jframe-hidden")
+    title_classes.append("hidden")
   titlecls = ' '.join(title_classes)
+
+  if placeholder:
+	plc = "placeholder=\"%s\"" % placeholder
 %>
   % if field.is_hidden:
     ${unicode(field) | n}
@@ -147,7 +151,7 @@
 				<input type="checkbox" name="${field.html_name | n}" ${make_attr_str(attrs) | n} ${value and "CHECKED" or ""}/> <span>${button_text or field.name or ''}</span>
 			% endif
         % else:
-          <${tag} name="${field.html_name | n}" value="${extract_field_data(field) or ''}" ${make_attr_str(attrs) | n} />
+          <${tag} name="${field.html_name | n}" value="${extract_field_data(field) or ''}" ${make_attr_str(attrs) | n} class="${cls}" ${plc} />
         % endif
 
       % endif

+ 58 - 5
apps/beeswax/src/beeswax/templates/save_results.mako

@@ -25,11 +25,64 @@ ${layout.menubar(section='history')}
 % if error_msg:
 <h4>${error_msg}</h4>
 % endif
-
-<form action="${action}" method="POST" data-filters="FormValidator">
-  ${util.render_form(form)}
-  <input type="submit" name="save" value="Save"/>
-  <input type="submit" name="cancel" value="Cancel"/>
+<h1>Save Query Results</h1>
+<form id="saveForm" action="${action}" method="POST" class="form form-inline">
+	<label class="radio">
+		<input id="id_save_target_0" type="radio" name="save_target" value="to a new table" checked="checked"/>
+		&nbsp;In a new table
+	</label>
+	${comps.field(form['target_table'], notitle=True, placeholder="Table Name")}
+	<br/>
+	<label class="radio">
+		<input id="id_save_target_1" type="radio" name="save_target" value="to HDFS directory">
+		&nbsp;In an HDFS directory
+	</label>
+	${comps.field(form['target_dir'], notitle=True, hidden=True, placeholder="Results location")}
+  <br/><br/>
+  <input type="submit" name="save" value="Save" class="btn primary"/>
+  <input type="submit" name="cancel" value="Cancel" class="btn"/>
 </form>
 </div>
+
+
+<script type="text/javascript" charset="utf-8">
+	$(document).ready(function(){
+
+		$("input[name='save_target']").change(function(){
+			$("#fieldRequired").addClass("hidden");
+			$("input[name='target_dir']").removeClass("fieldError");
+			$("input[name='target_table']").removeClass("fieldError");
+			if ($(this).val().indexOf("HDFS")>-1){
+				$("input[name='target_table']").addClass("hidden");
+				$("input[name='target_dir']").removeClass("hidden");
+			}
+			else {
+				$("input[name='target_table']").removeClass("hidden");
+				$("input[name='target_dir']").addClass("hidden");
+			}
+		});
+
+		$("#saveForm").submit(function(e){
+			if ($(e.originalEvent.explicitOriginalTarget).attr("name") == "cancel"){
+				return true;
+			}
+			if ($("input[name='save_target']:checked").val().indexOf("HDFS")>-1){
+				if ($.trim($("input[name='target_dir']").val()) == ""){
+					$("#fieldRequired").removeClass("hidden");
+					$("input[name='target_dir']").addClass("fieldError");
+					return false;
+				}
+			}
+			else {
+				if ($.trim($("input[name='target_table']").val()) == ""){
+					$("#fieldRequired").removeClass("hidden");
+					$("input[name='target_table']").addClass("fieldError");
+					return false;
+				}
+			}
+			return true;
+		});
+
+	});
+</script>
 ${commonfooter()}

+ 64 - 29
apps/beeswax/src/beeswax/templates/watch_results.mako

@@ -32,7 +32,9 @@ ${layout.menubar(section='query')}
 					<li class="nav-header">Downloads</li>
 					<li><a target="_blank" href="${download_urls["csv"]}">Download as CSV</a></li>
 					<li><a target="_blank" href="${download_urls["xls"]}">Download as XLS</a></li>
-					<li><a href="${url('beeswax.views.save_results', query.id)}">Save</a></li>
+					% endif
+					%if can_save:
+					<li><a data-toggle="modal" href="#saveAs">Save</a></li>
 					% endif
 					<%
 			          n_jobs = hadoop_jobs and len(hadoop_jobs) or 0
@@ -52,34 +54,6 @@ ${layout.menubar(section='query')}
 			</div>
 		</div>
 		<div class="span9">
-			%if can_save:
-                <div class="collapsible jframe-hidden bw-save_query_results" style="display:none" data-filters="Accordion">
-                  <form action="${url('beeswax.views.save_results', query.id) }" method="POST">
-                    ## Writing the save_target fields myself so I can match them to their respective text input fields.
-                    <div>
-                      <input id="id_save_target_0" type="radio" name="save_target" value="to a new table" class="toggle" checked="checked"/>
-                      <label for="id_save_target_0">In a new table</label>
-                    </div>
-                    ${comps.field(save_form['target_table'], notitle=True, klass="target", attrs=dict(
-                      data_filters="OverText",
-                      alt="table_name"
-                    ))}
-                    <div>
-                      <input id="id_save_target_1" type="radio" name="save_target" value="to HDFS directory" class="toggle">
-                      <label for="id_save_target_1">In an HDFS directory</label>
-                    </div>
-                    <div class="target">
-                      ${comps.field(save_form['target_dir'], notitle=True, attrs=dict(
-                      data_filters="OverText",
-                      alt="/user/dir"
-                      ))}
-                      <a data-filters="ArtButton" class="hue-choose_file" data-icon-styles="{'width': 16, 'height': 16, 'top': 1, 'left': 4 }" data-chooseFor="target_dir">Choose File</a>
-                    </div>
-                    <input type="submit" value="Save" name="save" data-filters="ArtButton">
-                  </form>
-                </div>
-              %endif
-
 				<ul class="nav nav-tabs">
 					<li class="active"><a href="#results" data-toggle="tab">
 		  			%if error:
@@ -151,6 +125,36 @@ ${layout.menubar(section='query')}
 	</div>
 </div>
 
+%if can_save:
+<div id="saveAs" class="modal hide fade">
+	<form id="saveForm" action="${url('beeswax.views.save_results', query.id) }" method="POST" class="form form-inline">
+    <div class="modal-header">
+        <a href="#" class="close" data-dismiss="modal">&times;</a>
+        <h3>Save Query Results</h3>
+    </div>
+    <div class="modal-body">
+		<label class="radio">
+			<input id="id_save_target_0" type="radio" name="save_target" value="to a new table" checked="checked"/>
+			&nbsp;In a new table
+		</label>
+		${comps.field(save_form['target_table'], notitle=True, placeholder="Table Name")}
+		<br/>
+		<label class="radio">
+			<input id="id_save_target_1" type="radio" name="save_target" value="to HDFS directory">
+			&nbsp;In an HDFS directory
+		</label>
+		${comps.field(save_form['target_dir'], notitle=True, hidden=True, placeholder="Results location")}
+
+    </div>
+    <div class="modal-footer">
+		<div id="fieldRequired" class="hidden" style="position: absolute; left: 10;">
+			<span class="label label-important">Sorry, name is required.</span>
+        </div>
+        <input type="submit" class="btn primary" value="Save" name="save" />
+    </div>
+</div>
+%endif
+
 
 <script type="text/javascript" charset="utf-8">
 	$(document).ready(function(){
@@ -162,6 +166,37 @@ ${layout.menubar(section='query')}
 		});
 		$(".dataTables_wrapper").css("min-height","0");
 		$(".dataTables_filter").hide();
+		$("input[name='save_target']").change(function(){
+			$("#fieldRequired").addClass("hidden");
+			$("input[name='target_dir']").removeClass("fieldError");
+			$("input[name='target_table']").removeClass("fieldError");
+			if ($(this).val().indexOf("HDFS")>-1){
+				$("input[name='target_table']").addClass("hidden");
+				$("input[name='target_dir']").removeClass("hidden");
+			}
+			else {
+				$("input[name='target_table']").removeClass("hidden");
+				$("input[name='target_dir']").addClass("hidden");
+			}
+		});
+
+		$("#saveForm").submit(function(){
+			if ($("input[name='save_target']:checked").val().indexOf("HDFS")>-1){
+				if ($.trim($("input[name='target_dir']").val()) == ""){
+					$("#fieldRequired").removeClass("hidden");
+					$("input[name='target_dir']").addClass("fieldError");
+					return false;
+				}
+			}
+			else {
+				if ($.trim($("input[name='target_table']").val()) == ""){
+					$("#fieldRequired").removeClass("hidden");
+					$("input[name='target_table']").addClass("fieldError");
+					return false;
+				}
+			}
+			return true;
+		});
 
 	});
 </script>