blob: ee491228a21e1e9681e638b7a79b5b9798350ea5 [file] [log] [blame]
<!--
! Licensed to the Apache Software Foundation (ASF) under one
! or more contributor license agreements. See the NOTICE file
! distributed with this work for additional information
! regarding copyright ownership. The ASF licenses this file
! to you under the Apache License, Version 2.0 (the
! "License"); you may not use this file except in compliance
! with the License. You may obtain a copy of the License at
!
! http://www.apache.org/licenses/LICENSE-2.0
!
! Unless required by applicable law or agreed to in writing,
! software distributed under the License is distributed on an
! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
! KIND, either express or implied. See the License for the
! specific language governing permissions and limitations
! under the License.
!-->
if ($('#opts').is(":visible")) {
$('#opts').hide();
$('#queryform :input').prop('checked', false);
} else {
$('#opts').show();
$('#queryform :input').prop('checked', true);
}
return false;
});
$('#clear-query-button').click(function() {
$("#qry").val('');
return false;
});
$('form#queryform :input').click( function () {
/* Hides selection check on uncheck, shows when all 5 selected */
if ($(this).val()) {
if ($(this).is(':checked') && $('input[type=checkbox]').filter(':checked').length == 5) {
$('#opts').show();
} else {
$('#opts').hide();
}
}
});
$("form#queryform").submit(function() {
$('#output-message').html("");
$.post("/", $("form#queryform").serialize(), function(data) {
var resSet = 0;
var resPattern = /<h4>Results:<\/h4>/g;
var durPattern = /<PRE>Duration/g;
var errorPattern = /<div class="accordion" id="errorblock">/g;
var resultCount = data.match(resPattern);
if (!resPattern.test(data)) {
if(errorPattern.test(data)) {
$('#output-heading').html('Error');
$('#output-heading').addClass('error');
} else {
$('#output-heading').html('Output');
$('#output-heading').removeClass('error');
}
$('#output-message').html(data);
} else {
$('#output-heading').html('Output');
$('#output-heading').removeClass('error');
if (resultCount.length <= 1) {
$('#output-message').html(data);
} else {
var splitData = data.split('<PRE>Duration');
var results = splitData[0].split('<h4>');
var components = results.slice(1, results.length);
var sections = components.length / resultCount.length;
for (resSet = 0; resSet < resultCount.length; resSet++) {
$('#output-message').append('<h4>' + components[(resSet+1)*sections - 1]);
if (sections > 1) {
var resNum = resSet + 1;
$('<button/>')
.attr("class", "btn")
.attr("data-toggle", "collapse")
.attr("data-target", "#collapse" + resSet)
.css("margin-bottom", "1em")
.html('Result Plan #' + resNum + '<i id="ibtn' + resSet + '" class="icon-plus extarget"></i>')
.appendTo('#output-message');
$('<div/>')
.attr("id", "collapse" + resSet)
.attr("class", "collapse in")
.appendTo('#output-message');
for (var c = 0; c < sections - 1; c++) {
var pos = resSet*sections + c;
$('#collapse' + resSet).append('<h4>' + components[pos]);
}
/* Placeholder for future on show/hide result plan behavior
$('#collapse' + resSet).on('show', function() {
}).on('hide', function() {
});
*/
$('#output-message').append("<hr/>");
}
}
$('#output-message').append('<PRE>Duration' + splitData[1]);
}
}
var contentString = data.toString();
if (contentString.indexOf("<PRE>Duration") !== -1) {
$('<div/>')
.addClass("alert alert-success")
.html("Success: Query Complete")
.appendTo('#output-message');
}
});
return false;
});
});
</script>
<meta charset=utf-8 />
<title>AsterixDB Web Interface</title>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<!-- Temporary logo placeholder -->
<a class="brand" href="#"><img src="/webui/static/img/finalasterixlogo.png"></a>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a href="http://code.google.com/p/asterixdb/" target="_blank">
Open source<img class="extarget" src="/webui/static/img/targetlink.png"/></a></li>
<li><a href="http://code.google.com/p/asterixdb/issues/list" target="_blank">
File issues<img class="extarget" src="/webui/static/img/targetlink.png"/></a></li>
<li><a href="https://groups.google.com/forum/?fromgroups#!forum/asterixdb-users" target="_blank">
Contact<img class="extarget" src="/webui/static/img/targetlink.png"/></a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="content">
<div class="container">
<div class="row-fluid">
<div class="span6">
<form id="queryform" class="form-horizontal" method="post">
<div style="margin-bottom: 1em;">
<label class="query">Query</label>
<textarea rows="10" id="qry" name="query" class="query" value="%s" placeholder="Type your AQL query ..."></textarea>
</div>
<div class="btn-group">
<button id="checkboxes-on" class="btn">
<i id="opts" class="icon-ok" style="display:none;"></i>Select Options</button>
<button id="clear-query-button" class="btn">Clear Query</button>
<!-- <button id="checkboxes-off" class="btn">Clear All Options</button> -->
<button type="submit" id="run-btn" class="btn btn-custom-darken">Run</button>
</div>
<div>
<label class="checkbox optlabel"> Output Format:<br/>
<select name="output-format" class="btn">
<option selected value="ADM">ADM</option>
<option value="CSV">CSV (no header)</option>
<option value="CSV-Header">CSV (with header)</option>
<option value="JSON">JSON</option>
</select>
</label>
<label class="checkbox optlabel"><input type="checkbox" name="print-expr-tree" value="true" /> Print parsed expressions</label>
<label class="checkbox optlabel"><input type="checkbox" name="print-rewritten-expr-tree" value="true" /> Print rewritten expressions</label>
<label class="checkbox optlabel"><input type="checkbox" name="print-logical-plan" value="true" /> Print logical plan</label>
<label class="checkbox optlabel"><input type="checkbox" name="print-optimized-logical-plan" value="true" /> Print optimized logical plan</label>
<label class="checkbox optlabel"><input type="checkbox" name="print-job" value="true" /> Print Hyracks job</label>
<label class="checkbox optlabel"><input type="checkbox" name="execute-query" value="true" checked/> Execute query</label>
</div>
</form>
</div>
<div class="span6">
<div class="output">
<label id="output-heading" class="heading">Output</label>
<div id="output-message" class="message">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<section class="line"><hr></section>
<section class="content">
<section class="left">
</section>
<section class="right">
</section>
</section>
</div>
</body>
</html>