Changed the realtime gadgets to get query parameters.

revert-dabc3590
Menaka Jayawardena 8 years ago
parent 17f82d1da3
commit a2e8537fcf

@ -11,7 +11,7 @@ define stream CallStatsStream (meta_owner string, meta_deviceId string, meta_tim
partition with (meta_deviceId of CallStream) partition with (meta_deviceId of CallStream)
begin begin
from CallStream[type == 'INCOMING' OR type == 'OUTGOING'] from CallStream
select meta_owner, meta_deviceId, meta_timestamp, number, type, (endTime - startTime) as duration, time:extract(meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute select meta_owner, meta_deviceId, meta_timestamp, number, type, (endTime - startTime) as duration, time:extract(meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute
insert into CallStatsStream; insert into CallStatsStream;
end; end;

@ -130,13 +130,41 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper
} }
} }
/**
* Get the parameters as query parameters.
* This method parses those parameters and returns.
* */
function getAllQueryParamsFromURL() {
var queryParamList = {}, qParam;
var urlQueryString = decodeURIComponent(window.top.location.search.substring(1));
if (urlQueryString) {
var queryStringPairs = urlQueryString.split('&');
for (var i = 0; i < queryStringPairs.length; i++) {
qParam = queryStringPairs[i].split('=');
queryParamList[qParam[0]] = qParam[1];
}
return queryParamList;
} else {
return null;
}
}
/** /**
* Web socket On Open * Web socket On Open
*/ */
var webSocketOnOpen = function () { var webSocketOnOpen = function () {
var filterPropNames = ["meta_deviceId"]; var params = getAllQueryParamsFromURL();
var filterPropVals = ["htc"]; var deviceId;
var owner;
if (params != null) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];
var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals);
websocket.send(data); websocket.send(data);
}; };

@ -130,13 +130,41 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper
} }
} }
/**
* Get the parameters as query parameters.
* This method parses those parameters and returns.
* */
function getAllQueryParamsFromURL() {
var queryParamList = {}, qParam;
var urlQueryString = decodeURIComponent(window.top.location.search.substring(1));
if (urlQueryString) {
var queryStringPairs = urlQueryString.split('&');
for (var i = 0; i < queryStringPairs.length; i++) {
qParam = queryStringPairs[i].split('=');
queryParamList[qParam[0]] = qParam[1];
}
return queryParamList;
} else {
return null;
}
}
/** /**
* Web socket On Open * Web socket On Open
*/ */
var webSocketOnOpen = function () { var webSocketOnOpen = function () {
var filterPropNames = ["meta_deviceId"]; var params = getAllQueryParamsFromURL();
var filterPropVals = ["htc"]; var deviceId;
var owner;
if (params != null) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];
var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals);
websocket.send(data); websocket.send(data);
}; };

@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper
} }
} }
/**
* Get the parameters as query parameters.
* This method parses those parameters and returns.
* */
function getAllQueryParamsFromURL() {
var queryParamList = {}, qParam;
var urlQueryString = decodeURIComponent(window.top.location.search.substring(1));
if (urlQueryString) {
var queryStringPairs = urlQueryString.split('&');
for (var i = 0; i < queryStringPairs.length; i++) {
qParam = queryStringPairs[i].split('=');
queryParamList[qParam[0]] = qParam[1];
}
return queryParamList;
} else {
return null;
}
}
/** /**
* Web socket On Open * Web socket On Open
*/ */
var webSocketOnOpen = function () { var webSocketOnOpen = function () {
var filterPropNames = ["meta_deviceId"]; var params = getAllQueryParamsFromURL();
var filterPropVals = ["htc"]; var deviceId;
var data = getWebsocketSubscriptionMessage(stream, streamVersion, [], []); var owner;
if (params != null) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];
var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals);
websocket.send(data); websocket.send(data);
}; };
/** /**
* On server sends a message * On server sends a message
*/ */

@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper
} }
} }
/**
* Get the parameters as query parameters.
* This method parses those parameters and returns.
* */
function getAllQueryParamsFromURL() {
var queryParamList = {}, qParam;
var urlQueryString = decodeURIComponent(window.top.location.search.substring(1));
if (urlQueryString) {
var queryStringPairs = urlQueryString.split('&');
for (var i = 0; i < queryStringPairs.length; i++) {
qParam = queryStringPairs[i].split('=');
queryParamList[qParam[0]] = qParam[1];
}
return queryParamList;
} else {
return null;
}
}
/** /**
* Web socket On Open * Web socket On Open
*/ */
var webSocketOnOpen = function () { var webSocketOnOpen = function () {
var filterPropNames = ["meta_deviceId"]; var params = getAllQueryParamsFromURL();
var filterPropVals = ["htc"]; var deviceId;
var owner;
if (params != null) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];
var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals);
websocket.send(data); websocket.send(data);
}; };
/** /**
* On server sends a message * On server sends a message
*/ */

@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper
} }
} }
/**
* Get the parameters as query parameters.
* This method parses those parameters and returns.
* */
function getAllQueryParamsFromURL() {
var queryParamList = {}, qParam;
var urlQueryString = decodeURIComponent(window.top.location.search.substring(1));
if (urlQueryString) {
var queryStringPairs = urlQueryString.split('&');
for (var i = 0; i < queryStringPairs.length; i++) {
qParam = queryStringPairs[i].split('=');
queryParamList[qParam[0]] = qParam[1];
}
return queryParamList;
} else {
return null;
}
}
/** /**
* Web socket On Open * Web socket On Open
*/ */
var webSocketOnOpen = function () { var webSocketOnOpen = function () {
var filterPropNames = ["meta_deviceId"]; var params = getAllQueryParamsFromURL();
var filterPropVals = ["htc"]; var deviceId;
var owner;
if (params != null) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];
var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals);
websocket.send(data); websocket.send(data);
}; };
/** /**
* On server sends a message * On server sends a message
*/ */

@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper
} }
} }
/**
* Get the parameters as query parameters.
* This method parses those parameters and returns.
* */
function getAllQueryParamsFromURL() {
var queryParamList = {}, qParam;
var urlQueryString = decodeURIComponent(window.top.location.search.substring(1));
if (urlQueryString) {
var queryStringPairs = urlQueryString.split('&');
for (var i = 0; i < queryStringPairs.length; i++) {
qParam = queryStringPairs[i].split('=');
queryParamList[qParam[0]] = qParam[1];
}
return queryParamList;
} else {
return null;
}
}
/** /**
* Web socket On Open * Web socket On Open
*/ */
var webSocketOnOpen = function () { var webSocketOnOpen = function () {
var filterPropNames = ["meta_deviceId"]; var params = getAllQueryParamsFromURL();
var filterPropVals = ["htc"]; var deviceId;
var owner;
if (params != null) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];
var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals);
websocket.send(data); websocket.send(data);
}; };
/** /**
* On server sends a message * On server sends a message
*/ */

@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper
} }
} }
/**
* Get the parameters as query parameters.
* This method parses those parameters and returns.
* */
function getAllQueryParamsFromURL() {
var queryParamList = {}, qParam;
var urlQueryString = decodeURIComponent(window.top.location.search.substring(1));
if (urlQueryString) {
var queryStringPairs = urlQueryString.split('&');
for (var i = 0; i < queryStringPairs.length; i++) {
qParam = queryStringPairs[i].split('=');
queryParamList[qParam[0]] = qParam[1];
}
return queryParamList;
} else {
return null;
}
}
/** /**
* Web socket On Open * Web socket On Open
*/ */
var webSocketOnOpen = function () { var webSocketOnOpen = function () {
var filterPropNames = ["meta_deviceId"]; var params = getAllQueryParamsFromURL();
var filterPropVals = ["htc"]; var deviceId;
var owner;
if (params != null) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];
var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals);
websocket.send(data); websocket.send(data);
}; };
/** /**
* On server sends a message * On server sends a message
*/ */

@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper
} }
} }
/**
* Get the parameters as query parameters.
* This method parses those parameters and returns.
* */
function getAllQueryParamsFromURL() {
var queryParamList = {}, qParam;
var urlQueryString = decodeURIComponent(window.top.location.search.substring(1));
if (urlQueryString) {
var queryStringPairs = urlQueryString.split('&');
for (var i = 0; i < queryStringPairs.length; i++) {
qParam = queryStringPairs[i].split('=');
queryParamList[qParam[0]] = qParam[1];
}
return queryParamList;
} else {
return null;
}
}
/** /**
* Web socket On Open * Web socket On Open
*/ */
var webSocketOnOpen = function () { var webSocketOnOpen = function () {
var filterPropNames = ["meta_deviceId"]; var params = getAllQueryParamsFromURL();
var filterPropVals = ["htc"]; var deviceId;
var owner;
if (params != null) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];
var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals);
websocket.send(data); websocket.send(data);
}; };
/** /**
* On server sends a message * On server sends a message
*/ */

@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper
} }
} }
/**
* Get the parameters as query parameters.
* This method parses those parameters and returns.
* */
function getAllQueryParamsFromURL() {
var queryParamList = {}, qParam;
var urlQueryString = decodeURIComponent(window.top.location.search.substring(1));
if (urlQueryString) {
var queryStringPairs = urlQueryString.split('&');
for (var i = 0; i < queryStringPairs.length; i++) {
qParam = queryStringPairs[i].split('=');
queryParamList[qParam[0]] = qParam[1];
}
return queryParamList;
} else {
return null;
}
}
/** /**
* Web socket On Open * Web socket On Open
*/ */
var webSocketOnOpen = function () { var webSocketOnOpen = function () {
var filterPropNames = ["meta_deviceId"]; var params = getAllQueryParamsFromURL();
var filterPropVals = ["htc"]; var deviceId;
var owner;
if (params != null) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];
var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals);
websocket.send(data); websocket.send(data);
}; };
/** /**
* On server sends a message * On server sends a message
*/ */

Loading…
Cancel
Save