Xikui Wang has submitted this change and it was merged. Change subject: [ASTERIXDB-1977][UI] Disable wrap into array option for certain cases ......................................................................
[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 <[email protected]> Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Reviewed-by: abdullah alamoudi <[email protected]> --- M asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ApiServlet.java M asterixdb/asterix-app/src/main/resources/webui/querytemplate.html 2 files changed, 16 insertions(+), 0 deletions(-) Approvals: Anon. E. Moose #1000171: abdullah alamoudi: Looks good to me, approved Jenkins: Verified; No violations found; ; Verified 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 @@ 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) { 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 @@ } }); + $('#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) { -- To view, visit https://asterix-gerrit.ics.uci.edu/1950 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8168e021c1f97e7e3c94fc073447656b481a4380 Gerrit-PatchSet: 7 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Xikui Wang <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Ian Maxon <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Xikui Wang <[email protected]> Gerrit-Reviewer: abdullah alamoudi <[email protected]>
