Repository: asterixdb
Updated Branches:
  refs/heads/master 80d20195f -> 080993c3d


[ASTERIXDB-1977][UI] Disable wrap into array option for certain cases

1. When formatted JSON is checked, we disable the wrap in array option for
better display. Also, this option is not applicable when output format
is CSV.
2. Fixed the CSV with header format.

Change-Id: I8168e021c1f97e7e3c94fc073447656b481a4380
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1950
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamou...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/080993c3
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/080993c3
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/080993c3

Branch: refs/heads/master
Commit: 080993c3d4118274cb2549b18db91b34e418c21f
Parents: 80d2019
Author: Xikui Wang <xkk...@gmail.com>
Authored: Fri Aug 25 09:59:59 2017 -0700
Committer: Xikui Wang <xkk...@gmail.com>
Committed: Tue Aug 29 09:42:35 2017 -0700

----------------------------------------------------------------------
 .../org/apache/asterix/api/http/server/ApiServlet.java  |  4 ++++
 .../src/main/resources/webui/querytemplate.html         | 12 ++++++++++++
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/080993c3/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ApiServlet.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ApiServlet.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ApiServlet.java
index 58c282f..ba09d6c 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ApiServlet.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ApiServlet.java
@@ -98,6 +98,10 @@ public class ApiServlet extends AbstractServlet {
         OutputFormat format;
         boolean csvAndHeader = false;
         String output = request.getParameter("output-format");
+        if ("CSV-Header".equals(output)) {
+            output = "CSV";
+            csvAndHeader = true;
+        }
         try {
             format = OutputFormat.valueOf(output);
         } catch (IllegalArgumentException e) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/080993c3/asterixdb/asterix-app/src/main/resources/webui/querytemplate.html
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/resources/webui/querytemplate.html 
b/asterixdb/asterix-app/src/main/resources/webui/querytemplate.html
index cffec6f..383754e 100644
--- a/asterixdb/asterix-app/src/main/resources/webui/querytemplate.html
+++ b/asterixdb/asterix-app/src/main/resources/webui/querytemplate.html
@@ -72,6 +72,18 @@ $(document).ready(function() {
         }
     });
 
+    $('#output-format').on('change', function() {
+      var resultFormat = $('#output-format option:checked').text();
+      if (resultFormat == 'JSON (formatted)' || resultFormat == 'CSV (no 
header)' || resultFormat == 'CSV (with header)') {
+        $('input[name=wrapper-array]').attr('disabled', true);
+        $('input[name=wrapper-array]').prop('checked', false);
+        $('input[name=wrapper-array]').parent().css('color', 'grey');
+      } else {
+        $('input[name=wrapper-array]').attr("disabled", false);
+        $('input[name=wrapper-array]').parent().css('color', '');
+      }
+    });
+
     $("form#queryform").submit(function() {
         $('#output-message').html("");
         $.post("/", $("form#queryform").serialize(), function(data) {

Reply via email to