diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/api/event-api.jag b/modules/distribution/src/repository/jaggeryapps/iotserver/api/event-api.jag new file mode 100644 index 00000000..5dff6ff9 --- /dev/null +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/api/event-api.jag @@ -0,0 +1,52 @@ +<% +/* + * 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. + */ + +var uri = request.getRequestURI(); +var uriMatcher = new URIMatcher(String(uri)); + +var log = new Log("api/event-api.jag"); + +var constants = require("/modules/constants.js"); +var dcProps = require('/config/dc-props.js').config(); + +var carbon = require('carbon'); +var carbonHttpsServletTransport = carbon.server.address('https'); +var deviceCloudService = carbonHttpsServletTransport + "/devicecloud/group_manager"; + +var user = session.get(constants.USER_SESSION_KEY); +if (!user) { + response.sendRedirect(dcProps.appContext + "login?#login-required"); + exit();//stop execution +} + +var result; +var endPoint; +var data; +var groupId; + +if (uriMatcher.match("/{context}/api/event/list")) { + +} + +// returning the result. +if (result) { + response.status = result.xhr.status; + print(result.data); +} +%> \ No newline at end of file diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/jaggery.conf b/modules/distribution/src/repository/jaggeryapps/iotserver/jaggery.conf index 2771f3c3..5a7e83c1 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/jaggery.conf +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/jaggery.conf @@ -23,6 +23,10 @@ "url": "/api/group/*", "path": "/api/group-api.jag" }, + { + "url": "/api/event/*", + "path": "/api/event-api.jag" + }, { "url": "/api/operation/*", "path": "/api/operation-api.jag" diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs index 4a363d5e..e8cf3aa4 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs @@ -118,6 +118,8 @@ +
+
{{/zone}} {{#zone "bottomJs"}} diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/js/dashboard.js b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/js/dashboard.js index 72f980f7..3ea1cb56 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/js/dashboard.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/js/dashboard.js @@ -14,4 +14,6 @@ $(document).ready(function(){ updateStats("/iotserver/api/group/all/count", "#group-count"); updateStats("/iotserver/api/policies/count", "#policy-count"); updateStats("/iotserver/api/users/count", "#user-count"); + + }); \ No newline at end of file diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/templates/event-stream.hbs b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/templates/event-stream.hbs new file mode 100644 index 00000000..35e004c4 --- /dev/null +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/templates/event-stream.hbs @@ -0,0 +1,27 @@ +
+ +
+
+ +
+ + + + + + + + + + {{#each data}} + + + + + + {{/each}} + +
TimeDeviceActivity
{{time}}{{deviceIdentifier}}{{activity}}
+
\ No newline at end of file