http://git-wip-us.apache.org/repos/asf/asterixdb/blob/82464fb4/asterixdb/asterix-app/src/main/resources/queryui/js/json-formatter.min.js ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/resources/queryui/js/json-formatter.min.js b/asterixdb/asterix-app/src/main/resources/queryui/js/json-formatter.min.js index f499716..77882c0 100644 --- a/asterixdb/asterix-app/src/main/resources/queryui/js/json-formatter.min.js +++ b/asterixdb/asterix-app/src/main/resources/queryui/js/json-formatter.min.js @@ -1,7 +1 @@ -/*! - * jsonformatter - * - * Version: 0.6.0 - 2016-04-29T03:24:40.672Z - * License: Apache-2.0 - */ -"use strict";angular.module("jsonFormatter",["RecursionHelper"]).provider("JSONFormatterConfig",function(){var n=!1,e=100,t=5;return{get hoverPreviewEnabled(){return n},set hoverPreviewEnabled(e){n=!!e},get hoverPreviewArrayCount(){return e},set hoverPreviewArrayCount(n){e=parseInt(n,10)},get hoverPreviewFieldCount(){return t},set hoverPreviewFieldCount(n){t=parseInt(n,10)},$get:function(){return{hoverPreviewEnabled:n,hoverPreviewArrayCount:e,hoverPreviewFieldCount:t}}}}).directive("jsonFormatter",["RecursionHelper","JSONFormatterConfig",function(n,e){function t(n){return n.replace('"','"')}function r(n){if(void 0===n)return"";if(null===n)return"Object";if("object"==typeof n&&!n.constructor)return"Object";var e=/function (.{1,})\(/,t=e.exec(n.constructor.toString());return t&&t.length>1?t[1]:""}function o(n){return null===n?"null":typeof n}function s(n,e){var r=o(n);return"null"===r||"undefined"===r?r:("string"===r&&(e='"'+t(e)+'"'),"function"===r?n.toString().replace(/[\r\n]/g,""). replace(/\{.*\}/,"")+"{â¦}":e)}function i(n){var e="";return angular.isObject(n)?(e=r(n),angular.isArray(n)&&(e+="["+n.length+"]")):e=s(n,n),e}function a(n){n.isArray=function(){return angular.isArray(n.json)},n.isObject=function(){return angular.isObject(n.json)},n.getKeys=function(){return n.isObject()?Object.keys(n.json).map(function(n){return""===n?'""':n}):void 0},n.type=o(n.json),n.hasKey="undefined"!=typeof n.key,n.getConstructorName=function(){return r(n.json)},"string"===n.type&&("Invalid Date"!==new Date(n.json).toString()&&(n.isDate=!0),0===n.json.indexOf("http")&&(n.isUrl=!0)),n.isEmptyObject=function(){return n.getKeys()&&!n.getKeys().length&&n.isOpen&&!n.isArray()},n.isOpen=!!n.open,n.toggleOpen=function(){n.isOpen=!n.isOpen},n.childrenOpen=function(){return n.open>1?n.open-1:0},n.openLink=function(e){e&&(window.location.href=n.json)},n.parseValue=function(e){return s(n.json,e)},n.showThumbnail=function(){return!!e.hoverPreviewEnabled&&n.isObject()&&!n.isOpen},n.getTh umbnail=function(){if(n.isArray())return n.json.length>e.hoverPreviewArrayCount?"Array["+n.json.length+"]":"["+n.json.map(i).join(", ")+"]";var t=n.getKeys(),r=t.slice(0,e.hoverPreviewFieldCount),o=r.map(function(e){return e+":"+i(n.json[e])}),s=t.length>=5?"â¦":"";return"{"+o.join(", ")+s+"}"}}return{templateUrl:"json-formatter.html",restrict:"E",replace:!0,scope:{json:"=",key:"=",open:"="},compile:function(e){return n.compile(e,a)}}}]),"object"==typeof module&&(module.exports="jsonFormatter"),angular.module("RecursionHelper",[]).factory("RecursionHelper",["$compile",function(n){return{compile:function(e,t){angular.isFunction(t)&&(t={post:t});var r,o=e.contents().remove();return{pre:t&&t.pre?t.pre:null,post:function(e,s){r||(r=n(o)),r(e,function(n){s.append(n)}),t&&t.post&&t.post.apply(null,arguments)}}}}}]),angular.module("jsonFormatter").run(["$templateCache",function(n){n.put("json-formatter.html",'<div ng-init="isOpen = open && open > 0" class="json-formatter-row"><a ng-click= "toggleOpen()"><span class="toggler {{isOpen ? \'open\' : \'\'}}" ng-if="isObject()"></span> <span class="key" ng-if="hasKey"><span class="key-text">{{key}}</span><span class="colon">:</span></span> <span class="value"><span ng-if="isObject()"><span class="constructor-name">{{getConstructorName(json)}}</span> <span ng-if="isArray()"><span class="bracket">[</span><span class="number">{{json.length}}</span><span class="bracket">]</span></span></span> <span ng-if="!isObject()" ng-click="openLink(isUrl)" class="{{type}}" ng-class="{date: isDate, url: isUrl}">{{parseValue(json)}}</span></span> <span ng-if="showThumbnail()" class="thumbnail-text">{{getThumbnail()}}</span></a><div class="children" ng-if="getKeys().length && isOpen"><json-formatter ng-repeat="key in getKeys() track by $index" json="json[key]" key="key" open="childrenOpen()"></json-formatter></div><div class="children empty object" ng-if="isEmptyObject()"></div><div class="children empty array" ng-if="getKeys() && !getKeys() .length && isOpen && isArray()"></div></div>')}]); \ No newline at end of file +/*! jsonformatter 0.6.0 - 2016-04-29T03:24:40.680Z | (c) 2014 Mohsen Azimi | http://www.apache.org/licenses/LICENSE-2.0 */"use strict";angular.module("jsonFormatter",["RecursionHelper"]).provider("JSONFormatterConfig",function(){var n=!1,e=100,t=5;return{get hoverPreviewEnabled(){return n},set hoverPreviewEnabled(e){n=!!e},get hoverPreviewArrayCount(){return e},set hoverPreviewArrayCount(n){e=parseInt(n,10)},get hoverPreviewFieldCount(){return t},set hoverPreviewFieldCount(n){t=parseInt(n,10)},$get:function(){return{hoverPreviewEnabled:n,hoverPreviewArrayCount:e,hoverPreviewFieldCount:t}}}}).directive("jsonFormatter",["RecursionHelper","JSONFormatterConfig",function(n,e){function t(n){return n.replace('"','"')}function r(n){if(void 0===n)return"";if(null===n)return"Object";if("object"==typeof n&&!n.constructor)return"Object";var e=/function (.{1,})\(/,t=e.exec(n.constructor.toString());return t&&t.length>1?t[1]:""}function o(n){return null===n?"null":typeof n}function s(n,e){var r=o (n);return"null"===r||"undefined"===r?r:("string"===r&&(e='"'+t(e)+'"'),"function"===r?n.toString().replace(/[\r\n]/g,"").replace(/\{.*\}/,"")+"{â¦}":e)}function i(n){var e="";return angular.isObject(n)?(e=r(n),angular.isArray(n)&&(e+="["+n.length+"]")):e=s(n,n),e}function a(n){n.isArray=function(){return angular.isArray(n.json)},n.isObject=function(){return angular.isObject(n.json)},n.getKeys=function(){return n.isObject()?Object.keys(n.json).map(function(n){return""===n?'""':n}):void 0},n.type=o(n.json),n.hasKey="undefined"!=typeof n.key,n.getConstructorName=function(){return r(n.json)},"string"===n.type&&("Invalid Date"!==new Date(n.json).toString()&&(n.isDate=!0),0===n.json.indexOf("http")&&(n.isUrl=!0)),n.isEmptyObject=function(){return n.getKeys()&&!n.getKeys().length&&n.isOpen&&!n.isArray()},n.isOpen=!!n.open,n.toggleOpen=function(){n.isOpen=!n.isOpen},n.childrenOpen=function(){return n.open>1?n.open-1:0},n.openLink=function(e){e&&(window.location.href=n.json)},n.parseValue= function(e){return s(n.json,e)},n.showThumbnail=function(){return!!e.hoverPreviewEnabled&&n.isObject()&&!n.isOpen},n.getThumbnail=function(){if(n.isArray())return n.json.length>e.hoverPreviewArrayCount?"Array["+n.json.length+"]":"["+n.json.map(i).join(", ")+"]";var t=n.getKeys(),r=t.slice(0,e.hoverPreviewFieldCount),o=r.map(function(e){return e+":"+i(n.json[e])}),s=t.length>=5?"â¦":"";return"{"+o.join(", ")+s+"}"}}return{templateUrl:"json-formatter.html",restrict:"E",replace:!0,scope:{json:"=",key:"=",open:"="},compile:function(e){return n.compile(e,a)}}}]),"object"==typeof module&&(module.exports="jsonFormatter"),angular.module("RecursionHelper",[]).factory("RecursionHelper",["$compile",function(n){return{compile:function(e,t){angular.isFunction(t)&&(t={post:t});var r,o=e.contents().remove();return{pre:t&&t.pre?t.pre:null,post:function(e,s){r||(r=n(o)),r(e,function(n){s.append(n)}),t&&t.post&&t.post.apply(null,arguments)}}}}}]),angular.module("jsonFormatter").run(["$templateCache" ,function(n){n.put("json-formatter.html",'<div ng-init="isOpen = open && open > 0" class="json-formatter-row"><a ng-click="toggleOpen()"><span class="toggler {{isOpen ? \'open\' : \'\'}}" ng-if="isObject()"></span> <span class="key" ng-if="hasKey"><span class="key-text">{{key}}</span><span class="colon">:</span></span> <span class="value"><span ng-if="isObject()"><span class="constructor-name">{{getConstructorName(json)}}</span> <span ng-if="isArray()"><span class="bracket">[</span><span class="number">{{json.length}}</span><span class="bracket">]</span></span></span> <span ng-if="!isObject()" ng-click="openLink(isUrl)" class="{{type}}" ng-class="{date: isDate, url: isUrl}">{{parseValue(json)}}</span></span> <span ng-if="showThumbnail()" class="thumbnail-text">{{getThumbnail()}}</span></a><div class="children" ng-if="getKeys().length && isOpen"><json-formatter ng-repeat="key in getKeys() track by $index" json="json[key]" key="key" open="childrenOpen()"></json-formatter></div><div cl ass="children empty object" ng-if="isEmptyObject()"></div><div class="children empty array" ng-if="getKeys() && !getKeys().length && isOpen && isArray()"></div></div>')}]); \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/82464fb4/asterixdb/asterix-app/src/main/resources/queryui/js/ui-codemirror.js ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/resources/queryui/js/ui-codemirror.js b/asterixdb/asterix-app/src/main/resources/queryui/js/ui-codemirror.js index 480f4f2..6eb35df 100644 --- a/asterixdb/asterix-app/src/main/resources/queryui/js/ui-codemirror.js +++ b/asterixdb/asterix-app/src/main/resources/queryui/js/ui-codemirror.js @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2012 the AngularUI Team, http://angular-ui.github.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ 'use strict'; /** http://git-wip-us.apache.org/repos/asf/asterixdb/blob/82464fb4/asterixdb/asterix-app/src/main/resources/queryui/queryui.html ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/resources/queryui/queryui.html b/asterixdb/asterix-app/src/main/resources/queryui/queryui.html index 3c640fb..c2fe702 100644 --- a/asterixdb/asterix-app/src/main/resources/queryui/queryui.html +++ b/asterixdb/asterix-app/src/main/resources/queryui/queryui.html @@ -1,4 +1,22 @@ <!DOCTYPE html> +<!-- + ! 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. + !--> <html lang="en"> <head> <meta charset="UTF-8"> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/82464fb4/asterixdb/asterix-app/src/main/resources/sdk/static/AdmAql101/js/demo.js ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/resources/sdk/static/AdmAql101/js/demo.js b/asterixdb/asterix-app/src/main/resources/sdk/static/AdmAql101/js/demo.js index e5eb73b..63d88ed 100644 --- a/asterixdb/asterix-app/src/main/resources/sdk/static/AdmAql101/js/demo.js +++ b/asterixdb/asterix-app/src/main/resources/sdk/static/AdmAql101/js/demo.js @@ -17,9 +17,9 @@ * under the License. */ $(document).ready(function() { - + var A = new AsterixDBConnection().dataverse("TinySocial"); - + function addResult(dom, res) { for (i in res) { $(dom).append(res[i] + "<br/>"); @@ -29,16 +29,16 @@ $(document).ready(function() { // 0A - Exact-Match Lookup $('#run0a').click(function () { $('#result0a').html(''); - + var expression0a = new FLWOGRExpression() .ForClause("$user", new AExpression("dataset FacebookUsers")) .WhereClause(new AExpression("$user.id = 8")) .ReturnClause("$user"); - + var success0a = function(res) { addResult('#result0a', res["results"]); }; - + A.query(expression0a.val(), success0a); }); @@ -50,11 +50,11 @@ $(document).ready(function() { .ForClause("$user", new AExpression("dataset FacebookUsers")) .WhereClause().and(new AExpression("$user.id >= 2"), new AExpression("$user.id <= 4")) .ReturnClause("$user"); - + var success0b = function(res) { addResult('#result0b', res["results"]); }; - + A.query(expression0b.val(), success0b); }); @@ -65,17 +65,17 @@ $(document).ready(function() { var expression1 = new FLWOGRExpression() .ForClause("$user", new AExpression("dataset FacebookUsers")) .WhereClause().and( - new AExpression("$user.user-since >= datetime('2010-07-22T00:00:00')"), + new AExpression("$user.user-since >= datetime('2010-07-22T00:00:00')"), new AExpression("$user.user-since <= datetime('2012-07-29T23:59:59')") ) .ReturnClause("$user"); - + var success1 = function(res) { addResult('#result1', res["results"]); }; A.query(expression1.val(), success1); }); - + // 2A - Equijoin $("#run2a").click(function() { $('#result2a').html(''); @@ -88,7 +88,7 @@ $(document).ready(function() { "uname" : "$user.name", "message" : "$message.message" }); - + var success2a = function(res) { addResult('#result2a', res["results"]); }; @@ -107,7 +107,7 @@ $(document).ready(function() { "uname" : "$user.name", "message" : "$message.message" }); - + var success2b = function(res) { addResult('#result2b', res["results"]); }; @@ -129,13 +129,13 @@ $(document).ready(function() { "uname": "$user.name", "messages" : expression3messages }); - + var success3 = function(res) { addResult('#result3', res["results"]); }; A.query(expression3.val(), success3); }); - + // 4 - Theta Join $("#run4").click(function() { $('#result4').html(''); @@ -144,14 +144,14 @@ $(document).ready(function() { .ForClause( "$t2", new AExpression("dataset TweetMessages")) .WhereClause( new AExpression("spatial-distance($t.sender-location, $t2.sender-location) <= 1")) .ReturnClause({ "msgtxt" : "$t2.message-text" }); - + var expression4 = new FLWOGRExpression() .ForClause( "$t", new AExpression("dataset TweetMessages")) .ReturnClause({ "message" : "$t.message-text", "nearby-messages" : expression4messages }); - + var success4 = function(res) { addResult('#result4', res["results"]); }; @@ -170,7 +170,7 @@ $(document).ready(function() { "twitter-screenname": "$tu.screen-name", "twitter-name": "$tu.name" }); - + var expression5 = new FLWOGRExpression() .ForClause ("$fbu", new AExpression("dataset FacebookUsers")) .ReturnClause( @@ -180,16 +180,16 @@ $(document).ready(function() { "similar-users" : similarUsersExpression } ); - + var success5 = function (res) { addResult('#result5', res["results"]); }; - + var simfunction = new SetStatement( "simfunction", "edit-distance" ); var simthreshold = new SetStatement( "simthreshold", "3"); A.query( - [ simfunction.val() , simthreshold.val() , expression5.val() ], + [ simfunction.val() , simthreshold.val() , expression5.val() ], success5 ); }); @@ -200,19 +200,19 @@ $(document).ready(function() { var expression6 = new FLWOGRExpression() .ForClause ("$fbu", new AQLClause().set("dataset FacebookUsers")) - .WhereClause( + .WhereClause( new QuantifiedExpression ( - "some" , + "some" , {"$e" : new AExpression("$fbu.employment") }, new FunctionExpression("is-null", new AExpression("$e.end-date")) ) ) .ReturnClause("$fbu"); - + var success6 = function(res) { addResult('#result6',res["results"]); }; - + A.query(expression6.val(), success6); }); @@ -222,15 +222,15 @@ $(document).ready(function() { var expression7 = new FLWOGRExpression() .ForClause("$fbu", new AExpression("dataset FacebookUsers")) - .WhereClause( + .WhereClause( new QuantifiedExpression ( - "every" , + "every" , {"$e" : new AExpression("$fbu.employment") }, new FunctionExpression("not", new FunctionExpression("is-null", new AExpression("$e.end-date"))) ) ) .ReturnClause("$fbu"); - + var success7 = function(res) { addResult('#result7', res["results"]); }; @@ -239,8 +239,8 @@ $(document).ready(function() { // 8 - Simple Aggregation $('#run8').click(function () { - - $('#result8').html(''); + + $('#result8').html(''); var expression8 = new FunctionExpression( "count", @@ -248,7 +248,7 @@ $(document).ready(function() { .ForClause("$fbu", new AExpression("dataset FacebookUsers")) .ReturnClause("$fbu") ); - + var success8 = function(res) { addResult('#result8', res["results"]); }; @@ -289,13 +289,13 @@ $(document).ready(function() { "count" : new FunctionExpression("count", new AExpression("$t")) } ); - + var success9b = function(res) { addResult('#result9b', res["results"]); }; A.query(expression9b.val(), success9b); }); - + // 10 - Grouping and Limits $("#run10").click(function() { $('#result10').html(''); @@ -310,7 +310,7 @@ $(document).ready(function() { { "user" : "$uid", "count" : "$c" - } + } ); var success10 = function(res) { @@ -326,27 +326,27 @@ $(document).ready(function() { var expression11 = new FLWOGRExpression() .ForClause( "$t", new AExpression("dataset TweetMessages")) .ReturnClause({ - "tweet" : new AExpression("$t"), + "tweet" : new AExpression("$t"), "similar-tweets": new FLWOGRExpression() .ForClause( "$t2", new AExpression("dataset TweetMessages")) .WhereClause().and( - new AExpression("$t2.referred-topics ~= $t.referred-topics"), + new AExpression("$t2.referred-topics ~= $t.referred-topics"), new AExpression("$t2.tweetid != $t.tweetid") ) .ReturnClause("$t2.referred-topics") - }); - + }); + var success11 = function(res) { addResult('#result11', res["results"]); }; - + var simfunction = new SetStatement( "simfunction", "jaccard" ); var simthreshold = new SetStatement( "simthreshold", "0.3"); A.query( - [ simfunction.val(), simthreshold.val(), expression11.val()], + [ simfunction.val(), simthreshold.val(), expression11.val()], success11 ); - + }); $('#run0a').trigger('click'); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/82464fb4/asterixdb/asterix-app/src/main/resources/sdk/static/AdmAql101/query.txt ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/resources/sdk/static/AdmAql101/query.txt b/asterixdb/asterix-app/src/main/resources/sdk/static/AdmAql101/query.txt index e90a029..b2cafce 100644 --- a/asterixdb/asterix-app/src/main/resources/sdk/static/AdmAql101/query.txt +++ b/asterixdb/asterix-app/src/main/resources/sdk/static/AdmAql101/query.txt @@ -1,3 +1,22 @@ +/* + * 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. + */ + drop dataverse TinySocial if exists; create dataverse TinySocial; use dataverse TinySocial; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/82464fb4/asterixdb/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js b/asterixdb/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js index f8bed0e..ba11453 100644 --- a/asterixdb/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js +++ b/asterixdb/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js @@ -21,32 +21,32 @@ function AsterixDBConnection(configuration) { this._properties = {}; this._properties["dataverse"] = ""; this._properties["mode"] = "synchronous"; - + var configuration = arguments || {}; - + for (var key in configuration) { this._properties[key] = configuration[key]; } - + return this; } AsterixDBConnection.prototype.dataverse = function(dataverseName) { this._properties["dataverse"] = dataverseName; - + return this; }; AsterixDBConnection.prototype.query = function(statements, successFn, mode) { - + if ( typeof statements === 'string') { statements = [ statements ]; } - + var m = typeof mode ? mode : "synchronous"; - + var query = "use dataverse " + this._properties["dataverse"] + ";\n" + statements.join("\n"); this._api( @@ -54,7 +54,7 @@ AsterixDBConnection.prototype.query = function(statements, successFn, mode) { "query" : query, "mode" : m }, - successFn, + successFn, "http://localhost:19002/query" ); @@ -79,7 +79,7 @@ AsterixDBConnection.prototype.query_result = function(data, successFn) { data, successFn, "http://localhost:19002/query/result" - ); + ); return this; }; @@ -89,7 +89,7 @@ AsterixDBConnection.prototype.ddl = function(statements, successFn) { if ( typeof statements === 'string') { statements = [ statements ]; } - + this._api( { "ddl" : "use dataverse " + this._properties["dataverse"] + ";\n" + statements.join("\n") @@ -104,7 +104,7 @@ AsterixDBConnection.prototype.update = function(statements, successFn) { if ( typeof statements === 'string') { statements = [ statements ]; } - + this._api( { "statements" : "use dataverse " + this._properties["dataverse"] + ";\n" + statements.join("\n") @@ -117,7 +117,7 @@ AsterixDBConnection.prototype.update = function(statements, successFn) { AsterixDBConnection.prototype._api = function(json, onSuccess, endpoint) { var success_fn = onSuccess; - + $.ajax({ type: 'GET', url: endpoint, @@ -128,7 +128,7 @@ AsterixDBConnection.prototype._api = function(json, onSuccess, endpoint) { } // TODO error: }); - + return this; }; @@ -139,7 +139,7 @@ function AExpression () { this._success = function() {}; if (typeof arguments[0] == 'string') { - this._properties["value"] = arguments[0]; + this._properties["value"] = arguments[0]; } return this; @@ -164,7 +164,7 @@ AExpression.prototype.run = function(successFn) { }; -AExpression.prototype.val = function() { +AExpression.prototype.val = function() { var value = ""; @@ -182,33 +182,33 @@ AExpression.prototype.val = function() { // @param expressionValue [String] AExpression.prototype.set = function(expressionValue) { - this._properties["value"] = expressionValue; + this._properties["value"] = expressionValue; return this; }; // FunctionExpression // Parent: AsterixExpression -// -// @param options [Various], +// +// @param options [Various], // @key function [String], a function to be applid to the expression // @key expression [AsterixExpression or AQLClause] an AsterixExpression/Clause to which the fn will be applied function FunctionExpression() { - + // Initialize superclass AExpression.call(this); - + this._properties["function"] = ""; this._properties["expression"] = new AExpression().set(""); // Check for fn/expression input - if (arguments.length == 2 && typeof arguments[0] == "string" && + if (arguments.length == 2 && typeof arguments[0] == "string" && (arguments[1] instanceof AExpression || arguments[1] instanceof AQLClause)) { - + this._properties["function"] = arguments[0]; this._properties["expression"] = arguments[1]; - - } + + } // Return object return this; @@ -224,7 +224,7 @@ FunctionExpression.prototype.fn = function(fnName) { if (typeof fnName == "string") { this._properties["function"] = fnName; } - + return this; }; @@ -233,12 +233,12 @@ FunctionExpression.prototype.expression = function(expression) { if (expression instanceof AExpression || expression instanceof AQLClause) { this._properties["expression"] = expression; } - + return this; }; - -FunctionExpression.prototype.val = function () { + +FunctionExpression.prototype.val = function () { return this._properties["function"] + "(" + this._properties["expression"].val() + ")"; }; @@ -366,7 +366,7 @@ function AQLClause() { AQLClause.prototype.val = function() { var value = this._properties["clause"]; - + return value; }; @@ -390,28 +390,28 @@ AQLClause.prototype.set = function(value) { // Grammar: // "for" Variable ( "at" Variable )? "in" ( Expression ) // -// @param for_variable [String], REQUIRED, first variable in clause +// @param for_variable [String], REQUIRED, first variable in clause // @param at_variable [String], NOT REQUIRED, first variable in clause // @param expression [AsterixExpression], REQUIRED, expression to evaluate function ForClause(for_variable, at_variable, expression) { AQLClause.call(this); - + var parameters = []; if (arguments[0] instanceof Array) { parameters = arguments[0]; } else { parameters = arguments; } - + this._properties["clause"] = "for " + parameters[0]; - + if (parameters.length == 3) { this._properties["clause"] += " at " + parameters[1]; this._properties["clause"] += " in " + parameters[2].val(); } else if (parameters.length == 2) { this._properties["clause"] += " in " + parameters[1].val(); } - + return this; } @@ -430,18 +430,18 @@ ForClause.prototype.constructor = ForClause; // TODO Vigorous error checking function LetClause(let_variable, expression) { AQLClause.call(this); - + var parameters = []; if (arguments[0] instanceof Array) { parameters = arguments[0]; } else { parameters = arguments; } - + this._properties["clause"] = "let " + parameters[0] + " := "; this._properties["clause"] += parameters[1].val(); - - return this; + + return this; } LetClause.prototype = Object.create(AQLClause.prototype); @@ -456,27 +456,27 @@ function ReturnClause(expression) { AQLClause.call(this); this._properties["clause"] = "return "; - + if (expression instanceof AExpression || expression instanceof AQLClause) { this._properties["clause"] += expression.val(); - + } else if ( typeof expression == "object" && Object.getPrototypeOf( expression ) === Object.prototype ) { - + // TODO Null object check - + this._properties["clause"] += "{"; var returnStatements = []; for (returnValue in expression) { - - if (expression[returnValue] instanceof AExpression) { - returnStatements.push('"' + returnValue + '" ' + " : " + expression[returnValue].val()); - } else if (typeof expression[returnValue] == "string") { - returnStatements.push('"' + returnValue + '" ' + " : " + expression[returnValue]); + + if (expression[returnValue] instanceof AExpression) { + returnStatements.push('"' + returnValue + '" ' + " : " + expression[returnValue].val()); + } else if (typeof expression[returnValue] == "string") { + returnStatements.push('"' + returnValue + '" ' + " : " + expression[returnValue]); } } this._properties["clause"] += returnStatements.join(",\n"); - this._properties["clause"] += "\n}"; - + this._properties["clause"] += "\n}"; + } else { this._properties["clause"] += new AQLClause().set(expression).val(); } @@ -491,13 +491,13 @@ ReturnClause.prototype.constructor = ReturnClause; // WhereClause // -// Grammar: +// Grammar: // ::= "where" Expression -// +// // @param expression [BooleanExpression], pushes this expression onto the stack function WhereClause(expression) { AQLClause.call(this); - + this._properties["stack"] = []; if (expression instanceof Array) { @@ -505,7 +505,7 @@ function WhereClause(expression) { } else { this.bind(expression); } - + return this; } @@ -523,8 +523,8 @@ WhereClause.prototype.bind = function(expression) { WhereClause.prototype.val = function() { - var value = ""; - + var value = ""; + if (this._properties["stack"].length == 0) { return value; } @@ -534,32 +534,32 @@ WhereClause.prototype.val = function() { value += this._properties["stack"][count].val() + " "; count -= 1; } - + return "where " + value; }; WhereClause.prototype.and = function() { - + var parameters = []; if (arguments[0] instanceof Array) { parameters = arguments[0]; } else { parameters = arguments; } - - var andClauses = []; + + var andClauses = []; for (var expression in parameters) { - + if (parameters[expression] instanceof AExpression) { andClauses.push(parameters[expression].val()); } } - + if (andClauses.length > 0) { this._properties["stack"].push(new AExpression().set(andClauses.join(" and "))); } - + return this; }; @@ -573,38 +573,38 @@ WhereClause.prototype.or = function() { parameters = arguments; } - var orClauses = []; + var orClauses = []; for (var expression in parameters) { - + if (parameters[expression] instanceof AExpression) { orClauses.push(parameters[expression].val()); } } - + if (andClauses.length > 0) { this._properties["stack"].push(new AExpression().set(orClauses.join(" and "))); } - + return this; }; // LimitClause // Grammar: // LimitClause ::= "limit" Expression ( "offset" Expression )? -// +// // @param limitExpression [REQUIRED, AQLExpression] // @param offsetExpression [OPTIONAL, AQLExpression] function LimitClause(limitExpression, offsetExpression) { AQLClause.call(this); - + var parameters = []; if (arguments[0] instanceof Array) { parameters = arguments[0]; } else { parameters = arguments; } - + // limitExpression required this._properties["clause"] = "limit " + parameters[0].val(); @@ -625,19 +625,19 @@ LimitClause.prototype.constructor = LimitClause; // Grammar: // OrderbyClause ::= "order" "by" Expression ( ( "asc" ) | ( "desc" ) )? ( "," Expression ( ( "asc" ) | ( "desc" ) )? )* // -// @params AQLExpressions and asc/desc strings, in any quantity. At least one required. +// @params AQLExpressions and asc/desc strings, in any quantity. At least one required. function OrderbyClause() { - + AQLClause.call(this); // At least one argument expression is required, and first should be expression if (arguments.length == 0) { - + alert("Order By Error"); this._properties["clause"] = null; - return this; + return this; } - + var parameters = []; if (arguments[0] instanceof Array) { parameters = arguments[0]; @@ -646,10 +646,10 @@ function OrderbyClause() { } var expc = 0; - var expressions = []; + var expressions = []; while (expc < parameters.length) { - + var expression = ""; if (parameters[expc] instanceof AExpression) { @@ -661,9 +661,9 @@ function OrderbyClause() { expc++; expression += " " + parameters[expc]; } - + expressions.push(expression); - + expc++; } @@ -686,9 +686,9 @@ function GroupClause() { // TODO Not sure which error to throw for an empty GroupBy but this should fail. alert("Group Error"); this._properties["clause"] = null; - return this; - } - + return this; + } + var parameters = []; if (arguments[0] instanceof Array) { parameters = arguments[0]; @@ -700,7 +700,7 @@ function GroupClause() { var expressions = []; var variableRefs = []; var isDecor = false; - + while (expc < parameters.length) { if (parameters[expc] instanceof AExpression) { @@ -708,8 +708,8 @@ function GroupClause() { isDecor = false; expressions.push(parameters[expc].val()); - } else if (typeof parameters[expc] == "string") { - + } else if (typeof parameters[expc] == "string") { + // Special keywords, decor & with if (parameters[expc] == "decor") { isDecor = true; @@ -720,15 +720,15 @@ function GroupClause() { variableRefs.push(parameters[expc]); expc++; } - + // Variables and variable refs } else { - + var nextc = expc + 1; var expression = ""; - + if (isDecor) { - expression += "decor "; + expression += "decor "; isDecor = false; } @@ -768,10 +768,10 @@ SetStatement.prototype.constructor = SetStatement; // Quantified Expression -// +// // Grammar // QuantifiedExpression ::= ( ( "some" ) | ( "every" ) ) Variable "in" Expression ( "," Variable "in" Expression )* "satisfies" Expression -// +// // @param String some/every // @param [AExpression] // @param [Aexpression] satisfiesExpression @@ -782,10 +782,10 @@ function QuantifiedExpression (keyword, expressions, satisfiesExpression) { var varsInExpressions = []; for (var varInExpression in expressions) { - varsInExpressions.push(varInExpression + " in " + expressions[varInExpression].val()); - } + varsInExpressions.push(varInExpression + " in " + expressions[varInExpression].val()); + } expression += varsInExpressions.join(", ") + " satisfies " + satisfiesExpression.val(); - + AExpression.prototype.set.call(this, expression); return this; @@ -796,5 +796,5 @@ QuantifiedExpression.prototype.constructor = QuantifiedExpression; QuantifiedExpression.prototype.val = function() { var value = AExpression.prototype.val.call(this); - return "(" + value + ")"; + return "(" + value + ")"; }; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/82464fb4/asterixdb/asterix-app/src/main/resources/webui/static/css/jquery.json-viewer.css ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/resources/webui/static/css/jquery.json-viewer.css b/asterixdb/asterix-app/src/main/resources/webui/static/css/jquery.json-viewer.css index 98fdfb9..715c42a 100644 --- a/asterixdb/asterix-app/src/main/resources/webui/static/css/jquery.json-viewer.css +++ b/asterixdb/asterix-app/src/main/resources/webui/static/css/jquery.json-viewer.css @@ -1,3 +1,29 @@ +/** + * jQuery json-viewer + * @author: Alexandre Bodelot <alexandre.bode...@gmail.com> + * + * The MIT License (MIT) + * + * Copyright (c) 2014 Alexandre Bodelot + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ /* Syntax highlighting for JSON objects */ ul.json-dict, ol.json-array { list-style-type: none; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/82464fb4/asterixdb/asterix-app/src/main/resources/webui/static/js/jquery.autosize-min.js ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/resources/webui/static/js/jquery.autosize-min.js b/asterixdb/asterix-app/src/main/resources/webui/static/js/jquery.autosize-min.js index 2cff1f8..ff4d630 100644 --- a/asterixdb/asterix-app/src/main/resources/webui/static/js/jquery.autosize-min.js +++ b/asterixdb/asterix-app/src/main/resources/webui/static/js/jquery.autosize-min.js @@ -1 +1 @@ -(function(e){var t,o,n={className:"autosizejs",append:"",callback:!1},i="hidden",s="border-box",a="lineHeight",l='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden;"/>',r=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],c="oninput",h="onpropertychange",p=e(l).data("autosize",!0)[0];p.style.lineHeight="99px","99px"===e(p).css(a)&&r.push(a),p.style.lineHeight="",e.fn.autosize=function(a){return a=e.extend({},n,a||{}),p.parentNode!==document.body&&(e(document.body).append(p),p.value="\n\n\n",p.scrollTop=9e4,t=p.scrollHeight===p.scrollTop+p.clientHeight),this.each(function(){function n(){o=b,p.className=a.className,e.each(r,function(e,t){p.style[t]=f.css(t)})}function l(){var e,s,l;if(o!==b&&n(),!d){d=!0,p. value=b.value+a.append,p.style.overflowY=b.style.overflowY,l=parseInt(b.style.height,10),p.style.width=Math.max(f.width(),0)+"px",t?e=p.scrollHeight:(p.scrollTop=0,p.scrollTop=9e4,e=p.scrollTop);var r=parseInt(f.css("maxHeight"),10);r=r&&r>0?r:9e4,e>r?(e=r,s="scroll"):u>e&&(e=u),e+=x,b.style.overflowY=s||i,l!==e&&(b.style.height=e+"px",w&&a.callback.call(b)),setTimeout(function(){d=!1},1)}}var u,d,g,b=this,f=e(b),x=0,w=e.isFunction(a.callback);f.data("autosize")||((f.css("box-sizing")===s||f.css("-moz-box-sizing")===s||f.css("-webkit-box-sizing")===s)&&(x=f.outerHeight()-f.height()),u=Math.max(parseInt(f.css("minHeight"),10)-x,f.height()),g="none"===f.css("resize")||"vertical"===f.css("resize")?"none":"horizontal",f.css({overflow:i,overflowY:i,wordWrap:"break-word",resize:g}).data("autosize",!0),h in b?c in b?b[c]=b.onkeyup=l:b[h]=l:b[c]=l,e(window).on("resize",function(){d=!1,l()}),f.on("autosize",function(){d=!1,l()}),l())})}})(window.jQuery||window.Zepto); +/*! (c) jQuery Foundation | jquery.org/license */(function(e){var t,o,n={className:"autosizejs",append:"",callback:!1},i="hidden",s="border-box",a="lineHeight",l='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden;"/>',r=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],c="oninput",h="onpropertychange",p=e(l).data("autosize",!0)[0];p.style.lineHeight="99px","99px"===e(p).css(a)&&r.push(a),p.style.lineHeight="",e.fn.autosize=function(a){return a=e.extend({},n,a||{}),p.parentNode!==document.body&&(e(document.body).append(p),p.value="\n\n\n",p.scrollTop=9e4,t=p.scrollHeight===p.scrollTop+p.clientHeight),this.each(function(){function n(){o=b,p.className=a.className,e.each(r,function(e,t){p.style[t]=f.css(t)}) }function l(){var e,s,l;if(o!==b&&n(),!d){d=!0,p.value=b.value+a.append,p.style.overflowY=b.style.overflowY,l=parseInt(b.style.height,10),p.style.width=Math.max(f.width(),0)+"px",t?e=p.scrollHeight:(p.scrollTop=0,p.scrollTop=9e4,e=p.scrollTop);var r=parseInt(f.css("maxHeight"),10);r=r&&r>0?r:9e4,e>r?(e=r,s="scroll"):u>e&&(e=u),e+=x,b.style.overflowY=s||i,l!==e&&(b.style.height=e+"px",w&&a.callback.call(b)),setTimeout(function(){d=!1},1)}}var u,d,g,b=this,f=e(b),x=0,w=e.isFunction(a.callback);f.data("autosize")||((f.css("box-sizing")===s||f.css("-moz-box-sizing")===s||f.css("-webkit-box-sizing")===s)&&(x=f.outerHeight()-f.height()),u=Math.max(parseInt(f.css("minHeight"),10)-x,f.height()),g="none"===f.css("resize")||"vertical"===f.css("resize")?"none":"horizontal",f.css({overflow:i,overflowY:i,wordWrap:"break-word",resize:g}).data("autosize",!0),h in b?c in b?b[c]=b.onkeyup=l:b[h]=l:b[c]=l,e(window).on("resize",function(){d=!1,l()}),f.on("autosize",function(){d=!1,l()}),l())})}})(wind ow.jQuery||window.Zepto); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/82464fb4/asterixdb/asterix-app/src/main/resources/webui/static/js/jquery.json-viewer.js ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/resources/webui/static/js/jquery.json-viewer.js b/asterixdb/asterix-app/src/main/resources/webui/static/js/jquery.json-viewer.js index b2e82ee..35ef5a1 100644 --- a/asterixdb/asterix-app/src/main/resources/webui/static/js/jquery.json-viewer.js +++ b/asterixdb/asterix-app/src/main/resources/webui/static/js/jquery.json-viewer.js @@ -1,6 +1,28 @@ /** * jQuery json-viewer * @author: Alexandre Bodelot <alexandre.bode...@gmail.com> + * + * The MIT License (MIT) + * + * Copyright (c) 2014 Alexandre Bodelot + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ (function($){