web.siddhitryit.js.sendInputData.js Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*/
function sendAjaxRequestToSiddhiProcessor(sendInputData) {
new Ajax.Request("../siddhitryit/siddhiProcessor_ajaxprocessor.jsp", {
method: 'POST',
asynchronous: false,
parameters: {
eventstream: document.getElementById("eventStreamId").value,
executionplan: window.queryEditor.getValue(),
datetime: document.getElementById("dateTimeID").value
},
onSuccess: function (data) {
if (data != null) {
var jsonObject = JSON.parse(data.responseText);
if (jsonObject != undefined) {
if (jsonObject.success.localeCompare("true") == 0) {
jQuery('.js_resultCol').show();
var jsonArray = JSON.parse(jsonObject.jsonValue);
var tabContent = document.getElementById('resultsId');
tabContent.innerHTML = '
';
for (i = 0; i < jsonArray.length; i++) {
var tabHeader = document.getElementById('tabHeaders');
var jsonArrayKey = jsonArray[i].key;
var jsonArrayValue = jsonArray[i].jsonValue;
if (jsonArrayKey.indexOf(':') == 0) {
jsonArrayKey = jsonArrayKey.replace(':', ' ');
tabHeader.innerHTML = tabHeader.innerHTML + '' + jsonArrayKey + ' ';
}
else {
tabHeader.innerHTML = tabHeader.innerHTML + '' + jsonArrayKey + ' ';
}
tabContent = document.getElementById('tabs');
if (jsonArrayValue != null) {
tabContent.innerHTML = tabContent.innerHTML + '';
} else {
tabContent.innerHTML = tabContent.innerHTML + '';
}
}
jQuery("#tabs").tabs();
}
else if (jsonObject.success.localeCompare("false") == 0) {
CARBON.showErrorDialog(jsonObject.jsonValue);
jQuery('.js_resultCol').hide();
}
}
}
}
});
}