mirror of
https://repository.entgra.net/community/product-iots.git
synced 2025-09-16 23:32:19 +00:00
Merge branch 'master' of https://github.com/wso2-dev/product-device-cloud
This commit is contained in:
commit
e16bf62019
BIN
modules/.DS_Store
vendored
Normal file
BIN
modules/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
modules/distribution/.DS_Store
vendored
Normal file
BIN
modules/distribution/.DS_Store
vendored
Normal file
Binary file not shown.
@ -411,6 +411,8 @@
|
||||
|
||||
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/patches" />
|
||||
|
||||
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/lib" />
|
||||
|
||||
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/jaggeryapps" overwrite="true">
|
||||
<fileset dir="src/repository/jaggeryapps"></fileset>
|
||||
</copy>
|
||||
@ -431,6 +433,10 @@
|
||||
<fileset dir="src/patches" />
|
||||
</copy>
|
||||
|
||||
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/lib">
|
||||
<fileset dir="src/lib" />
|
||||
</copy>
|
||||
|
||||
<!--<copy todir="target/wso2carbon-core-${carbon.kernel.version}/modules" overwrite="true">
|
||||
<fileset dir="src/repository/modules"></fileset>
|
||||
</copy>
|
||||
|
||||
BIN
modules/distribution/src/.DS_Store
vendored
Normal file
BIN
modules/distribution/src/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
modules/distribution/src/lib/.DS_Store
vendored
Normal file
BIN
modules/distribution/src/lib/.DS_Store
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
modules/distribution/src/repository/.DS_Store
vendored
Normal file
BIN
modules/distribution/src/repository/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
modules/distribution/src/repository/jaggeryapps/.DS_Store
vendored
Normal file
BIN
modules/distribution/src/repository/jaggeryapps/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
modules/distribution/src/repository/jaggeryapps/iotserver/.DS_Store
vendored
Normal file
BIN
modules/distribution/src/repository/jaggeryapps/iotserver/.DS_Store
vendored
Normal file
Binary file not shown.
@ -34,55 +34,55 @@ var result;
|
||||
|
||||
if (uriMatcher.match("/{context}/api/device/sketch/download/{downloadId}")) {
|
||||
downloadId = uriMatcher.elements().downloadId;
|
||||
//Just download the already created zip archive
|
||||
var CarbonUtils = Packages.org.wso2.carbon.utils.CarbonUtils;
|
||||
var sketchFolder = "repository/resources/sketches";
|
||||
var archivesPath = "file://"+CarbonUtils.getCarbonHome() + "/" + sketchFolder + "/archives/" + downloadId + ".zip";
|
||||
var zipFile = new File(archivesPath);
|
||||
response.addHeader('Content-type', "application/zip, application/octet-stream");
|
||||
response.addHeader('Cache-Control', 'public,max-age=12960000');
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + downloadId + ".zip\"");
|
||||
//Just download the already created zip archive
|
||||
var CarbonUtils = Packages.org.wso2.carbon.utils.CarbonUtils;
|
||||
var sketchFolder = "repository/resources/sketches";
|
||||
var archivesPath = "file://" + CarbonUtils.getCarbonHome() + "/" + sketchFolder + "/archives/" + downloadId + ".zip";
|
||||
var zipFile = new File(archivesPath);
|
||||
response.addHeader('Content-type', "application/zip, application/octet-stream");
|
||||
response.addHeader('Cache-Control', 'public,max-age=12960000');
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + downloadId + ".zip\"");
|
||||
|
||||
try {
|
||||
zipFile.open('r');
|
||||
var stream = zipFile.getStream();
|
||||
print(stream);
|
||||
}catch(err){
|
||||
try {
|
||||
zipFile.open('r');
|
||||
var stream = zipFile.getStream();
|
||||
print(stream);
|
||||
} catch (err) {
|
||||
|
||||
}finally{
|
||||
if(zipFile!=null) {
|
||||
zipFile.close();
|
||||
}
|
||||
} finally {
|
||||
if (zipFile != null) {
|
||||
zipFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/device/sketch/download")) {
|
||||
//Create a new zip archive and register user calling endpoint
|
||||
//Create a new zip archive and register user calling endpoint
|
||||
|
||||
/* This should match with $CARBON_HOME/repository/resources/sketches/{sketchType} */
|
||||
sketchType = request.getParameter("sketchType");
|
||||
/* This should be registered device type of the CDMF(Connected Device Management Framework) */
|
||||
deviceType = request.getParameter("deviceType");
|
||||
/* This should match with $CARBON_HOME/repository/resources/sketches/{sketchType} */
|
||||
sketchType = request.getParameter("sketchType");
|
||||
/* This should be registered device type of the CDMF(Connected Device Management Framework) */
|
||||
deviceType = request.getParameter("deviceType");
|
||||
|
||||
if (!sketchType) {
|
||||
log.error("Sketch Type is empty!");
|
||||
// http status code 400 refers to - Bad request.
|
||||
result = 400;
|
||||
} else {
|
||||
var user = session.get(constants.USER_SESSION_KEY);
|
||||
if (!sketchType) {
|
||||
log.error("Sketch Type is empty!");
|
||||
// http status code 400 refers to - Bad request.
|
||||
result = 400;
|
||||
} else {
|
||||
var user = session.get(constants.USER_SESSION_KEY);
|
||||
|
||||
if (!user) {
|
||||
response.sendRedirect(dcProps.appContext + "login?#login-required");
|
||||
exit();
|
||||
}
|
||||
if (!user) {
|
||||
response.sendRedirect(dcProps.appContext + "login?#login-required");
|
||||
exit();
|
||||
}
|
||||
|
||||
//URL: https://localhost:9443/{deviceType}/download?owner={username}
|
||||
deviceManagerService = carbonHttpsServletTransport + "/" + deviceType + "/manager";
|
||||
//URL: https://localhost:9443/{deviceType}/download?owner={username}
|
||||
deviceManagerService = carbonHttpsServletTransport + "/" + deviceType + "/manager";
|
||||
|
||||
sketchDownloadEndPoint = deviceManagerService + "/device/" + sketchType + "/download";
|
||||
response.sendRedirect(sketchDownloadEndPoint + "?owner=" + user.username);
|
||||
exit();//stop execution
|
||||
sketchDownloadEndPoint = deviceManagerService + "/device/" + sketchType + "/download";
|
||||
response.sendRedirect(sketchDownloadEndPoint + "?owner=" + user.username);
|
||||
exit();//stop execution
|
||||
|
||||
}
|
||||
}
|
||||
} else if (uriMatcher.match("/{context}/api/device/sketch/generate_link")) {
|
||||
|
||||
var contents = request.getContent();
|
||||
@ -99,13 +99,13 @@ if (uriMatcher.match("/{context}/api/device/sketch/download/{downloadId}")) {
|
||||
|
||||
if (!user) {
|
||||
result = 403;
|
||||
}else {
|
||||
} else {
|
||||
//URL: https://localhost:9443/{deviceType}/download?owner={username}
|
||||
deviceManagerService = carbonHttpsServletTransport + "/" + deviceType + "/manager";
|
||||
|
||||
sketchGenerateLinkEndPoint = deviceManagerService + "/device/" + sketchType + "/generate_link";
|
||||
var fileId = get(sketchGenerateLinkEndPoint + "?owner=" + user.username, null, "text");
|
||||
result = carbonHttpsServletTransport + constants.WEB_APP_CONTEXT + "/api/device/sketch/download/" + fileId.data;
|
||||
result = "curl -k " + carbonHttpsServletTransport + constants.WEB_APP_CONTEXT + "/api/device/sketch/download/" + fileId.data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,15 +120,80 @@ if (uriMatcher.match("/{context}/api/device/sketch/download/{downloadId}")) {
|
||||
//URL: https://localhost:9443/devicecloud/manager/devices/username/{username}
|
||||
deviceCloudService = carbonHttpsServletTransport + "/devicecloud/device_manager";
|
||||
listAllDevicesEndPoint = deviceCloudService + "/devices/username/" + user.username;
|
||||
result = get(listAllDevicesEndPoint, {}, "json");
|
||||
var ownDevices = result.data;
|
||||
|
||||
var data = {};
|
||||
//XMLHTTPRequest's GET
|
||||
try {
|
||||
result = get(listAllDevicesEndPoint, data, "json");
|
||||
}catch(err){
|
||||
log.error("Error occured while retrieveing all devices with username: "+user.username);
|
||||
result=[];
|
||||
var allDevices = [];
|
||||
deviceCloudService = carbonHttpsServletTransport + "/devicecloud/group_manager";
|
||||
var endPoint = deviceCloudService + "/group/all";
|
||||
var data = {"username": user.username};
|
||||
var groups = get(endPoint, data, "json").data;
|
||||
|
||||
for (var g in groups) {
|
||||
endPoint = deviceCloudService + "/group/id/" + groups[g].id + "/device/all";
|
||||
data = {"username": user.username};
|
||||
var deviceInGroup = get(endPoint, data, "json").data;
|
||||
groups[g].devices = deviceInGroup;
|
||||
allDevices.push(groups[g]);
|
||||
for (var od in ownDevices) {
|
||||
for (var gd in deviceInGroup) {
|
||||
if (deviceInGroup[gd].deviceIdentifier == ownDevices[od].deviceIdentifier) {
|
||||
ownDevices[od].deviceIdentifier = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var unsharedDevices = [];
|
||||
for (var od in ownDevices) {
|
||||
if (ownDevices[od].deviceIdentifier != -1){
|
||||
unsharedDevices.push(ownDevices[od]);
|
||||
}
|
||||
}
|
||||
allDevices.push({id: 0, devices: unsharedDevices});
|
||||
result.data = allDevices;
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/devices/count")) {
|
||||
|
||||
var user = session.get(constants.USER_SESSION_KEY);
|
||||
if (!user) {
|
||||
response.sendRedirect(dcProps.appContext + "login?#login-required");
|
||||
exit();//stop execution
|
||||
}
|
||||
|
||||
//URL: https://localhost:9443/devicecloud/manager/devices/username/{username}
|
||||
deviceCloudService = carbonHttpsServletTransport + "/devicecloud/device_manager";
|
||||
listAllDevicesEndPoint = deviceCloudService + "/devices/username/" + user.username;
|
||||
result = get(listAllDevicesEndPoint, {}, "json");
|
||||
var ownDevices = result.data;
|
||||
|
||||
var allDevices = [];
|
||||
deviceCloudService = carbonHttpsServletTransport + "/devicecloud/group_manager";
|
||||
var endPoint = deviceCloudService + "/group/all";
|
||||
var data = {"username": user.username};
|
||||
var groups = get(endPoint, data, "json").data;
|
||||
|
||||
var count = 0;
|
||||
for (var g in groups) {
|
||||
endPoint = deviceCloudService + "/group/id/" + groups[g].id + "/device/all";
|
||||
data = {"username": user.username};
|
||||
var deviceInGroup = get(endPoint, data, "json").data;
|
||||
groups[g].devices = deviceInGroup;
|
||||
allDevices.push(groups[g]);
|
||||
for (var od in ownDevices) {
|
||||
for (var gd in deviceInGroup) {
|
||||
if (deviceInGroup[gd].deviceIdentifier == ownDevices[od].deviceIdentifier) {
|
||||
ownDevices[od].deviceIdentifier = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
count += deviceInGroup.length;
|
||||
}
|
||||
for (var od in ownDevices) {
|
||||
if (ownDevices[od].deviceIdentifier != -1){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
result = count.toString();
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/devices/types")) {
|
||||
|
||||
@ -142,7 +207,7 @@ if (uriMatcher.match("/{context}/api/device/sketch/download/{downloadId}")) {
|
||||
}
|
||||
|
||||
var elements = uriMatcher.elements();
|
||||
var deviceId=elements.deviceId;
|
||||
var deviceId = elements.deviceId;
|
||||
var deviceType = elements.deviceType;
|
||||
result = deviceModule.removeDevice(deviceType, deviceId);
|
||||
|
||||
@ -154,14 +219,14 @@ if (uriMatcher.match("/{context}/api/device/sketch/download/{downloadId}")) {
|
||||
}
|
||||
|
||||
var elements = uriMatcher.elements();
|
||||
var deviceId=elements.deviceId;
|
||||
var deviceId = elements.deviceId;
|
||||
var deviceType = elements.deviceType;
|
||||
var cont = request.getContent();
|
||||
|
||||
if(!cont.device){
|
||||
if (!cont.device) {
|
||||
// http status code 400 refers to - Bad request.
|
||||
result = 400;
|
||||
}else {
|
||||
} else {
|
||||
result = deviceModule.updateDevice(deviceType, deviceId, cont.device);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
<%
|
||||
/*
|
||||
* 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 eventModule = require("/modules/event.js").eventModule;
|
||||
|
||||
var result;
|
||||
if (uriMatcher.match("/{context}/api/event/list")) {
|
||||
var user = session.get(constants.USER_SESSION_KEY);
|
||||
if (!user) {
|
||||
response.sendRedirect(dcProps.appContext + "login?#login-required");
|
||||
exit();//stop execution
|
||||
}
|
||||
|
||||
result = eventModule.getEventsData(user.username, 10);
|
||||
}
|
||||
|
||||
// returning the result.
|
||||
if (result) {
|
||||
print(result);
|
||||
}
|
||||
%>
|
||||
@ -76,7 +76,6 @@ if (uriMatcher.match("/{context}/api/group/add")) {
|
||||
|
||||
//URL: GET https://localhost:9443/devicecloud/group_manager/group/id/{groupId}
|
||||
endPoint = deviceCloudService + "/group/id/" + groupId;
|
||||
log.info(endPoint);
|
||||
data = {"username": user.username};
|
||||
result = get(endPoint, data, "json");
|
||||
|
||||
@ -226,10 +225,17 @@ if (uriMatcher.match("/{context}/api/group/add")) {
|
||||
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
|
||||
//URL: GET https://localhost:9443/devicecloud/group_manager/group/id/{groupId}
|
||||
endPoint = deviceCloudService + "/group/id/" + groupId;
|
||||
data = {"username": user.username};
|
||||
var group = get(endPoint, data, "json").data;
|
||||
|
||||
//URL: GET https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/device/all
|
||||
endPoint = deviceCloudService + "/group/id/" + groupId + "/device/all";
|
||||
data = {"username": user.username};
|
||||
result = get(endPoint, data, "json");
|
||||
group.devices = result.data;
|
||||
result.data = {group: group}
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/assign")) {
|
||||
|
||||
|
||||
46
modules/distribution/src/repository/jaggeryapps/iotserver/api/policy-api.jag
Normal file → Executable file
46
modules/distribution/src/repository/jaggeryapps/iotserver/api/policy-api.jag
Normal file → Executable file
@ -28,22 +28,42 @@ var policyModule = require("/modules/policy.js").policyModule;
|
||||
|
||||
var result;
|
||||
if (uriMatcher.match("/{context}/api/policies/update")) {
|
||||
payload = request.getContent();
|
||||
policyModule.updatePolicyPriorities(payload);
|
||||
} else if (uriMatcher.match("/{context}/api/policies/{id}/delete")) {
|
||||
elements = uriMatcher.elements();
|
||||
policyId = elements.id;
|
||||
try {
|
||||
result = policyModule.deletePolicy(policyId);
|
||||
} catch (e) {
|
||||
log.error("Exception occurred while trying to delete policy for id:" + policyId, e);
|
||||
// http status code 500 refers to - Internal Server Error.
|
||||
result = 500;
|
||||
}
|
||||
payload = request.getContent();
|
||||
policyModule.updatePolicyPriorities(payload);
|
||||
} else if (uriMatcher.match("/{context}/api/policies/add")) {
|
||||
var content = request.getContent();
|
||||
var policyName = content.policyName;
|
||||
var policyDefinition = content.profile.policyDefinition;
|
||||
var policyDescription = content.profile.policyDescription;
|
||||
var deviceType = content.profile.deviceType.name;
|
||||
|
||||
log.info("@@@@@ Policy Declaration : " + stringify(content));
|
||||
|
||||
try {
|
||||
result = policyModule.addPolicy(policyName, deviceType, policyDefinition, policyDescription);
|
||||
} catch (e) {
|
||||
log.error("Exception occurred while trying to add new policy under name:" + id, e);
|
||||
// http status code 500 refers to - Internal Server Error.
|
||||
result = 500;
|
||||
}
|
||||
} else if (uriMatcher.match("/{context}/api/policies/{deviceType}/{policyName}/remove")) {
|
||||
elements = uriMatcher.elements();
|
||||
var id = elements.policyName;
|
||||
var deviceType = elements.deviceType;
|
||||
|
||||
try {
|
||||
result = policyModule.removePolicy(id, deviceType);
|
||||
} catch (e) {
|
||||
log.error("Exception occurred while trying to remove policy under name:" + id, e);
|
||||
// http status code 500 refers to - Internal Server Error.
|
||||
result = 500;
|
||||
}
|
||||
} else if (uriMatcher.match("/{context}/api/policies/count")) {
|
||||
result = policyModule.getPolicies().length.toString();
|
||||
}
|
||||
|
||||
// returning the result.
|
||||
if (result) {
|
||||
response.content = result;
|
||||
response.content = result;
|
||||
}
|
||||
%>
|
||||
@ -25,101 +25,204 @@ var log = new Log("api/stats-api.jag");
|
||||
var constants = require("/modules/constants.js");
|
||||
var dcProps = require('/config/dc-props.js').config();
|
||||
var utility = require("/modules/utility.js").utility;
|
||||
var deviceModule = require("/modules/device.js").deviceModule;
|
||||
|
||||
var from = request.getParameter("from");
|
||||
var to = request.getParameter("to");
|
||||
|
||||
var user = session.get(constants.USER_SESSION_KEY);
|
||||
if (!user) {
|
||||
response.sendRedirect(dcProps.appContext + "login?#login-required");
|
||||
exit();
|
||||
}
|
||||
|
||||
var carbon = require('carbon');
|
||||
var carbonHttpsServletTransport = carbon.server.address('https');
|
||||
var deviceCloudService = carbonHttpsServletTransport + "/devicecloud/group_manager";
|
||||
|
||||
var result;
|
||||
var statsClient = new Packages.org.wso2.carbon.device.mgt.iot.common.analytics.statistics.IoTUsageStatisticsClient;
|
||||
|
||||
var stats = {};
|
||||
var deviceId;
|
||||
var deviceType;
|
||||
if (uriMatcher.match("/{context}/api/stats")) {
|
||||
|
||||
deviceId = request.getParameter("deviceId");
|
||||
deviceType = request.getParameter("deviceType");
|
||||
from = request.getParameter("from");
|
||||
to = request.getParameter("to");
|
||||
|
||||
user = session.get(constants.USER_SESSION_KEY);
|
||||
if (!user) {
|
||||
response.sendRedirect(dcProps.appContext + "login?#login-required");
|
||||
exit();
|
||||
}
|
||||
getDeviceData(deviceType, deviceId);
|
||||
|
||||
log.info("deviceId : " + deviceId + " from : " + from + " to : " + to);
|
||||
}else if (uriMatcher.match("/{context}/api/stats/group")){
|
||||
var groupId = request.getParameter("groupId");
|
||||
|
||||
switch (deviceType) {
|
||||
case "firealarm":
|
||||
result = getFireAlarmData(user.username, deviceId, from, to);
|
||||
break;
|
||||
case "sensebot":
|
||||
result = getSensebotData(user.username, deviceId, from, to);
|
||||
break;
|
||||
case "arduino":
|
||||
result = getArduinoData(user.username, deviceId, from, to);
|
||||
break;
|
||||
case "digital_display":
|
||||
result = getDigitalDisplayData(user.username, deviceId, from, to);
|
||||
break;
|
||||
case "android_sense":
|
||||
result = getAndroidSenseData(user.username, deviceId, from, to);
|
||||
break;
|
||||
case "raspberrypi":
|
||||
result = getDigitalDisplayData(user.username, deviceId, from, to);
|
||||
break;
|
||||
default:
|
||||
result = new Object();
|
||||
}
|
||||
//URL: GET https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/device/all
|
||||
var endPoint = deviceCloudService + "/group/id/" + groupId + "/device/all";
|
||||
var data = {"username": user.username};
|
||||
var devices = get(endPoint, data, "json");
|
||||
|
||||
for (var device in devices.data){
|
||||
deviceId = devices.data[device].deviceIdentifier;
|
||||
deviceType = devices.data[device].type;
|
||||
getDeviceData(deviceType, deviceId);
|
||||
}
|
||||
}
|
||||
|
||||
// returning the result.
|
||||
if (result) {
|
||||
print(result);
|
||||
if (stats) {
|
||||
print(stats);
|
||||
}
|
||||
|
||||
function getFireAlarmData(user, deviceId, from, to) {
|
||||
result = new Object();
|
||||
result['cpuTemperatureData'] = getSensorData("DEVICE_CPU_TEMPERATURE_SUMMARY", "TEMPERATURE", user, deviceId, from, to);
|
||||
result['temperatureData'] = getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, deviceId, from, to);
|
||||
result['fanData'] = getSensorData("DEVICE_FAN_USAGE_SUMMARY", "status", user, deviceId, from, to);
|
||||
result['bulbData'] = getSensorData("DEVICE_BULB_USAGE_SUMMARY", "status", user, deviceId, from, to);
|
||||
return result;
|
||||
function getDeviceData(deviceType, deviceId){
|
||||
var device = deviceModule.getDevice(deviceType, deviceId);
|
||||
if (!device){
|
||||
return;
|
||||
}
|
||||
switch (deviceType) {
|
||||
case "firealarm":
|
||||
getFireAlarmData(user.username, device, from, to);
|
||||
break;
|
||||
case "sensebot":
|
||||
getSensebotData(user.username, device, from, to);
|
||||
break;
|
||||
case "arduino":
|
||||
getArduinoData(user.username, device, from, to);
|
||||
break;
|
||||
case "digital_display":
|
||||
getDigitalDisplayData(user.username, device, from, to);
|
||||
break;
|
||||
case "android_sense":
|
||||
getAndroidSenseData(user.username, device, from, to);
|
||||
break;
|
||||
case "raspberrypi":
|
||||
getDigitalDisplayData(user.username, device, from, to);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getSensebotData(user, deviceId, from, to) {
|
||||
result = new Object();
|
||||
result['sonarData'] = getSensorData("SONAR_SENSOR_SUMMARY", "sonar", user, deviceId, from, to);
|
||||
result['motionData'] = getSensorData("PIR_MOTION_SENSOR_SUMMARY", "motion", user, deviceId, from, to);
|
||||
result['lightData'] = getSensorData("LDR_LIGHT_SENSOR_SUMMARY", "light", user, deviceId, from, to);
|
||||
result['temperatureData'] = getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, deviceId, from, to);
|
||||
return result;
|
||||
function getFireAlarmData(user, device, from, to) {
|
||||
if (stats['temperatureData'] == null){
|
||||
stats['temperatureData'] = [];
|
||||
}
|
||||
if (stats['sonarData'] == null){
|
||||
stats['sonarData'] = [];
|
||||
}
|
||||
if (stats['motionData'] == null){
|
||||
stats['motionData'] = [];
|
||||
}
|
||||
if (stats['lightData'] == null){
|
||||
stats['lightData'] = [];
|
||||
}
|
||||
stats['temperatureData'].push({"device": device.name, "stats" : getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, device.deviceIdentifier, from, to)});
|
||||
stats['sonarData'].push({"device": device.name, "stats" : getSensorData("SONAR_SENSOR_SUMMARY", "sonar", user, device.deviceIdentifier, from, to)});
|
||||
stats['motionData'].push({"device": device.name, "stats" : getSensorData("PIR_MOTION_SENSOR_SUMMARY", "motion", user, device.deviceIdentifier, from, to)});
|
||||
stats['lightData'].push({"device": device.name, "stats" : getSensorData("LDR_LIGHT_SENSOR_SUMMARY", "light", user, device.deviceIdentifier, from, to)});
|
||||
}
|
||||
|
||||
function getArduinoData(user, deviceId, from, to) {
|
||||
result = new Object();
|
||||
result['temperatureData'] = getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, deviceId, from, to);
|
||||
return result;
|
||||
function getSensebotData(user, device, from, to) {
|
||||
if (stats['sonarData'] == null){
|
||||
stats['sonarData'] = [];
|
||||
}
|
||||
if (stats['motionData'] == null){
|
||||
stats['motionData'] = [];
|
||||
}
|
||||
if (stats['lightData'] == null){
|
||||
stats['lightData'] = [];
|
||||
}
|
||||
if (stats['temperatureData'] == null){
|
||||
stats['temperatureData'] = [];
|
||||
}
|
||||
|
||||
//Uncomment below section to emulate data
|
||||
/*
|
||||
var timeInterval = 30;
|
||||
var i, rnd, chartData;
|
||||
chartData = [];
|
||||
var i = parseInt(from);
|
||||
while (i < parseInt(to)) {
|
||||
rnd = rnd = Math.random() * 50;
|
||||
chartData.push({time: i, value: rnd});
|
||||
i += timeInterval;
|
||||
}
|
||||
stats['sonarData'].push({"device": device.name, "stats" : chartData});
|
||||
chartData = [];
|
||||
var i = parseInt(from);
|
||||
while (i < parseInt(to)) {
|
||||
rnd = Math.round(Math.random());
|
||||
chartData.push({time: i, value: rnd});
|
||||
i += timeInterval;
|
||||
}
|
||||
stats['motionData'].push({"device": device.name, "stats" : chartData});
|
||||
chartData = [];
|
||||
var i = parseInt(from);
|
||||
while (i < parseInt(to)) {
|
||||
rnd = Math.round(Math.random());
|
||||
chartData.push({time: i, value: rnd});
|
||||
i += timeInterval;
|
||||
}
|
||||
stats['lightData'].push({"device": device.name, "stats" : chartData});
|
||||
chartData = [];
|
||||
var i = parseInt(from);
|
||||
while (i < parseInt(to)) {
|
||||
rnd = Math.random() * (27 - 24) + 24;
|
||||
chartData.push({time: i, value: rnd});
|
||||
i += timeInterval;
|
||||
}
|
||||
stats['temperatureData'].push({"device": device.name, "stats" : chartData});
|
||||
*/
|
||||
|
||||
//Comment below section to emulate data
|
||||
stats['sonarData'].push({"device": device.name, "stats" : getSensorData("SONAR_SENSOR_SUMMARY", "sonar", user, device.deviceIdentifier, from, to)});
|
||||
stats['motionData'].push({"device": device.name, "stats" : getSensorData("PIR_MOTION_SENSOR_SUMMARY", "motion", user, device.deviceIdentifier, from, to)});
|
||||
stats['lightData'].push({"device": device.name, "stats" : getSensorData("LDR_LIGHT_SENSOR_SUMMARY", "light", user, device.deviceIdentifier, from, to)});
|
||||
stats['temperatureData'].push({"device": device.name, "stats" : getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, device.deviceIdentifier, from, to)});
|
||||
}
|
||||
|
||||
function getAndroidSenseData(user, deviceId, from, to) {
|
||||
result = new Object();
|
||||
result['ramData'] = getSensorData("RAM_USAGE_SUMMARY", "motion", user, deviceId, from, to);
|
||||
result['cpuData'] = getSensorData("CPU_LOAD_SUMMARY", "light", user, deviceId, from, to);
|
||||
result['temperatureData'] = getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, deviceId, from, to);
|
||||
result['motionData'] = getSensorData("PIR_MOTION_SENSOR_SUMMARY", "motion", user, deviceId, from, to);
|
||||
return result;
|
||||
function getArduinoData(user, device, from, to) {
|
||||
if (stats['temperatureData'] == null){
|
||||
stats['temperatureData'] = [];
|
||||
}
|
||||
stats['temperatureData'].push({"device": device.name, "stats" : getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, device.deviceIdentifier, from, to)});
|
||||
}
|
||||
|
||||
function getDigitalDisplayData(user, deviceId, from, to) {
|
||||
result = new Object();
|
||||
result['ramData'] = getSensorData("RAM_USAGE_SUMMARY", "motion", user, deviceId, from, to);
|
||||
result['cpuData'] = getSensorData("CPU_LOAD_SUMMARY", "light", user, deviceId, from, to);
|
||||
result['cpuTemperatureData'] = getSensorData("DEVICE_CPU_TEMPERATURE_SUMMARY", "TEMPERATURE", user, deviceId, from, to);
|
||||
return result;
|
||||
function getAndroidSenseData(user, device, from, to) {
|
||||
if (stats['ramData'] == null){
|
||||
stats['ramData'] = [];
|
||||
}
|
||||
if (stats['cpuData'] == null){
|
||||
stats['cpuData'] = [];
|
||||
}
|
||||
if (stats['temperatureData'] == null){
|
||||
stats['temperatureData'] = [];
|
||||
}
|
||||
if (stats['motionData'] == null){
|
||||
stats['motionData'] = [];
|
||||
}
|
||||
stats['ramData'].push({"device": device.name, "stats" : getSensorData("RAM_USAGE_SUMMARY", "motion", user, device.deviceIdentifier, from, to)});
|
||||
stats['cpuData'].push({"device": device.name, "stats" : getSensorData("CPU_LOAD_SUMMARY", "light", user, device.deviceIdentifier, from, to)});
|
||||
stats['temperatureData'].push({"device": device.name, "stats" : getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, device.deviceIdentifier, from, to)});
|
||||
stats['motionData'].push({"device": device.name, "stats" : getSensorData("PIR_MOTION_SENSOR_SUMMARY", "motion", user, device.deviceIdentifier, from, to)});
|
||||
}
|
||||
|
||||
function getSensorData(table, column, user, deviceId, from, to) {
|
||||
function getDigitalDisplayData(user, device, from, to) {
|
||||
if (stats['ramData'] == null){
|
||||
stats['ramData'] = [];
|
||||
}
|
||||
if (stats['cpuData'] == null){
|
||||
stats['cpuData'] = [];
|
||||
}
|
||||
if (stats['cpuTemperatureData'] == null){
|
||||
stats['cpuTemperatureData'] = [];
|
||||
}
|
||||
stats['ramData'].push({"device": device.name, "stats" : getSensorData("RAM_USAGE_SUMMARY", "motion", user, device.deviceIdentifier, from, to)});
|
||||
stats['cpuData'].push({"device": device.name, "stats" : getSensorData("CPU_LOAD_SUMMARY", "light", user, device.deviceIdentifier, from, to)});
|
||||
stats['cpuTemperatureData'].push({"device": device.name, "stats" : getSensorData("DEVICE_CPU_TEMPERATURE_SUMMARY", "TEMPERATURE", user, device.deviceIdentifier, from, to)});
|
||||
}
|
||||
|
||||
function getSensorData(table, column, user, deviceIdentifier, from, to) {
|
||||
|
||||
var fetchedData = null;
|
||||
|
||||
try {
|
||||
fetchedData = statsClient.getDeviceStats(table, column, user, deviceId, from, to);
|
||||
fetchedData = statsClient.getDeviceStats(table, column, user, deviceIdentifier, from, to);
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
}
|
||||
|
||||
@ -42,13 +42,7 @@ if (uriMatcher.match("/{context}/api/user/login/")) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("User Logged In : " + user);
|
||||
}
|
||||
var hasDevcies = (deviceManagementService.getDevicesOfUser(username).size() >= 1);
|
||||
|
||||
if(hasDevcies){
|
||||
response.sendRedirect(constants.WEB_APP_CONTEXT+"/devices");
|
||||
}else{
|
||||
response.sendRedirect(constants.WEB_APP_CONTEXT);
|
||||
}
|
||||
response.sendRedirect(constants.WEB_APP_CONTEXT+"/dashboard");
|
||||
|
||||
}, function () {
|
||||
response.sendRedirect(dcProps.appContext + "login?#auth-failed");
|
||||
@ -139,6 +133,9 @@ if (uriMatcher.match("/{context}/api/user/login/")) {
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/users")) {
|
||||
result = userModule.getUsers();
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/users/count")) {
|
||||
result = userModule.getUsers().length;
|
||||
}
|
||||
|
||||
// returning the result.
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -83,7 +83,7 @@ var route;
|
||||
|
||||
var renderStatic = function (unit, path) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug('[' + requestId + '] for unit "' + unit + '" a request received for a static file "' + path + '"');
|
||||
//log.debug('[' + requestId + '] for unit "' + unit + '" a request received for a static file "' + path + '"');
|
||||
}
|
||||
var staticFile = fuse.getFile(unit, 'public' + path);
|
||||
if (staticFile.isExists() && !staticFile.isDirectory()) {
|
||||
@ -149,9 +149,9 @@ var route;
|
||||
if (layout !== null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
'[' + requestId + '] request for "' + path + '" will be rendered using layout "' +
|
||||
layout + '" (defined in "' + mainUnit + '") and zones ' +
|
||||
stringify(zones)
|
||||
//'[' + requestId + '] request for "' + path + '" will be rendered using layout "' +
|
||||
//layout + '" (defined in "' + mainUnit + '") and zones ' +
|
||||
//stringify(zones)
|
||||
);
|
||||
}
|
||||
|
||||
@ -161,9 +161,9 @@ var route;
|
||||
return true;
|
||||
} else {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
'[' + requestId + '] request for "' + path + '" will can\'t be rendered, since no layout is defined' +
|
||||
'in any of the units ' + stringify(zones));
|
||||
//log.debug(
|
||||
// '[' + requestId + '] request for "' + path + '" will can\'t be rendered, since no layout is defined' +
|
||||
// 'in any of the units ' + stringify(zones));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -181,7 +181,7 @@ var route;
|
||||
function renderLess(unit, path) {
|
||||
//TODO: fix - incorrect less files makes it respond the old less even if it is nocahce.
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug('[' + requestId + '] for unit "' + unit + '" a request received for a less file "' + path + '"');
|
||||
//log.debug('[' + requestId + '] for unit "' + unit + '" a request received for a less file "' + path + '"');
|
||||
}
|
||||
var cacheKey = '/tmp/cached_' + unit + path.replace(/[^\w\.-]/g, '_');
|
||||
fuseState.currentUnit = unit;
|
||||
@ -197,7 +197,7 @@ var route;
|
||||
var x = require('less-rhino-1.7.5.js');
|
||||
x.compile([lessFile.getPath(), cacheKey]);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug('[' + requestId + '] for unit "' + unit + '" request for "' + path + '" is cached as "' + cacheKey + '"');
|
||||
//log.debug('[' + requestId + '] for unit "' + unit + '" request for "' + path + '" is cached as "' + cacheKey + '"');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<%
|
||||
var getPath = File.prototype.getPath;
|
||||
File.prototype.getPath = function() {
|
||||
var path = getPath.call(this);
|
||||
path = path.replace(/\\/g, '/');
|
||||
return path;
|
||||
};
|
||||
<!--var getPath = File.prototype.getPath;-->
|
||||
<!--File.prototype.getPath = function() {-->
|
||||
<!--var path = getPath.call(this);-->
|
||||
<!--path = path.replace(/\\/g, '/');-->
|
||||
<!--return path;-->
|
||||
<!--};-->
|
||||
|
||||
//global object to pass request stat among fuse framework files.
|
||||
var fuseState = {
|
||||
@ -14,14 +14,14 @@ var fuseState = {
|
||||
currentUnit: null
|
||||
};
|
||||
|
||||
var requestId = function makeId() {
|
||||
var text = "";
|
||||
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
for (var i = 0; i < 5; i++)
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
<!--var requestId = function makeId() {-->
|
||||
<!--var text = "";-->
|
||||
<!--var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";-->
|
||||
<!--for (var i = 0; i < 5; i++)-->
|
||||
<!--text += possible.charAt(Math.floor(Math.random() * possible.length));-->
|
||||
|
||||
return text;
|
||||
}();
|
||||
<!--return text;-->
|
||||
<!--}();-->
|
||||
var fuseDebug = false;
|
||||
//var fuseDebug = true;
|
||||
|
||||
|
||||
@ -93,10 +93,10 @@ var getHbsFile, getFile, toRelativePath, cleanupAncestors,
|
||||
layout = model.layout;
|
||||
mainUnit = model.name;
|
||||
} else {
|
||||
log.warn(
|
||||
'[' + requestId + '] multiple layouts ' + mainUnit + ':' +
|
||||
layout + ' vs ' + model.name + ':' + model.layout
|
||||
);
|
||||
//log.warn(
|
||||
// '[' + requestId + '] multiple layouts ' + mainUnit + ':' +
|
||||
// layout + ' vs ' + model.name + ':' + model.layout
|
||||
//);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -152,8 +152,8 @@ var getHbsFile, getFile, toRelativePath, cleanupAncestors,
|
||||
initLookUp(definitions);
|
||||
var model = definitions[lookUpTable[unit]];
|
||||
if (!model) {
|
||||
log.warn('[' + requestId + '] unit "' + unit + '" does not exits');
|
||||
throw '[' + requestId + '] unit "' + unit + '" does not exits';
|
||||
//log.warn('[' + requestId + '] unit "' + unit + '" does not exits');
|
||||
//throw '[' + requestId + '] unit "' + unit + '" does not exits';
|
||||
}
|
||||
return model;
|
||||
};
|
||||
@ -219,7 +219,7 @@ var getHbsFile, getFile, toRelativePath, cleanupAncestors,
|
||||
|
||||
var path = definitionFile.getPath();
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug('[' + requestId + '] reading file "' + path + '"');
|
||||
//log.debug('[' + requestId + '] reading file "' + path + '"');
|
||||
}
|
||||
unitModel.definition = require(path);
|
||||
|
||||
@ -351,10 +351,10 @@ var getHbsFile, getFile, toRelativePath, cleanupAncestors,
|
||||
while (len--) {
|
||||
if (toDelete[units[len]]) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
'[' + requestId + '] unit "' + units[len] +
|
||||
'" is overridden by "' + toDelete[units[len]] + '"'
|
||||
);
|
||||
//log.debug(
|
||||
// '[' + requestId + '] unit "' + units[len] +
|
||||
// '" is overridden by "' + toDelete[units[len]] + '"'
|
||||
//);
|
||||
}
|
||||
units.splice(len, 1);
|
||||
}
|
||||
@ -412,10 +412,10 @@ var getHbsFile, getFile, toRelativePath, cleanupAncestors,
|
||||
var selfFile = new File(getUnitPath(unitName) + slashPath + selfFileName);
|
||||
if (selfFile.isExists()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
'[' + requestId + '] for unit "' + unitName + '" file resolved : "'
|
||||
+ slashPath + selfFileName + '" -> "' + selfFile.getPath() + '"'
|
||||
);
|
||||
//log.debug(
|
||||
// '[' + requestId + '] for unit "' + unitName + '" file resolved : "'
|
||||
// + slashPath + selfFileName + '" -> "' + selfFile.getPath() + '"'
|
||||
//);
|
||||
}
|
||||
|
||||
return selfFile;
|
||||
@ -434,19 +434,19 @@ var getHbsFile, getFile, toRelativePath, cleanupAncestors,
|
||||
var file = new File(getUnitPath(ancestorName) + slashPath + fileName);
|
||||
if (file.isExists()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
'[' + requestId + '] for unit "' + unitName + '" file resolved : "'
|
||||
+ slashPath + selfFileName + '" -> "' + file.getPath() + '"'
|
||||
);
|
||||
//log.debug(
|
||||
// '[' + requestId + '] for unit "' + unitName + '" file resolved : "'
|
||||
// + slashPath + selfFileName + '" -> "' + file.getPath() + '"'
|
||||
//);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
'[' + requestId + '] for unit "' + unitName + '" (non-excising) file resolved : "'
|
||||
+ slashPath + selfFileName + '" -> "' + selfFile.getPath() + '"'
|
||||
);
|
||||
//log.debug(
|
||||
// '[' + requestId + '] for unit "' + unitName + '" (non-excising) file resolved : "'
|
||||
// + slashPath + selfFileName + '" -> "' + selfFile.getPath() + '"'
|
||||
//);
|
||||
}
|
||||
return selfFile;
|
||||
};
|
||||
|
||||
@ -29,8 +29,8 @@ var getScope = function (unit,configs) {
|
||||
//a warning as the unit author may have forgotten to return a data object
|
||||
if(cbResult===undefined){
|
||||
cbResult = {}; //Give an empty data object
|
||||
log.warn('[' + requestId + '] unit "' + unit + '" has a onRequest method which does not return a value.This may lead to the '
|
||||
+'unit not been rendered correctly.');
|
||||
//log.warn('[' + requestId + '] unit "' + unit + '" has a onRequest method which does not return a value.This may lead to the '
|
||||
// +'unit not been rendered correctly.');
|
||||
}
|
||||
viewModel = cbResult;
|
||||
}
|
||||
@ -72,7 +72,7 @@ Handlebars.registerHelper('defineZone', function (zoneName, zoneContent) {
|
||||
var unit = unitsToRender[i];
|
||||
if (Handlebars.innerZonesFromUnit == null || Handlebars.innerZonesFromUnit.unitName == unit.unitName) {
|
||||
var template = fuse.getFile(unit.originUnitName || unit.unitName, '', '.hbs');
|
||||
log.debug('[' + requestId + '] for zone "' + zone + '" including template :"' + template.getPath() + '"');
|
||||
//log.debug('[' + requestId + '] for zone "' + zone + '" including template :"' + template.getPath() + '"');
|
||||
result += Handlebars.compileFile(template)(getScope(unit.unitName, zoneContent.data.root));
|
||||
}
|
||||
}
|
||||
@ -157,7 +157,7 @@ Handlebars.registerHelper('unit', function (unitName,options) {
|
||||
//TODO warn when unspecified decencies are included.
|
||||
fuseState.currentZone.push('main');
|
||||
var template = fuse.getFile(baseUnit, '', '.hbs');
|
||||
log.debug('[' + requestId + '] including "' + baseUnit + '"'+" with configs "+stringify(templateConfigs));
|
||||
//log.debug('[' + requestId + '] including "' + baseUnit + '"'+" with configs "+stringify(templateConfigs));
|
||||
var result = new Handlebars.SafeString(Handlebars.compileFile(template)(getScope(baseUnit,templateConfigs)));
|
||||
fuseState.currentZone.pop();
|
||||
return result;
|
||||
@ -176,7 +176,7 @@ Handlebars.compileFile = function (file) {
|
||||
}
|
||||
|
||||
f.open('r');
|
||||
log.debug('[' + requestId + '] reading file "' + f.getPath() + '"');
|
||||
//log.debug('[' + requestId + '] reading file "' + f.getPath() + '"');
|
||||
var content = f.readAll().trim();
|
||||
f.close();
|
||||
var compiled = Handlebars.compile(content);
|
||||
|
||||
@ -14,7 +14,7 @@ function readFile(name) {
|
||||
var pathInfo = fuse.toRelativePath(name);
|
||||
f = fuse.getFile(pathInfo.unit, pathInfo.path);
|
||||
}
|
||||
log.debug('[' + requestId + '] opening less file : "' + f.getPath() + '"');
|
||||
//log.debug('[' + requestId + '] opening less file : "' + f.getPath() + '"');
|
||||
f.open('r');
|
||||
return f.readAll();
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ var WEB_APP_CONTEXT = "/iotserver";
|
||||
var USER_SESSION_KEY = "USER";
|
||||
var UNSPECIFIED = "Unspecified";
|
||||
var DEVICES_UNIT_PATH="/units/";
|
||||
var POLICY_REGISTRY_PATH="/_system/governance/policy_declarations/";
|
||||
|
||||
var DEVICE_IDENTIFIER = "deviceIdentifier";
|
||||
var DEVICE_NAME = "name";
|
||||
|
||||
@ -232,7 +232,7 @@ deviceModule = function () {
|
||||
deviceManagementService.addOperation(operationInstance, deviceList);
|
||||
};
|
||||
|
||||
privateMethods.getDevice = function (type, deviceId) {
|
||||
publicMethods.getDevice = function (type, deviceId) {
|
||||
var deviceIdentifier = new DeviceIdentifier();
|
||||
deviceIdentifier.setType(type);
|
||||
deviceIdentifier.setId(deviceId);
|
||||
@ -240,7 +240,7 @@ deviceModule = function () {
|
||||
};
|
||||
|
||||
publicMethods.viewDevice = function (type, deviceId) {
|
||||
var device = privateMethods.getDevice(type, deviceId);
|
||||
var device = publicMethods.getDevice(type, deviceId);
|
||||
if (device) {
|
||||
var propertiesList = DeviceManagerUtil.convertDevicePropertiesToMap(device.getProperties());
|
||||
var entries = propertiesList.entrySet();
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 eventModule;
|
||||
eventModule = function () {
|
||||
var log = new Log("modules/event.js");
|
||||
|
||||
var constants = require("/modules/constants.js");
|
||||
var utility = require("/modules/utility.js").utility;
|
||||
|
||||
var publicMethods = {};
|
||||
var privateMethods = {};
|
||||
|
||||
var statsClient = new Packages.org.wso2.carbon.device.mgt.iot.common.analytics.statistics.IoTEventsStatisticsClient;
|
||||
|
||||
publicMethods.getEventsData = function (username, recordLimit) {
|
||||
var fetchedData = null;
|
||||
|
||||
try {
|
||||
fetchedData = statsClient.getRecentDeviceStats(username, recordLimit);
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
}
|
||||
|
||||
var eventsData = [];
|
||||
|
||||
// -- start of dummy data
|
||||
|
||||
var timeInterval = 30;
|
||||
var i, rnd;
|
||||
var currentDay = new Date();
|
||||
var startDate = currentDay.getTime() - (60 * 60 * 24 * 5);
|
||||
var endDate = currentDay.getTime();
|
||||
|
||||
var i = parseInt(startDate / 1000);
|
||||
while (i < parseInt(endDate / 1000)) {
|
||||
rnd = rnd = Math.random() * 50;
|
||||
eventsData.push({time: i*1000, deviceName: 'device' + rnd, activity:'Event number ' + rnd});
|
||||
i += timeInterval;
|
||||
}
|
||||
|
||||
// -- end of dummy data
|
||||
|
||||
// for (var i = 0; i < fetchedData.size(); i++) {
|
||||
// eventsData.push({
|
||||
// time: fetchedData.get(i).getTime(),
|
||||
// deviceName: fetchedData.get(i).getDeviceName(),
|
||||
// activity: fetchedData.get(i).getDeviceActivity()
|
||||
// });
|
||||
// };
|
||||
|
||||
return eventsData;
|
||||
};
|
||||
|
||||
|
||||
return publicMethods;
|
||||
}();
|
||||
|
||||
|
||||
155
modules/distribution/src/repository/jaggeryapps/iotserver/modules/policy.js
Normal file → Executable file
155
modules/distribution/src/repository/jaggeryapps/iotserver/modules/policy.js
Normal file → Executable file
@ -26,59 +26,128 @@ policyModule = function () {
|
||||
var publicMethods = {};
|
||||
var privateMethods = {};
|
||||
|
||||
publicMethods.addPolicy = function (name, deviceType, policyDefinition) {
|
||||
publicMethods.addPolicy = function (policyName, deviceType, policyDefinition, policyDescription) {
|
||||
if (policyName && deviceType) {
|
||||
|
||||
var carbonModule = require("carbon");
|
||||
var carbonServer = application.get("carbonServer");
|
||||
var options = {system: true};
|
||||
var carbonUser = session.get(constants.USER_SESSION_KEY);
|
||||
|
||||
var resource = {
|
||||
name: policyName,
|
||||
mediaType: 'text/plain',
|
||||
content: policyDefinition,
|
||||
description: policyDescription,
|
||||
properties:{owner: carbonUser.username}
|
||||
};
|
||||
|
||||
if (carbonUser) {
|
||||
options.tenantId = carbonUser.tenantId;
|
||||
var registry = new carbonModule.registry.Registry(carbonServer, options);
|
||||
log.info("########### Policy name : " + policyName);
|
||||
log.info("########### Policy type : " + deviceType);
|
||||
log.info("########### Policy Declaration : " + policyDefinition);
|
||||
log.info("########### Policy policyDescription: " + policyDescription);
|
||||
registry.put(constants.POLICY_REGISTRY_PATH + deviceType + "/" + policyName, resource);
|
||||
}
|
||||
|
||||
var mqttsenderClass = Packages.org.wso2.device.mgt.mqtt.policy.push.MqttPush;
|
||||
var mqttsender = new mqttsenderClass();
|
||||
|
||||
var result = mqttsender.pushToMQTT("/iot/policymgt/govern/" + deviceType + "/" + carbonUser.username, policyDefinition, "tcp://localhost:1883", "Raspberry-Policy-sender");
|
||||
|
||||
mqttsender = null;
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
publicMethods.getPolicies = function () {
|
||||
|
||||
//TODO-This method returns includes dummy policy data
|
||||
var carbonModule = require("carbon");
|
||||
var carbonServer = application.get("carbonServer");
|
||||
var options = {system: true};
|
||||
var carbonUser = session.get(constants.USER_SESSION_KEY);
|
||||
|
||||
var policies = [];
|
||||
var policyObj = {
|
||||
"id":1, // Identifier of the policy.
|
||||
"priorityId":1, // Priority of the policies. This will be used only for simple evaluation.
|
||||
"profile":{}, // Profile
|
||||
"policyName":"Turn off light", // Name of the policy.
|
||||
"generic":true, // If true, this should be applied to all related device.
|
||||
"roles":{}, // Roles which this policy should be applied.
|
||||
"ownershipType":{}, // Ownership type (COPE, BYOD, CPE)
|
||||
"devices":{}, // Individual devices this policy should be applied
|
||||
"users":{}, // Individual users this policy should be applied
|
||||
"Compliance":{},
|
||||
"policyCriterias":{},
|
||||
"startTime":283468236, // Start time to apply the policy.
|
||||
"endTime":283468236, // After this time policy will not be applied
|
||||
"startDate":"", // Start date to apply the policy
|
||||
"endDate":"", // After this date policy will not be applied.
|
||||
"tenantId":-1234,
|
||||
"profileId":1
|
||||
};
|
||||
|
||||
policies.push(policyObj);
|
||||
if (carbonUser) {
|
||||
options.tenantId = carbonUser.tenantId;
|
||||
var registry = new carbonModule.registry.Registry(carbonServer, options);
|
||||
var allPolicies = registry.get(constants.POLICY_REGISTRY_PATH);
|
||||
|
||||
policyObj = {
|
||||
"id":2, // Identifier of the policy.
|
||||
"priorityId":1, // Priority of the policies. This will be used only for simple evaluation.
|
||||
"profile":{}, // Profile
|
||||
"policyName":"Turn on Buzzer", // Name of the policy.
|
||||
"generic":false, // If true, this should be applied to all related device.
|
||||
"roles":{}, // Roles which this policy should be applied.
|
||||
"ownershipType":{}, // Ownership type (COPE, BYOD, CPE)
|
||||
"devices":{}, // Individual devices this policy should be applied
|
||||
"users":{}, // Individual users this policy should be applied
|
||||
"Compliance":{},
|
||||
"policyCriterias":{},
|
||||
"startTime":283468236, // Start time to apply the policy.
|
||||
"endTime":283468236, // After this time policy will not be applied
|
||||
"startDate":"", // Start date to apply the policy
|
||||
"endDate":"", // After this date policy will not be applied.
|
||||
"tenantId":-1234,
|
||||
"profileId":2
|
||||
};
|
||||
if (allPolicies) {
|
||||
|
||||
//loop through all device types
|
||||
for (var i = 0; i < allPolicies.content.length; i++) {
|
||||
var deviceType = allPolicies.content[i].replace(constants.POLICY_REGISTRY_PATH, "");
|
||||
var deviceTypePolicies = registry.get(allPolicies.content[i]);
|
||||
|
||||
//loop through policies
|
||||
for (var j = 0; j < deviceTypePolicies.content.length; j++) {
|
||||
var deviceTypePolicy = registry.get(deviceTypePolicies.content[j]);
|
||||
|
||||
if(stringify(registry.properties(deviceTypePolicies.content[j]).owner) != '["'+carbonUser.username+'"]'){
|
||||
//not owned by current user, skip it
|
||||
continue;
|
||||
}
|
||||
|
||||
var policyObj = {
|
||||
"id": deviceTypePolicy.uuid, // Identifier of the policy.
|
||||
//"priorityId": 1, // Priority of the policies. This will be used only for simple evaluation.
|
||||
//"profile": {}, // Profile
|
||||
"policyName": deviceTypePolicy.name, // Name of the policy.
|
||||
"updated": deviceTypePolicy.updated.time,
|
||||
"deviceType": deviceType
|
||||
//"generic": true, // If true, this should be applied to all related device.
|
||||
//"roles": {}, // Roles which this policy should be applied.
|
||||
//"ownershipType": {}, // Ownership type (COPE, BYOD, CPE)
|
||||
//"devices": {}, // Individual devices this policy should be applied
|
||||
//"users": {}, // Individual users this policy should be applied
|
||||
//"Compliance": {},
|
||||
//"policyCriterias": {},
|
||||
//"startTime": 283468236, // Start time to apply the policy.
|
||||
//"endTime": 283468236, // After this time policy will not be applied
|
||||
//"startDate": "", // Start date to apply the policy
|
||||
//"endDate": "", // After this date policy will not be applied.
|
||||
//"tenantId": -1234,
|
||||
//"profileId": 1
|
||||
};
|
||||
|
||||
policies.push(policyObj);
|
||||
}//end of policy loop
|
||||
}//end of device type policy loop
|
||||
}
|
||||
}
|
||||
|
||||
policies.push(policyObj);
|
||||
return policies;
|
||||
|
||||
};
|
||||
|
||||
publicMethods.removePolicy = function (name, deviceType) {
|
||||
var carbonModule = require("carbon");
|
||||
var carbonServer = application.get("carbonServer");
|
||||
var options = {system: true};
|
||||
var carbonUser = session.get(constants.USER_SESSION_KEY);
|
||||
var bool = false;
|
||||
|
||||
if (carbonUser) {
|
||||
options.tenantId = carbonUser.tenantId;
|
||||
var registry = new carbonModule.registry.Registry(carbonServer, options);
|
||||
log.info("########### Policy name : " + name);
|
||||
log.info("########### Policy type : " + deviceType);
|
||||
try {
|
||||
registry.remove(constants.POLICY_REGISTRY_PATH + deviceType + "/" + name);
|
||||
bool = true;
|
||||
} catch (err) {
|
||||
log.error("Error while trying to remove policy :" + name, err);
|
||||
}
|
||||
}
|
||||
|
||||
return bool;
|
||||
};
|
||||
|
||||
return publicMethods;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
{{authorized}}
|
||||
{{layout "fluid"}}
|
||||
{{#zone "title"}}
|
||||
WSO2 DC | FireAlarm
|
||||
WSO2 DC | Analytics
|
||||
{{/zone}}
|
||||
{{#zone "body"}}
|
||||
{{unit "appbar" link="analytics" title="Device Analytics"}}
|
||||
{{unit "appbar" link="analytics" title="Analytics"}}
|
||||
{{unit "analytics"}}
|
||||
{{/zone}}
|
||||
@ -4,6 +4,6 @@
|
||||
WSO2 DC | Device Cloud
|
||||
{{/zone}}
|
||||
{{#zone "body"}}
|
||||
{{unit "appbar"}}
|
||||
{{unit "appbar" title="Dashboard"}}
|
||||
{{unit "dashboard"}}
|
||||
{{/zone}}
|
||||
@ -0,0 +1,9 @@
|
||||
{{authorized}}
|
||||
{{layout "fluid"}}
|
||||
{{#zone "title"}}
|
||||
Events
|
||||
{{/zone}}
|
||||
{{#zone "body"}}
|
||||
{{unit "appbar" link="events" title="My Events"}}
|
||||
{{unit "events"}}
|
||||
{{/zone}}
|
||||
@ -5,7 +5,7 @@
|
||||
{{/zone}}
|
||||
{{#zone "body"}}
|
||||
{{unit "appbar" link="policies" title="My Policies"}}
|
||||
{{unit "extended-search-box"}}
|
||||
{{unit "extended-search-box" item="Policie"}}
|
||||
<div class="wr-device-list row">
|
||||
<div class="wr-hidden-operations wr-advance-operations">
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{{#zone "topCss"}}
|
||||
<!--<link href="{{self.publicURL}}/css/nv.d3.css" rel="stylesheet"/>-->
|
||||
<link href="{{self.publicURL}}/css/daterangepicker.css" rel="stylesheet"/>
|
||||
<link href="{{self.publicURL}}/css/graph.css" rel="stylesheet"/>
|
||||
<link href="{{self.publicURL}}/css/lines.css" rel="stylesheet"/>
|
||||
<link href="{{self.publicURL}}/css/legend.css" rel="stylesheet"/>
|
||||
<link href="{{self.publicURL}}/css/detail.css" rel="stylesheet"/>
|
||||
{{/zone}}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"predicate": "urlMatch('/devices/analytics')"
|
||||
"predicate": "urlMatch('/analytics')"
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
.rickshaw_graph .detail {
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
bottom: 0;
|
||||
width: 1px;
|
||||
transition: opacity 0.25s linear;
|
||||
-moz-transition: opacity 0.25s linear;
|
||||
-o-transition: opacity 0.25s linear;
|
||||
-webkit-transition: opacity 0.25s linear;
|
||||
}
|
||||
.rickshaw_graph .detail.inactive {
|
||||
opacity: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .item.active {
|
||||
opacity: 1;
|
||||
}
|
||||
.rickshaw_graph .detail .x_label {
|
||||
font-family: Arial, sans-serif;
|
||||
border-radius: 3px;
|
||||
padding: 6px;
|
||||
opacity: 0.5;
|
||||
border: 1px solid #e0e0e0;
|
||||
font-size: 12px;
|
||||
position: absolute;
|
||||
background: white;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.rickshaw_graph .detail .x_label.left {
|
||||
left: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .x_label.right {
|
||||
right: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .item {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
border-radius: 3px;
|
||||
padding: 0.25em;
|
||||
font-size: 12px;
|
||||
font-family: Arial, sans-serif;
|
||||
opacity: 0;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
color: white;
|
||||
border: 1px solid rgba(0, 0, 0, 0.4);
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
margin-top: -1em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.rickshaw_graph .detail .item.left {
|
||||
left: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .item.right {
|
||||
right: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .item.active {
|
||||
opacity: 1;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
.rickshaw_graph .detail .item:after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
|
||||
content: "";
|
||||
|
||||
border: 5px solid transparent;
|
||||
}
|
||||
.rickshaw_graph .detail .item.left:after {
|
||||
top: 1em;
|
||||
left: -5px;
|
||||
margin-top: -5px;
|
||||
border-right-color: rgba(0, 0, 0, 0.8);
|
||||
border-left-width: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .item.right:after {
|
||||
top: 1em;
|
||||
right: -5px;
|
||||
margin-top: -5px;
|
||||
border-left-color: rgba(0, 0, 0, 0.8);
|
||||
border-right-width: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .dot {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
margin-left: -3px;
|
||||
margin-top: -3.5px;
|
||||
border-radius: 5px;
|
||||
position: absolute;
|
||||
box-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
|
||||
box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
background: white;
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
display: none;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
.rickshaw_graph .detail .dot.active {
|
||||
display: block;
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
position: relative;
|
||||
}
|
||||
.rickshaw_graph svg {
|
||||
display: block;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
opacity: 0.5;
|
||||
white-space: nowrap;
|
||||
margin-left: 3px;
|
||||
bottom: 1px;
|
||||
bottom: -20px;
|
||||
}
|
||||
|
||||
/* annotations */
|
||||
@ -151,7 +151,7 @@
|
||||
.rickshaw_graph .y_ticks.glow text {
|
||||
fill: black;
|
||||
color: black;
|
||||
text-shadow:
|
||||
text-shadow:
|
||||
-1px 1px 0 rgba(255, 255, 255, 0.1),
|
||||
1px -1px 0 rgba(255, 255, 255, 0.1),
|
||||
1px 1px 0 rgba(255, 255, 255, 0.1),
|
||||
@ -165,7 +165,7 @@
|
||||
.rickshaw_graph .y_ticks.inverse text {
|
||||
fill: white;
|
||||
color: white;
|
||||
text-shadow:
|
||||
text-shadow:
|
||||
-1px 1px 0 rgba(0, 0, 0, 0.8),
|
||||
1px -1px 0 rgba(0, 0, 0, 0.8),
|
||||
1px 1px 0 rgba(0, 0, 0, 0.8),
|
||||
@ -187,11 +187,11 @@
|
||||
}
|
||||
|
||||
.custom_slider {
|
||||
left: 40px;
|
||||
left: 40px;
|
||||
}
|
||||
|
||||
.custom_x_axis {
|
||||
position: relative;
|
||||
left: 40px;
|
||||
height: 40px;
|
||||
height: 30px;
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
.rickshaw_legend {
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
color: white;
|
||||
background: #404040;
|
||||
display: inline-block;
|
||||
padding: 12px 5px;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
float: right;
|
||||
}
|
||||
.rickshaw_legend:hover {
|
||||
z-index: 10;
|
||||
}
|
||||
.rickshaw_legend .swatch {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.rickshaw_legend .line {
|
||||
clear: both;
|
||||
line-height: 140%;
|
||||
padding-right: 15px;
|
||||
}
|
||||
.rickshaw_legend .line .swatch {
|
||||
display: inline-block;
|
||||
margin-right: 3px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.rickshaw_legend .label {
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
display: inline;
|
||||
font-size: inherit;
|
||||
background-color: transparent;
|
||||
color: inherit;
|
||||
font-weight: normal;
|
||||
line-height: normal;
|
||||
padding: 0px;
|
||||
text-shadow: none;
|
||||
}
|
||||
.rickshaw_legend .action:hover {
|
||||
opacity: 0.6;
|
||||
}
|
||||
.rickshaw_legend .action {
|
||||
margin-right: 0.2em;
|
||||
font-size: 10px;
|
||||
opacity: 0.2;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
.rickshaw_legend .line.disabled {
|
||||
opacity: 0.4;
|
||||
}
|
||||
.rickshaw_legend ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
margin: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rickshaw_legend li {
|
||||
padding: 0 0 0 2px;
|
||||
min-width: 80px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.rickshaw_legend li:hover {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border-radius: 3px;
|
||||
}
|
||||
.rickshaw_legend li:active {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 3px;
|
||||
}
|
||||
.legend {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
left: 8px;
|
||||
}
|
||||
.legend_container {
|
||||
float: right;
|
||||
padding-right: 10px;
|
||||
width: 0;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
opacity: 0.7;
|
||||
}
|
||||
@ -1,3 +1,6 @@
|
||||
div, span, p, td {
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
#chart {
|
||||
display: inline-block;
|
||||
}
|
||||
@ -15,4 +18,4 @@
|
||||
#chart_container {
|
||||
float: left;
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
@ -1,641 +0,0 @@
|
||||
/* nvd3 version 1.8.1 (https://github.com/novus/nvd3) 2015-06-17 */
|
||||
.nvd3 .nv-axis {
|
||||
pointer-events:none;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis path {
|
||||
fill: none;
|
||||
stroke: #000;
|
||||
stroke-opacity: .75;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis path.domain {
|
||||
stroke-opacity: .75;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis.nv-x path.domain {
|
||||
stroke-opacity: 0;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis line {
|
||||
fill: none;
|
||||
stroke: #e5e5e5;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis .zero line,
|
||||
/*this selector may not be necessary*/ .nvd3 .nv-axis line.zero {
|
||||
stroke-opacity: .75;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis .nv-axisMaxMin text {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.nvd3 .x .nv-axis .nv-axisMaxMin text,
|
||||
.nvd3 .x2 .nv-axis .nv-axisMaxMin text,
|
||||
.nvd3 .x3 .nv-axis .nv-axisMaxMin text {
|
||||
text-anchor: middle
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis.nv-disabled {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.nvd3 .nv-bars rect {
|
||||
fill-opacity: .75;
|
||||
|
||||
transition: fill-opacity 250ms linear;
|
||||
-moz-transition: fill-opacity 250ms linear;
|
||||
-webkit-transition: fill-opacity 250ms linear;
|
||||
}
|
||||
|
||||
.nvd3 .nv-bars rect.hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3 .nv-bars .hover rect {
|
||||
fill: lightblue;
|
||||
}
|
||||
|
||||
.nvd3 .nv-bars text {
|
||||
fill: rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
.nvd3 .nv-bars .hover text {
|
||||
fill: rgba(0,0,0,1);
|
||||
}
|
||||
|
||||
.nvd3 .nv-multibar .nv-groups rect,
|
||||
.nvd3 .nv-multibarHorizontal .nv-groups rect,
|
||||
.nvd3 .nv-discretebar .nv-groups rect {
|
||||
stroke-opacity: 0;
|
||||
|
||||
transition: fill-opacity 250ms linear;
|
||||
-moz-transition: fill-opacity 250ms linear;
|
||||
-webkit-transition: fill-opacity 250ms linear;
|
||||
}
|
||||
|
||||
.nvd3 .nv-multibar .nv-groups rect:hover,
|
||||
.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,
|
||||
.nvd3 .nv-candlestickBar .nv-ticks rect:hover,
|
||||
.nvd3 .nv-discretebar .nv-groups rect:hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3 .nv-discretebar .nv-groups text,
|
||||
.nvd3 .nv-multibarHorizontal .nv-groups text {
|
||||
font-weight: bold;
|
||||
fill: rgba(0,0,0,1);
|
||||
stroke: rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
/* boxplot CSS */
|
||||
.nvd3 .nv-boxplot circle {
|
||||
fill-opacity: 0.5;
|
||||
}
|
||||
|
||||
.nvd3 .nv-boxplot circle:hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3 .nv-boxplot rect:hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3 line.nv-boxplot-median {
|
||||
stroke: black;
|
||||
}
|
||||
|
||||
.nv-boxplot-tick:hover {
|
||||
stroke-width: 2.5px;
|
||||
}
|
||||
/* bullet */
|
||||
.nvd3.nv-bullet { font: 10px sans-serif; }
|
||||
.nvd3.nv-bullet .nv-measure { fill-opacity: .8; }
|
||||
.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; }
|
||||
.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; }
|
||||
.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; }
|
||||
.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; }
|
||||
.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; }
|
||||
.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; }
|
||||
.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; }
|
||||
.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; }
|
||||
.nvd3.nv-bullet .nv-subtitle { fill: #999; }
|
||||
|
||||
|
||||
.nvd3.nv-bullet .nv-range {
|
||||
fill: #bababa;
|
||||
fill-opacity: .4;
|
||||
}
|
||||
.nvd3.nv-bullet .nv-range:hover {
|
||||
fill-opacity: .7;
|
||||
}
|
||||
|
||||
.nvd3.nv-candlestickBar .nv-ticks .nv-tick {
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover {
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect {
|
||||
stroke: #2ca02c;
|
||||
fill: #2ca02c;
|
||||
}
|
||||
|
||||
.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect {
|
||||
stroke: #d62728;
|
||||
fill: #d62728;
|
||||
}
|
||||
|
||||
.with-transitions .nv-candlestickBar .nv-ticks .nv-tick {
|
||||
transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
|
||||
}
|
||||
|
||||
.nvd3.nv-candlestickBar .nv-ticks line {
|
||||
stroke: #333;
|
||||
}
|
||||
|
||||
|
||||
.nvd3 .nv-legend .nv-disabled rect {
|
||||
/*fill-opacity: 0;*/
|
||||
}
|
||||
|
||||
.nvd3 .nv-check-box .nv-box {
|
||||
fill-opacity:0;
|
||||
stroke-width:2;
|
||||
}
|
||||
|
||||
.nvd3 .nv-check-box .nv-check {
|
||||
fill-opacity:0;
|
||||
stroke-width:4;
|
||||
}
|
||||
|
||||
.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check {
|
||||
fill-opacity:0;
|
||||
stroke-opacity:0;
|
||||
}
|
||||
|
||||
.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* line plus bar */
|
||||
.nvd3.nv-linePlusBar .nv-bar rect {
|
||||
fill-opacity: .75;
|
||||
}
|
||||
|
||||
.nvd3.nv-linePlusBar .nv-bar rect:hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
.nvd3 .nv-groups path.nv-line {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.nvd3 .nv-groups path.nv-area {
|
||||
stroke: none;
|
||||
}
|
||||
|
||||
.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point {
|
||||
fill-opacity: 0;
|
||||
stroke-opacity: 0;
|
||||
}
|
||||
|
||||
.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point {
|
||||
fill-opacity: .5 !important;
|
||||
stroke-opacity: .5 !important;
|
||||
}
|
||||
|
||||
|
||||
.with-transitions .nvd3 .nv-groups .nv-point {
|
||||
transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
|
||||
}
|
||||
|
||||
.nvd3.nv-scatter .nv-groups .nv-point.hover,
|
||||
.nvd3 .nv-groups .nv-point.hover {
|
||||
stroke-width: 7px;
|
||||
fill-opacity: .95 !important;
|
||||
stroke-opacity: .95 !important;
|
||||
}
|
||||
|
||||
|
||||
.nvd3 .nv-point-paths path {
|
||||
stroke: #aaa;
|
||||
stroke-opacity: 0;
|
||||
fill: #eee;
|
||||
fill-opacity: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.nvd3 .nv-indexLine {
|
||||
cursor: ew-resize;
|
||||
}
|
||||
|
||||
/********************
|
||||
* SVG CSS
|
||||
*/
|
||||
|
||||
/********************
|
||||
Default CSS for an svg element nvd3 used
|
||||
*/
|
||||
svg.nvd3-svg {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
display: block;
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
/********************
|
||||
Box shadow and border radius styling
|
||||
*/
|
||||
.nvtooltip.with-3d-shadow, .with-3d-shadow .nvtooltip {
|
||||
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
|
||||
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
|
||||
box-shadow: 0 5px 10px rgba(0,0,0,.2);
|
||||
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
|
||||
.nvd3 text {
|
||||
font: normal 12px Arial;
|
||||
}
|
||||
|
||||
.nvd3 .title {
|
||||
font: bold 14px Arial;
|
||||
}
|
||||
|
||||
.nvd3 .nv-background {
|
||||
fill: white;
|
||||
fill-opacity: 0;
|
||||
}
|
||||
|
||||
.nvd3.nv-noData {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
/**********
|
||||
* Brush
|
||||
*/
|
||||
|
||||
.nv-brush .extent {
|
||||
fill-opacity: .125;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.nv-brush .resize path {
|
||||
fill: #eee;
|
||||
stroke: #666;
|
||||
}
|
||||
|
||||
|
||||
/**********
|
||||
* Legend
|
||||
*/
|
||||
|
||||
.nvd3 .nv-legend .nv-series {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.nvd3 .nv-legend .nv-disabled circle {
|
||||
fill-opacity: 0;
|
||||
}
|
||||
|
||||
/* focus */
|
||||
.nvd3 .nv-brush .extent {
|
||||
fill-opacity: 0 !important;
|
||||
}
|
||||
|
||||
.nvd3 .nv-brushBackground rect {
|
||||
stroke: #000;
|
||||
stroke-width: .4;
|
||||
fill: #fff;
|
||||
fill-opacity: .7;
|
||||
}
|
||||
|
||||
|
||||
.nvd3.nv-ohlcBar .nv-ticks .nv-tick {
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover {
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive {
|
||||
stroke: #2ca02c;
|
||||
}
|
||||
|
||||
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative {
|
||||
stroke: #d62728;
|
||||
}
|
||||
|
||||
|
||||
.nvd3 .background path {
|
||||
fill: none;
|
||||
stroke: #EEE;
|
||||
stroke-opacity: .4;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.nvd3 .foreground path {
|
||||
fill: none;
|
||||
stroke-opacity: .7;
|
||||
}
|
||||
|
||||
.nvd3 .nv-parallelCoordinates-brush .extent
|
||||
{
|
||||
fill: #fff;
|
||||
fill-opacity: .6;
|
||||
stroke: gray;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.nvd3 .nv-parallelCoordinates .hover {
|
||||
fill-opacity: 1;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
|
||||
.nvd3 .missingValuesline line {
|
||||
fill: none;
|
||||
stroke: black;
|
||||
stroke-width: 1;
|
||||
stroke-opacity: 1;
|
||||
stroke-dasharray: 5, 5;
|
||||
}
|
||||
.nvd3.nv-pie path {
|
||||
stroke-opacity: 0;
|
||||
transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
|
||||
}
|
||||
|
||||
.nvd3.nv-pie .nv-pie-title {
|
||||
font-size: 24px;
|
||||
fill: rgba(19, 196, 249, 0.59);
|
||||
}
|
||||
|
||||
.nvd3.nv-pie .nv-slice text {
|
||||
stroke: #000;
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.nvd3.nv-pie path {
|
||||
stroke: #fff;
|
||||
stroke-width: 1px;
|
||||
stroke-opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3.nv-pie .hover path {
|
||||
fill-opacity: .7;
|
||||
}
|
||||
.nvd3.nv-pie .nv-label {
|
||||
pointer-events: none;
|
||||
}
|
||||
.nvd3.nv-pie .nv-label rect {
|
||||
fill-opacity: 0;
|
||||
stroke-opacity: 0;
|
||||
}
|
||||
|
||||
/* scatter */
|
||||
.nvd3 .nv-groups .nv-point.hover {
|
||||
stroke-width: 20px;
|
||||
stroke-opacity: .5;
|
||||
}
|
||||
|
||||
.nvd3 .nv-scatter .nv-point.hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
.nv-noninteractive {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.nv-distx, .nv-disty {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* sparkline */
|
||||
.nvd3.nv-sparkline path {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus g.nv-hoverValue {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-hoverValue line {
|
||||
stroke: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus,
|
||||
.nvd3.nv-sparklineplus g {
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
.nvd3 .nv-hoverArea {
|
||||
fill-opacity: 0;
|
||||
stroke-opacity: 0;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-xValue,
|
||||
.nvd3.nv-sparklineplus .nv-yValue {
|
||||
stroke-width: 0;
|
||||
font-size: .9em;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-yValue {
|
||||
stroke: #f66;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-maxValue {
|
||||
stroke: #2ca02c;
|
||||
fill: #2ca02c;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-minValue {
|
||||
stroke: #d62728;
|
||||
fill: #d62728;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-currentValue {
|
||||
font-weight: bold;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
/* stacked area */
|
||||
.nvd3.nv-stackedarea path.nv-area {
|
||||
fill-opacity: .7;
|
||||
stroke-opacity: 0;
|
||||
transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
|
||||
-moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
|
||||
-webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
|
||||
}
|
||||
|
||||
.nvd3.nv-stackedarea path.nv-area.hover {
|
||||
fill-opacity: .9;
|
||||
}
|
||||
|
||||
|
||||
.nvd3.nv-stackedarea .nv-groups .nv-point {
|
||||
stroke-opacity: 0;
|
||||
fill-opacity: 0;
|
||||
}
|
||||
|
||||
|
||||
.nvtooltip {
|
||||
position: absolute;
|
||||
background-color: rgba(255,255,255,1.0);
|
||||
color: rgba(0,0,0,1.0);
|
||||
padding: 1px;
|
||||
border: 1px solid rgba(0,0,0,.2);
|
||||
z-index: 10000;
|
||||
display: block;
|
||||
|
||||
font-family: Arial;
|
||||
font-size: 13px;
|
||||
text-align: left;
|
||||
pointer-events: none;
|
||||
|
||||
white-space: nowrap;
|
||||
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.nvtooltip {
|
||||
background: rgba(255,255,255, 0.8);
|
||||
border: 1px solid rgba(0,0,0,0.5);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/*Give tooltips that old fade in transition by
|
||||
putting a "with-transitions" class on the container div.
|
||||
*/
|
||||
.nvtooltip.with-transitions, .with-transitions .nvtooltip {
|
||||
transition: opacity 50ms linear;
|
||||
-moz-transition: opacity 50ms linear;
|
||||
-webkit-transition: opacity 50ms linear;
|
||||
|
||||
transition-delay: 200ms;
|
||||
-moz-transition-delay: 200ms;
|
||||
-webkit-transition-delay: 200ms;
|
||||
}
|
||||
|
||||
.nvtooltip.x-nvtooltip,
|
||||
.nvtooltip.y-nvtooltip {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.nvtooltip h3 {
|
||||
margin: 0;
|
||||
padding: 4px 14px;
|
||||
line-height: 18px;
|
||||
font-weight: normal;
|
||||
background-color: rgba(247,247,247,0.75);
|
||||
color: rgba(0,0,0,1.0);
|
||||
text-align: center;
|
||||
|
||||
border-bottom: 1px solid #ebebeb;
|
||||
|
||||
-webkit-border-radius: 5px 5px 0 0;
|
||||
-moz-border-radius: 5px 5px 0 0;
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
.nvtooltip p {
|
||||
margin: 0;
|
||||
padding: 5px 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nvtooltip span {
|
||||
display: inline-block;
|
||||
margin: 2px 0;
|
||||
}
|
||||
|
||||
.nvtooltip table {
|
||||
margin: 6px;
|
||||
border-spacing:0;
|
||||
}
|
||||
|
||||
|
||||
.nvtooltip table td {
|
||||
padding: 2px 9px 2px 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.nvtooltip table td.key {
|
||||
font-weight:normal;
|
||||
}
|
||||
.nvtooltip table td.value {
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.nvtooltip table tr.highlight td {
|
||||
padding: 1px 9px 1px 0;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
.nvtooltip table td.legend-color-guide div {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.nvtooltip table td.legend-color-guide div {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
.nvtooltip .footer {
|
||||
padding: 3px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nvtooltip-pending-removal {
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/****
|
||||
Interactive Layer
|
||||
*/
|
||||
.nvd3 .nv-interactiveGuideLine {
|
||||
pointer-events:none;
|
||||
}
|
||||
.nvd3 line.nv-guideline {
|
||||
stroke: #ccc;
|
||||
}
|
||||
@ -1,13 +1,14 @@
|
||||
{{#zone "main"}}
|
||||
<span id="request-group-id" data-groupid="{{groupId}}"></span>
|
||||
<div class="container container-bg white-bg">
|
||||
<div class=" margin-top-double">
|
||||
<div class="row row padding-top-double padding-bottom-double margin-bottom-double ">
|
||||
<div class="col-lg-12 margin-top-double">
|
||||
<h1 class="grey ">Device Statistics</h1>
|
||||
<h1 class="grey ">{{title}}</h1>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<div id="rangeSliderWrapper" class="pull-right" style="width: 550px;">
|
||||
<div id="rangeSliderWrapper" class="pull-right" style="width: 620px;">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div id="dateRangePickerContainer">
|
||||
@ -15,14 +16,14 @@
|
||||
<button id="hour-btn" type="button"
|
||||
class="btn btn-default date-range">Hour
|
||||
</button>
|
||||
<button id="today-btn" type="button"
|
||||
class="btn btn-default date-range">Day
|
||||
<button id="h12-btn" type="button"
|
||||
class="btn btn-default date-range">12 Hours
|
||||
</button>
|
||||
<button id="week-btn" type="button"
|
||||
class="btn btn-default date-range">Week
|
||||
<button id="h24-btn" type="button"
|
||||
class="btn btn-default date-range">24 Hours
|
||||
</button>
|
||||
<button id="month-btn" type="button"
|
||||
class="btn btn-default date-range">Month
|
||||
<button id="h48-btn" type="button"
|
||||
class="btn btn-default date-range">48 Hours
|
||||
</button>
|
||||
<button id="date-range" type="button"
|
||||
class="btn btn-default date-range last-child"
|
||||
@ -58,19 +59,9 @@
|
||||
</div>
|
||||
{{/zone}}
|
||||
{{#zone "bottomLibJs"}}
|
||||
<script src="{{self.publicURL}}/js/d3.v3.js"></script>
|
||||
<script src="{{self.publicURL}}/js/d3.min.js"></script>
|
||||
<script src="{{self.publicURL}}/js/rickshaw.min.js"></script>
|
||||
<script src="{{self.publicURL}}/js/moment.min.js"></script>
|
||||
<script src="{{self.publicURL}}/js/jquery.daterangepicker.js"></script>
|
||||
<script src="{{self.publicURL}}/js/graph_util.js"></script>
|
||||
<script src="{{self.publicURL}}/js/bulb.js"></script>
|
||||
<script src="{{self.publicURL}}/js/graphs/fan_graph.js"></script>
|
||||
<script src="{{self.publicURL}}/js/graphs/bulb_graph.js"></script>
|
||||
<script src="{{self.publicURL}}/js/graphs/temperature_graph.js"></script>
|
||||
<script src="{{self.publicURL}}/js/graphs/light_graph.js"></script>
|
||||
<script src="{{self.publicURL}}/js/graphs/motion_graph.js"></script>
|
||||
<script src="{{self.publicURL}}/js/graphs/sonar_graph.js"></script>
|
||||
<script src="{{self.publicURL}}/js/graphs/cpu_graph.js"></script>
|
||||
<script src="{{self.publicURL}}/js/graphs/ram_graph.js"></script>
|
||||
<script src="{{self.publicURL}}/js/graphs/cpu_temperature_graph.js"></script>
|
||||
{{/zone}}
|
||||
@ -1,4 +1,18 @@
|
||||
function onRequest(context){
|
||||
context.sketchPath = "api/device/sketch";
|
||||
var groupId = request.getParameter("groupId");
|
||||
var title;
|
||||
if (groupId){
|
||||
context.groupId = groupId;
|
||||
title = request.getParameter("name");
|
||||
}else{
|
||||
context.groupId = 0;
|
||||
var deviceModule = require("/modules/device.js").deviceModule;
|
||||
var deviceId = request.getParameter("deviceId");
|
||||
var deviceType = request.getParameter("deviceType");
|
||||
|
||||
title = deviceModule.getDevice(deviceType, deviceId).name;
|
||||
}
|
||||
context.title = title + " Analytics";
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
@ -1,331 +0,0 @@
|
||||
.date-picker {
|
||||
width: 170px;
|
||||
height: 25px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
line-height: 25px;
|
||||
padding-left: 10px;
|
||||
font-size: 12px;
|
||||
font-family: Arial;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
color: #303030;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.date-picker-wrapper {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
border: 1px solid #bfbfbf;
|
||||
background-color: #efefef;
|
||||
width: 448px;
|
||||
padding: 5px 12px;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #aaa;
|
||||
font-family: Arial;
|
||||
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.date-picker-wrapper.single-date {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.date-picker-wrapper.no-shortcuts {
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .footer {
|
||||
display: none;
|
||||
font-size: 11px;
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
.date-picker-wrapper b {
|
||||
color: #666;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.date-picker-wrapper a {
|
||||
color: rgb(107, 180, 214);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper {
|
||||
border: 1px solid #bfbfbf;
|
||||
border-radius: 3px;
|
||||
background-color: #fff;
|
||||
padding: 5px;
|
||||
cursor: default;
|
||||
position: relative;
|
||||
_overflow: hidden;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table {
|
||||
width: 190px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table.month2 {
|
||||
width: 190px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table th,
|
||||
.date-picker-wrapper .month-wrapper table td {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
line-height: 14px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table .day {
|
||||
height: 19px;
|
||||
line-height: 19px;
|
||||
font-size: 12px;
|
||||
margin-bottom: 1px;
|
||||
color: #999;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table div.day.lastMonth,
|
||||
.date-picker-wrapper .month-wrapper table div.day.nextMonth {
|
||||
color: #999;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table .day.checked {
|
||||
background-color: rgb(156, 219, 247);
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table .week-name {
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table .day.has-tooltip {
|
||||
cursor: help !important;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table .day.toMonth.valid {
|
||||
color: #333;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table .day.real-today {
|
||||
background-color: rgb(255, 230, 132);
|
||||
}
|
||||
|
||||
.date-picker-wrapper .month-wrapper table .day.real-today.checked {
|
||||
background-color: rgb(112, 204, 213);
|
||||
}
|
||||
|
||||
.date-picker-wrapper table .caption {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.date-picker-wrapper table .caption .next,
|
||||
.date-picker-wrapper table .caption .prev {
|
||||
padding: 0 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.date-picker-wrapper table .caption .next:hover,
|
||||
.date-picker-wrapper table .caption .prev:hover {
|
||||
background-color: #ccc;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .gap {
|
||||
position: absolute;
|
||||
display: none;
|
||||
top: 0px;
|
||||
left: 204px;
|
||||
z-index: 1;
|
||||
width: 15px;
|
||||
height: 100%;
|
||||
background-color: red;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .gap .gap-lines {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .gap .gap-line {
|
||||
height: 15px;
|
||||
width: 15px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .gap .gap-line .gap-1 {
|
||||
z-index: 1;
|
||||
height: 0;
|
||||
border-left: 8px solid white;
|
||||
border-top: 8px solid #eee;
|
||||
border-bottom: 8px solid #eee;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .gap .gap-line .gap-2 {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0px;
|
||||
z-index: 2;
|
||||
height: 0;
|
||||
border-left: 8px solid transparent;
|
||||
border-top: 8px solid white;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .gap .gap-line .gap-3 {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 8px;
|
||||
z-index: 2;
|
||||
height: 0;
|
||||
border-left: 8px solid transparent;
|
||||
border-bottom: 8px solid white;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .gap .gap-top-mask {
|
||||
width: 6px;
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
left: 1px;
|
||||
background-color: #eee;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .gap .gap-bottom-mask {
|
||||
width: 6px;
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
bottom: -1px;
|
||||
left: 7px;
|
||||
background-color: #eee;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .selected-days {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .drp_top-bar {
|
||||
line-height: 40px;
|
||||
height: 40px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .drp_top-bar .error-top {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .drp_top-bar .normal-top {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .drp_top-bar .default-top {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .drp_top-bar.error .default-top {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .drp_top-bar.error .error-top {
|
||||
display: block;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .drp_top-bar.normal .default-top {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .drp_top-bar.normal .normal-top {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .drp_top-bar .apply-btn {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 6px;
|
||||
padding: 3px 5px;
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
|
||||
color: #d9eef7;
|
||||
border: solid 1px #0076a3;
|
||||
background: #0095cd;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
|
||||
background: -moz-linear-gradient(top, #00adee, #0078a5);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5');
|
||||
color: white;
|
||||
}
|
||||
|
||||
.date-picker-wrapper .drp_top-bar .apply-btn.disabled {
|
||||
pointer-events: none;
|
||||
color: #606060;
|
||||
border: solid 1px #b7b7b7;
|
||||
background: #fff;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
|
||||
background: -moz-linear-gradient(top, #fff, #ededed);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed');
|
||||
}
|
||||
|
||||
/*time styling*/
|
||||
.time {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.time input[type=range] {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.time1, .time2 {
|
||||
width: 180px;
|
||||
padding: 0 5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.time1 {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.time2 {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.hour, .minute {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
input.hour-range, input.minute-range {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#dateRangePickerContainer .date-range, #dateRangePickerContainer .input-append {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
#date-range{
|
||||
padding-right:30px;
|
||||
width:300px;
|
||||
height:100%;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
#dateRangePickerContainer{
|
||||
float:right;
|
||||
margin-top:-6px;
|
||||
}
|
||||
@ -1,197 +0,0 @@
|
||||
/* graph */
|
||||
|
||||
.rickshaw_graph {
|
||||
position: relative;
|
||||
}
|
||||
.rickshaw_graph svg {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ticks */
|
||||
|
||||
.rickshaw_graph .x_tick {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 0px;
|
||||
border-left: 1px dotted rgba(0, 0, 0, 0.2);
|
||||
pointer-events: none;
|
||||
}
|
||||
.rickshaw_graph .x_tick .title {
|
||||
position: absolute;
|
||||
font-size: 12px;
|
||||
font-family: Arial, sans-serif;
|
||||
opacity: 0.5;
|
||||
white-space: nowrap;
|
||||
margin-left: 3px;
|
||||
bottom: 1px;
|
||||
}
|
||||
|
||||
/* annotations */
|
||||
|
||||
.rickshaw_annotation_timeline {
|
||||
height: 1px;
|
||||
border-top: 1px solid #e0e0e0;
|
||||
margin-top: 10px;
|
||||
position: relative;
|
||||
}
|
||||
.rickshaw_annotation_timeline .annotation {
|
||||
position: absolute;
|
||||
height: 6px;
|
||||
width: 6px;
|
||||
margin-left: -2px;
|
||||
top: -3px;
|
||||
border-radius: 5px;
|
||||
background-color: rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.rickshaw_graph .annotation_line {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: -6px;
|
||||
width: 0px;
|
||||
border-left: 2px solid rgba(0, 0, 0, 0.3);
|
||||
display: none;
|
||||
}
|
||||
.rickshaw_graph .annotation_line.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.rickshaw_graph .annotation_range {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: -6px;
|
||||
}
|
||||
.rickshaw_graph .annotation_range.active {
|
||||
display: block;
|
||||
}
|
||||
.rickshaw_graph .annotation_range.active.offscreen {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.rickshaw_annotation_timeline .annotation .content {
|
||||
background: white;
|
||||
color: black;
|
||||
opacity: 0.9;
|
||||
padding: 5px 5px;
|
||||
box-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
z-index: 20;
|
||||
font-size: 12px;
|
||||
padding: 6px 8px 8px;
|
||||
top: 18px;
|
||||
left: -11px;
|
||||
width: 160px;
|
||||
display: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rickshaw_annotation_timeline .annotation .content:before {
|
||||
content: "\25b2";
|
||||
position: absolute;
|
||||
top: -11px;
|
||||
color: white;
|
||||
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
.rickshaw_annotation_timeline .annotation.active,
|
||||
.rickshaw_annotation_timeline .annotation:hover {
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
cursor: none;
|
||||
}
|
||||
.rickshaw_annotation_timeline .annotation .content:hover {
|
||||
z-index: 50;
|
||||
}
|
||||
.rickshaw_annotation_timeline .annotation.active .content {
|
||||
display: block;
|
||||
}
|
||||
.rickshaw_annotation_timeline .annotation:hover .content {
|
||||
display: block;
|
||||
z-index: 50;
|
||||
}
|
||||
.rickshaw_graph .y_axis,
|
||||
.rickshaw_graph .x_axis_d3 {
|
||||
fill: none;
|
||||
}
|
||||
.rickshaw_graph .y_ticks .tick line,
|
||||
.rickshaw_graph .x_ticks_d3 .tick {
|
||||
stroke: rgba(0, 0, 0, 0.16);
|
||||
stroke-width: 2px;
|
||||
shape-rendering: crisp-edges;
|
||||
pointer-events: none;
|
||||
}
|
||||
.rickshaw_graph .y_grid .tick,
|
||||
.rickshaw_graph .x_grid_d3 .tick {
|
||||
z-index: -1;
|
||||
stroke: rgba(0, 0, 0, 0.20);
|
||||
stroke-width: 1px;
|
||||
stroke-dasharray: 1 1;
|
||||
}
|
||||
.rickshaw_graph .y_grid .tick[data-y-value="0"] {
|
||||
stroke-dasharray: 1 0;
|
||||
}
|
||||
.rickshaw_graph .y_grid path,
|
||||
.rickshaw_graph .x_grid_d3 path {
|
||||
fill: none;
|
||||
stroke: none;
|
||||
}
|
||||
.rickshaw_graph .y_ticks path,
|
||||
.rickshaw_graph .x_ticks_d3 path {
|
||||
fill: none;
|
||||
stroke: #808080;
|
||||
}
|
||||
.rickshaw_graph .y_ticks text,
|
||||
.rickshaw_graph .x_ticks_d3 text {
|
||||
opacity: 0.5;
|
||||
font-size: 12px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.rickshaw_graph .x_tick.glow .title,
|
||||
.rickshaw_graph .y_ticks.glow text {
|
||||
fill: black;
|
||||
color: black;
|
||||
text-shadow:
|
||||
-1px 1px 0 rgba(255, 255, 255, 0.1),
|
||||
1px -1px 0 rgba(255, 255, 255, 0.1),
|
||||
1px 1px 0 rgba(255, 255, 255, 0.1),
|
||||
0px 1px 0 rgba(255, 255, 255, 0.1),
|
||||
0px -1px 0 rgba(255, 255, 255, 0.1),
|
||||
1px 0px 0 rgba(255, 255, 255, 0.1),
|
||||
-1px 0px 0 rgba(255, 255, 255, 0.1),
|
||||
-1px -1px 0 rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.rickshaw_graph .x_tick.inverse .title,
|
||||
.rickshaw_graph .y_ticks.inverse text {
|
||||
fill: white;
|
||||
color: white;
|
||||
text-shadow:
|
||||
-1px 1px 0 rgba(0, 0, 0, 0.8),
|
||||
1px -1px 0 rgba(0, 0, 0, 0.8),
|
||||
1px 1px 0 rgba(0, 0, 0, 0.8),
|
||||
0px 1px 0 rgba(0, 0, 0, 0.8),
|
||||
0px -1px 0 rgba(0, 0, 0, 0.8),
|
||||
1px 0px 0 rgba(0, 0, 0, 0.8),
|
||||
-1px 0px 0 rgba(0, 0, 0, 0.8),
|
||||
-1px -1px 0 rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
.custom_rickshaw_graph {
|
||||
position: relative;
|
||||
left: 40px;
|
||||
}
|
||||
|
||||
.custom_y_axis {
|
||||
position: absolute;
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
.custom_slider {
|
||||
left: 40px;
|
||||
}
|
||||
|
||||
.custom_x_axis {
|
||||
position: relative;
|
||||
left: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
#chart {
|
||||
display: inline-block;
|
||||
}
|
||||
#legend {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
left: 8px;
|
||||
}
|
||||
#legend_container {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 26px;
|
||||
width: 0;
|
||||
}
|
||||
#chart_container {
|
||||
float: left;
|
||||
position: relative;
|
||||
}
|
||||
@ -1,641 +0,0 @@
|
||||
/* nvd3 version 1.8.1 (https://github.com/novus/nvd3) 2015-06-17 */
|
||||
.nvd3 .nv-axis {
|
||||
pointer-events:none;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis path {
|
||||
fill: none;
|
||||
stroke: #000;
|
||||
stroke-opacity: .75;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis path.domain {
|
||||
stroke-opacity: .75;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis.nv-x path.domain {
|
||||
stroke-opacity: 0;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis line {
|
||||
fill: none;
|
||||
stroke: #e5e5e5;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis .zero line,
|
||||
/*this selector may not be necessary*/ .nvd3 .nv-axis line.zero {
|
||||
stroke-opacity: .75;
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis .nv-axisMaxMin text {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.nvd3 .x .nv-axis .nv-axisMaxMin text,
|
||||
.nvd3 .x2 .nv-axis .nv-axisMaxMin text,
|
||||
.nvd3 .x3 .nv-axis .nv-axisMaxMin text {
|
||||
text-anchor: middle
|
||||
}
|
||||
|
||||
.nvd3 .nv-axis.nv-disabled {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.nvd3 .nv-bars rect {
|
||||
fill-opacity: .75;
|
||||
|
||||
transition: fill-opacity 250ms linear;
|
||||
-moz-transition: fill-opacity 250ms linear;
|
||||
-webkit-transition: fill-opacity 250ms linear;
|
||||
}
|
||||
|
||||
.nvd3 .nv-bars rect.hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3 .nv-bars .hover rect {
|
||||
fill: lightblue;
|
||||
}
|
||||
|
||||
.nvd3 .nv-bars text {
|
||||
fill: rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
.nvd3 .nv-bars .hover text {
|
||||
fill: rgba(0,0,0,1);
|
||||
}
|
||||
|
||||
.nvd3 .nv-multibar .nv-groups rect,
|
||||
.nvd3 .nv-multibarHorizontal .nv-groups rect,
|
||||
.nvd3 .nv-discretebar .nv-groups rect {
|
||||
stroke-opacity: 0;
|
||||
|
||||
transition: fill-opacity 250ms linear;
|
||||
-moz-transition: fill-opacity 250ms linear;
|
||||
-webkit-transition: fill-opacity 250ms linear;
|
||||
}
|
||||
|
||||
.nvd3 .nv-multibar .nv-groups rect:hover,
|
||||
.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,
|
||||
.nvd3 .nv-candlestickBar .nv-ticks rect:hover,
|
||||
.nvd3 .nv-discretebar .nv-groups rect:hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3 .nv-discretebar .nv-groups text,
|
||||
.nvd3 .nv-multibarHorizontal .nv-groups text {
|
||||
font-weight: bold;
|
||||
fill: rgba(0,0,0,1);
|
||||
stroke: rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
/* boxplot CSS */
|
||||
.nvd3 .nv-boxplot circle {
|
||||
fill-opacity: 0.5;
|
||||
}
|
||||
|
||||
.nvd3 .nv-boxplot circle:hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3 .nv-boxplot rect:hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3 line.nv-boxplot-median {
|
||||
stroke: black;
|
||||
}
|
||||
|
||||
.nv-boxplot-tick:hover {
|
||||
stroke-width: 2.5px;
|
||||
}
|
||||
/* bullet */
|
||||
.nvd3.nv-bullet { font: 10px sans-serif; }
|
||||
.nvd3.nv-bullet .nv-measure { fill-opacity: .8; }
|
||||
.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; }
|
||||
.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; }
|
||||
.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; }
|
||||
.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; }
|
||||
.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; }
|
||||
.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; }
|
||||
.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; }
|
||||
.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; }
|
||||
.nvd3.nv-bullet .nv-subtitle { fill: #999; }
|
||||
|
||||
|
||||
.nvd3.nv-bullet .nv-range {
|
||||
fill: #bababa;
|
||||
fill-opacity: .4;
|
||||
}
|
||||
.nvd3.nv-bullet .nv-range:hover {
|
||||
fill-opacity: .7;
|
||||
}
|
||||
|
||||
.nvd3.nv-candlestickBar .nv-ticks .nv-tick {
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover {
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect {
|
||||
stroke: #2ca02c;
|
||||
fill: #2ca02c;
|
||||
}
|
||||
|
||||
.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect {
|
||||
stroke: #d62728;
|
||||
fill: #d62728;
|
||||
}
|
||||
|
||||
.with-transitions .nv-candlestickBar .nv-ticks .nv-tick {
|
||||
transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
|
||||
}
|
||||
|
||||
.nvd3.nv-candlestickBar .nv-ticks line {
|
||||
stroke: #333;
|
||||
}
|
||||
|
||||
|
||||
.nvd3 .nv-legend .nv-disabled rect {
|
||||
/*fill-opacity: 0;*/
|
||||
}
|
||||
|
||||
.nvd3 .nv-check-box .nv-box {
|
||||
fill-opacity:0;
|
||||
stroke-width:2;
|
||||
}
|
||||
|
||||
.nvd3 .nv-check-box .nv-check {
|
||||
fill-opacity:0;
|
||||
stroke-width:4;
|
||||
}
|
||||
|
||||
.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check {
|
||||
fill-opacity:0;
|
||||
stroke-opacity:0;
|
||||
}
|
||||
|
||||
.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* line plus bar */
|
||||
.nvd3.nv-linePlusBar .nv-bar rect {
|
||||
fill-opacity: .75;
|
||||
}
|
||||
|
||||
.nvd3.nv-linePlusBar .nv-bar rect:hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
.nvd3 .nv-groups path.nv-line {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.nvd3 .nv-groups path.nv-area {
|
||||
stroke: none;
|
||||
}
|
||||
|
||||
.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point {
|
||||
fill-opacity: 0;
|
||||
stroke-opacity: 0;
|
||||
}
|
||||
|
||||
.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point {
|
||||
fill-opacity: .5 !important;
|
||||
stroke-opacity: .5 !important;
|
||||
}
|
||||
|
||||
|
||||
.with-transitions .nvd3 .nv-groups .nv-point {
|
||||
transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
|
||||
}
|
||||
|
||||
.nvd3.nv-scatter .nv-groups .nv-point.hover,
|
||||
.nvd3 .nv-groups .nv-point.hover {
|
||||
stroke-width: 7px;
|
||||
fill-opacity: .95 !important;
|
||||
stroke-opacity: .95 !important;
|
||||
}
|
||||
|
||||
|
||||
.nvd3 .nv-point-paths path {
|
||||
stroke: #aaa;
|
||||
stroke-opacity: 0;
|
||||
fill: #eee;
|
||||
fill-opacity: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.nvd3 .nv-indexLine {
|
||||
cursor: ew-resize;
|
||||
}
|
||||
|
||||
/********************
|
||||
* SVG CSS
|
||||
*/
|
||||
|
||||
/********************
|
||||
Default CSS for an svg element nvd3 used
|
||||
*/
|
||||
svg.nvd3-svg {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
display: block;
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
/********************
|
||||
Box shadow and border radius styling
|
||||
*/
|
||||
.nvtooltip.with-3d-shadow, .with-3d-shadow .nvtooltip {
|
||||
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
|
||||
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
|
||||
box-shadow: 0 5px 10px rgba(0,0,0,.2);
|
||||
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
|
||||
.nvd3 text {
|
||||
font: normal 12px Arial;
|
||||
}
|
||||
|
||||
.nvd3 .title {
|
||||
font: bold 14px Arial;
|
||||
}
|
||||
|
||||
.nvd3 .nv-background {
|
||||
fill: white;
|
||||
fill-opacity: 0;
|
||||
}
|
||||
|
||||
.nvd3.nv-noData {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
/**********
|
||||
* Brush
|
||||
*/
|
||||
|
||||
.nv-brush .extent {
|
||||
fill-opacity: .125;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.nv-brush .resize path {
|
||||
fill: #eee;
|
||||
stroke: #666;
|
||||
}
|
||||
|
||||
|
||||
/**********
|
||||
* Legend
|
||||
*/
|
||||
|
||||
.nvd3 .nv-legend .nv-series {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.nvd3 .nv-legend .nv-disabled circle {
|
||||
fill-opacity: 0;
|
||||
}
|
||||
|
||||
/* focus */
|
||||
.nvd3 .nv-brush .extent {
|
||||
fill-opacity: 0 !important;
|
||||
}
|
||||
|
||||
.nvd3 .nv-brushBackground rect {
|
||||
stroke: #000;
|
||||
stroke-width: .4;
|
||||
fill: #fff;
|
||||
fill-opacity: .7;
|
||||
}
|
||||
|
||||
|
||||
.nvd3.nv-ohlcBar .nv-ticks .nv-tick {
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover {
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive {
|
||||
stroke: #2ca02c;
|
||||
}
|
||||
|
||||
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative {
|
||||
stroke: #d62728;
|
||||
}
|
||||
|
||||
|
||||
.nvd3 .background path {
|
||||
fill: none;
|
||||
stroke: #EEE;
|
||||
stroke-opacity: .4;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.nvd3 .foreground path {
|
||||
fill: none;
|
||||
stroke-opacity: .7;
|
||||
}
|
||||
|
||||
.nvd3 .nv-parallelCoordinates-brush .extent
|
||||
{
|
||||
fill: #fff;
|
||||
fill-opacity: .6;
|
||||
stroke: gray;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.nvd3 .nv-parallelCoordinates .hover {
|
||||
fill-opacity: 1;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
|
||||
.nvd3 .missingValuesline line {
|
||||
fill: none;
|
||||
stroke: black;
|
||||
stroke-width: 1;
|
||||
stroke-opacity: 1;
|
||||
stroke-dasharray: 5, 5;
|
||||
}
|
||||
.nvd3.nv-pie path {
|
||||
stroke-opacity: 0;
|
||||
transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
-webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
|
||||
|
||||
}
|
||||
|
||||
.nvd3.nv-pie .nv-pie-title {
|
||||
font-size: 24px;
|
||||
fill: rgba(19, 196, 249, 0.59);
|
||||
}
|
||||
|
||||
.nvd3.nv-pie .nv-slice text {
|
||||
stroke: #000;
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.nvd3.nv-pie path {
|
||||
stroke: #fff;
|
||||
stroke-width: 1px;
|
||||
stroke-opacity: 1;
|
||||
}
|
||||
|
||||
.nvd3.nv-pie .hover path {
|
||||
fill-opacity: .7;
|
||||
}
|
||||
.nvd3.nv-pie .nv-label {
|
||||
pointer-events: none;
|
||||
}
|
||||
.nvd3.nv-pie .nv-label rect {
|
||||
fill-opacity: 0;
|
||||
stroke-opacity: 0;
|
||||
}
|
||||
|
||||
/* scatter */
|
||||
.nvd3 .nv-groups .nv-point.hover {
|
||||
stroke-width: 20px;
|
||||
stroke-opacity: .5;
|
||||
}
|
||||
|
||||
.nvd3 .nv-scatter .nv-point.hover {
|
||||
fill-opacity: 1;
|
||||
}
|
||||
.nv-noninteractive {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.nv-distx, .nv-disty {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* sparkline */
|
||||
.nvd3.nv-sparkline path {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus g.nv-hoverValue {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-hoverValue line {
|
||||
stroke: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus,
|
||||
.nvd3.nv-sparklineplus g {
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
.nvd3 .nv-hoverArea {
|
||||
fill-opacity: 0;
|
||||
stroke-opacity: 0;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-xValue,
|
||||
.nvd3.nv-sparklineplus .nv-yValue {
|
||||
stroke-width: 0;
|
||||
font-size: .9em;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-yValue {
|
||||
stroke: #f66;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-maxValue {
|
||||
stroke: #2ca02c;
|
||||
fill: #2ca02c;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-minValue {
|
||||
stroke: #d62728;
|
||||
fill: #d62728;
|
||||
}
|
||||
|
||||
.nvd3.nv-sparklineplus .nv-currentValue {
|
||||
font-weight: bold;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
/* stacked area */
|
||||
.nvd3.nv-stackedarea path.nv-area {
|
||||
fill-opacity: .7;
|
||||
stroke-opacity: 0;
|
||||
transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
|
||||
-moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
|
||||
-webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
|
||||
}
|
||||
|
||||
.nvd3.nv-stackedarea path.nv-area.hover {
|
||||
fill-opacity: .9;
|
||||
}
|
||||
|
||||
|
||||
.nvd3.nv-stackedarea .nv-groups .nv-point {
|
||||
stroke-opacity: 0;
|
||||
fill-opacity: 0;
|
||||
}
|
||||
|
||||
|
||||
.nvtooltip {
|
||||
position: absolute;
|
||||
background-color: rgba(255,255,255,1.0);
|
||||
color: rgba(0,0,0,1.0);
|
||||
padding: 1px;
|
||||
border: 1px solid rgba(0,0,0,.2);
|
||||
z-index: 10000;
|
||||
display: block;
|
||||
|
||||
font-family: Arial;
|
||||
font-size: 13px;
|
||||
text-align: left;
|
||||
pointer-events: none;
|
||||
|
||||
white-space: nowrap;
|
||||
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.nvtooltip {
|
||||
background: rgba(255,255,255, 0.8);
|
||||
border: 1px solid rgba(0,0,0,0.5);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/*Give tooltips that old fade in transition by
|
||||
putting a "with-transitions" class on the container div.
|
||||
*/
|
||||
.nvtooltip.with-transitions, .with-transitions .nvtooltip {
|
||||
transition: opacity 50ms linear;
|
||||
-moz-transition: opacity 50ms linear;
|
||||
-webkit-transition: opacity 50ms linear;
|
||||
|
||||
transition-delay: 200ms;
|
||||
-moz-transition-delay: 200ms;
|
||||
-webkit-transition-delay: 200ms;
|
||||
}
|
||||
|
||||
.nvtooltip.x-nvtooltip,
|
||||
.nvtooltip.y-nvtooltip {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.nvtooltip h3 {
|
||||
margin: 0;
|
||||
padding: 4px 14px;
|
||||
line-height: 18px;
|
||||
font-weight: normal;
|
||||
background-color: rgba(247,247,247,0.75);
|
||||
color: rgba(0,0,0,1.0);
|
||||
text-align: center;
|
||||
|
||||
border-bottom: 1px solid #ebebeb;
|
||||
|
||||
-webkit-border-radius: 5px 5px 0 0;
|
||||
-moz-border-radius: 5px 5px 0 0;
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
.nvtooltip p {
|
||||
margin: 0;
|
||||
padding: 5px 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nvtooltip span {
|
||||
display: inline-block;
|
||||
margin: 2px 0;
|
||||
}
|
||||
|
||||
.nvtooltip table {
|
||||
margin: 6px;
|
||||
border-spacing:0;
|
||||
}
|
||||
|
||||
|
||||
.nvtooltip table td {
|
||||
padding: 2px 9px 2px 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.nvtooltip table td.key {
|
||||
font-weight:normal;
|
||||
}
|
||||
.nvtooltip table td.value {
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.nvtooltip table tr.highlight td {
|
||||
padding: 1px 9px 1px 0;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
.nvtooltip table td.legend-color-guide div {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.nvtooltip table td.legend-color-guide div {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
.nvtooltip .footer {
|
||||
padding: 3px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nvtooltip-pending-removal {
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/****
|
||||
Interactive Layer
|
||||
*/
|
||||
.nvd3 .nv-interactiveGuideLine {
|
||||
pointer-events:none;
|
||||
}
|
||||
.nvd3 line.nv-guideline {
|
||||
stroke: #ccc;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -1,10 +0,0 @@
|
||||
function changeImage() {
|
||||
var image = document.getElementById('myImage');
|
||||
if (image.src.match("bulb-on")) {
|
||||
|
||||
image.src = "/iot/public/mydevice/images/bulb-off.png";
|
||||
} else {
|
||||
|
||||
image.src = "/iot/public/mydevice/images/bulb-on.png";
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -5,20 +5,71 @@ var currentDay = new Date();
|
||||
var startDate = new Date(currentDay.getTime() - (60 * 60 * 24 * 100));
|
||||
var endDate = new Date(currentDay.getTime());
|
||||
|
||||
// create a custom bar renderer that has no gaps
|
||||
Rickshaw.Graph.Renderer.BarNoGap = Rickshaw.Class.create(Rickshaw.Graph.Renderer.Bar, {
|
||||
name: 'bar_no_gap',
|
||||
barWidth: function (series) {
|
||||
var frequentInterval = this._frequentInterval(series.stack);
|
||||
var barWidth = this.graph.x(series.stack[0].x + frequentInterval.magnitude * 1);
|
||||
return barWidth;
|
||||
var groupId;
|
||||
|
||||
var color = ['#c05020', '#30c020', '#6060c0', '#170B3B', '#5E610B', '#2F0B3A', '#FF4000', '#2F0B3A', 'steelblue'];
|
||||
|
||||
// create a custom bar renderer that shift bars
|
||||
Rickshaw.Graph.Renderer.BinaryBar = Rickshaw.Class.create(Rickshaw.Graph.Renderer.Bar, {
|
||||
name: 'binary_bar',
|
||||
render: function (args) {
|
||||
|
||||
args = args || {};
|
||||
|
||||
var graph = this.graph;
|
||||
var series = args.series || graph.series;
|
||||
|
||||
var vis = args.vis || graph.vis;
|
||||
vis.selectAll('*').remove();
|
||||
|
||||
var barWidth = this.barWidth(series.active()[0]);
|
||||
var barXOffset = 0;
|
||||
|
||||
var activeSeriesCount = series.filter(function (s) {
|
||||
return !s.disabled;
|
||||
}).length;
|
||||
var seriesBarWidth = this.unstack ? barWidth / activeSeriesCount : barWidth;
|
||||
|
||||
var transform = function (d) {
|
||||
// add a matrix transform for negative values
|
||||
var matrix = [1, 0, 0, (d.y < 0 ? -1 : 1), 0, (d.y < 0 ? graph.y.magnitude(Math.abs(d.y)) * 2 : 0)];
|
||||
return "matrix(" + matrix.join(',') + ")";
|
||||
};
|
||||
|
||||
var index = 0;
|
||||
series.forEach(function (series) {
|
||||
if (series.disabled) return;
|
||||
|
||||
var nodes = vis.selectAll("path")
|
||||
.data(series.stack.filter(function (d) {
|
||||
return d.y !== null
|
||||
}))
|
||||
.enter().append("svg:rect")
|
||||
.attr("x", function (d) {
|
||||
return graph.x(d.x) + barXOffset
|
||||
})
|
||||
.attr("y", function (d) {
|
||||
return ((graph.y(index + Math.abs(d.y))) * (d.y < 0 ? -1 : 1 ))
|
||||
})
|
||||
.attr("width", seriesBarWidth)
|
||||
.attr("height", function (d) {
|
||||
return graph.y.magnitude(Math.abs(d.y))
|
||||
})
|
||||
.attr("transform", transform);
|
||||
|
||||
index++;
|
||||
Array.prototype.forEach.call(nodes[0], function (n) {
|
||||
n.setAttribute('fill', series.color);
|
||||
});
|
||||
|
||||
if (this.unstack) barXOffset += seriesBarWidth;
|
||||
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
|
||||
function initDate(){
|
||||
function initDate() {
|
||||
currentDay = new Date();
|
||||
startDate = new Date(currentDay.getTime() - (60 * 60 * 24 * 100));
|
||||
endDate = new Date(currentDay.getTime());
|
||||
}
|
||||
|
||||
var configObject = {
|
||||
@ -31,7 +82,7 @@ var configObject = {
|
||||
},
|
||||
shortcuts: 'hide',
|
||||
endDate: currentDay,
|
||||
|
||||
maxDays: 2,
|
||||
getValue: function () {
|
||||
return this.value;
|
||||
},
|
||||
@ -44,6 +95,9 @@ var DateRange = convertDate(startDate) + " " + configObject.separator + " " + co
|
||||
|
||||
$(document).ready(function () {
|
||||
initDate();
|
||||
groupId = $("#request-group-id").data("groupid");
|
||||
|
||||
$('#date-range').html(DateRange);
|
||||
$('#date-range').dateRangePicker(configObject)
|
||||
.bind('datepicker-apply', function (event, dateRange) {
|
||||
$(this).addClass('active');
|
||||
@ -53,40 +107,32 @@ $(document).ready(function () {
|
||||
getStats(fromDate, toDate);
|
||||
}
|
||||
);
|
||||
getDateTime(currentDay.getTime() - 3600000, currentDay.getTime());
|
||||
$('#hour-btn').addClass('active');
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#date-range').html(DateRange);
|
||||
$('#date-range').trigger('datepicker-apply',
|
||||
{
|
||||
'value': DateRange,
|
||||
'date1': startDate,
|
||||
'date2': endDate
|
||||
});
|
||||
});
|
||||
|
||||
//day picker
|
||||
$('#today-btn').on('click', function () {
|
||||
initDate();
|
||||
getDateTime(currentDay.getTime() - 86400000, currentDay.getTime());
|
||||
});
|
||||
|
||||
//hour picker
|
||||
//hour
|
||||
$('#hour-btn').on('click', function () {
|
||||
initDate();
|
||||
getDateTime(currentDay.getTime() - 3600000, currentDay.getTime());
|
||||
});
|
||||
|
||||
//week picker
|
||||
$('#week-btn').on('click', function () {
|
||||
//12 hours
|
||||
$('#h12-btn').on('click', function () {
|
||||
initDate();
|
||||
getDateTime(currentDay.getTime() - 604800000, currentDay.getTime());
|
||||
getDateTime(currentDay.getTime() - (3600000 * 12), currentDay.getTime());
|
||||
});
|
||||
|
||||
//month picker
|
||||
$('#month-btn').on('click', function () {
|
||||
//24 hours
|
||||
$('#h24-btn').on('click', function () {
|
||||
initDate();
|
||||
getDateTime(currentDay.getTime() - (604800000 * 4), currentDay.getTime());
|
||||
getDateTime(currentDay.getTime() - (3600000 * 24), currentDay.getTime());
|
||||
});
|
||||
|
||||
//48 hours
|
||||
$('#h48-btn').on('click', function () {
|
||||
initDate();
|
||||
getDateTime(currentDay.getTime() - (3600000 * 48), currentDay.getTime());
|
||||
});
|
||||
|
||||
$('body').on('click', '.btn-group button', function (e) {
|
||||
@ -95,44 +141,45 @@ $('body').on('click', '.btn-group button', function (e) {
|
||||
});
|
||||
|
||||
function getDateTime(from, to) {
|
||||
fromDate = from;
|
||||
toDate = to;
|
||||
startDate = new Date(from);
|
||||
endDate = new Date(to);
|
||||
DateRange = convertDate(startDate) + " " + configObject.separator + " " + convertDate(endDate);
|
||||
console.log(DateRange);
|
||||
$('#date-range').html(DateRange);
|
||||
$('#date-range').trigger('datepicker-apply',
|
||||
{
|
||||
'value': DateRange,
|
||||
'date1': startDate,
|
||||
'date2': endDate
|
||||
}
|
||||
);
|
||||
getStats(from / 1000, to / 1000);
|
||||
}
|
||||
|
||||
function getStats(from, to) {
|
||||
var deviceId = getUrlParameter('deviceId');
|
||||
var deviceType = getUrlParameter('deviceType');
|
||||
|
||||
var requestData = new Object();
|
||||
|
||||
requestData['deviceId'] = deviceId;
|
||||
requestData['deviceType'] = deviceType;
|
||||
|
||||
var getStatsRequest;
|
||||
if (from) {
|
||||
requestData['from'] = from;
|
||||
}
|
||||
|
||||
if (to) {
|
||||
requestData['to'] = to;
|
||||
}
|
||||
if (groupId && groupId != "0") {
|
||||
requestData['groupId'] = groupId;
|
||||
getStatsRequest = $.ajax({
|
||||
url: "api/stats/group",
|
||||
method: "GET",
|
||||
data: requestData
|
||||
});
|
||||
} else {
|
||||
var deviceId = getUrlParameter('deviceId');
|
||||
var deviceType = getUrlParameter('deviceType');
|
||||
|
||||
var getStatsRequest = $.ajax({
|
||||
url: "../api/stats",
|
||||
method: "GET",
|
||||
data: requestData
|
||||
});
|
||||
requestData['deviceId'] = deviceId;
|
||||
requestData['deviceType'] = deviceType;
|
||||
|
||||
getStatsRequest = $.ajax({
|
||||
url: "api/stats",
|
||||
method: "GET",
|
||||
data: requestData
|
||||
});
|
||||
}
|
||||
getStatsRequest.done(function (stats) {
|
||||
updateGraphs(JSON.parse(stats));
|
||||
});
|
||||
@ -140,7 +187,6 @@ function getStats(from, to) {
|
||||
getStatsRequest.fail(function (jqXHR, textStatus) {
|
||||
alert("Request failed: " + textStatus);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getUrlParameter(paramName) {
|
||||
@ -160,7 +206,7 @@ function updateGraphs(stats) {
|
||||
var temperatureData = stats['temperatureData'];
|
||||
if (typeof temperatureData != 'undefined') {
|
||||
$('#div-temperatureData').html("").html("<div class='row margin-double'><div><h2 class='grey'>Temperature</h2><hr><div id='canvas-wrapper1'></div></div><hr></div>");
|
||||
updateTemperatureGraph(convertStatsToGraphData(temperatureData));
|
||||
drawLineGraph(1, temperatureData);
|
||||
} else {
|
||||
$('#div-temperatureData').html("");
|
||||
}
|
||||
@ -168,7 +214,7 @@ function updateGraphs(stats) {
|
||||
var lightData = stats['lightData'];
|
||||
if (typeof lightData != 'undefined') {
|
||||
$('#div-lightData').html("").html("<div class='row margin-double'><div><h2 class='grey'>Light</h2><hr><div id='canvas-wrapper2'></div></div><hr></div>");
|
||||
updateLightGraph(convertStatsToGraphData(lightData));
|
||||
drawBarGraph(2, lightData);
|
||||
} else {
|
||||
$('#div-lightData').html("");
|
||||
}
|
||||
@ -176,7 +222,7 @@ function updateGraphs(stats) {
|
||||
var motionData = stats['motionData'];
|
||||
if (typeof motionData != 'undefined') {
|
||||
$('#div-motionData').html("").html("<div class='row margin-double'><div><h2 class='grey'>Motion</h2><hr><div id='canvas-wrapper3'></div></div><hr></div>");
|
||||
updateMotionGraph(convertStatsToGraphData(motionData));
|
||||
drawBarGraph(3, motionData);
|
||||
} else {
|
||||
$('#div-motionData').html("");
|
||||
}
|
||||
@ -184,7 +230,7 @@ function updateGraphs(stats) {
|
||||
var sonarData = stats['sonarData'];
|
||||
if (typeof sonarData != 'undefined') {
|
||||
$('#div-sonarData').html("").html("<div class='row margin-double'><div><h2 class='grey'>Sonar</h2><hr><div id='canvas-wrapper4'></div></div><hr></div>");
|
||||
updateSonarGraph(convertStatsToGraphData(sonarData));
|
||||
drawLineGraph(4, sonarData);
|
||||
} else {
|
||||
$('#div-sonarData').html("");
|
||||
}
|
||||
@ -192,7 +238,7 @@ function updateGraphs(stats) {
|
||||
var fanData = stats['fanData'];
|
||||
if (typeof fanData != 'undefined') {
|
||||
$('#div-fanData').html("").html("<div class='row margin-double'><div><h2 class='grey'>Fan Status</h2><hr><div id='canvas-wrapper5'></div></div><hr></div>");
|
||||
updateFanGraph(convertStateStatsToGraphData(fanData));
|
||||
drawBarGraph(5, fanData);
|
||||
} else {
|
||||
$('#div-fanData').html("");
|
||||
}
|
||||
@ -200,7 +246,7 @@ function updateGraphs(stats) {
|
||||
var bulbData = stats['bulbData'];
|
||||
if (typeof bulbData != 'undefined') {
|
||||
$('#div-bulbData').html("").html("<div class='row margin-double'><div><h2 class='grey'>Bulb Status</h2><hr><div id='canvas-wrapper6'></div></div><hr></div>");
|
||||
updateBulbGraph(convertStateStatsToGraphData(bulbData));
|
||||
drawBarGraph(6, bulbData);
|
||||
} else {
|
||||
$('#div-bulbData').html("");
|
||||
}
|
||||
@ -208,7 +254,7 @@ function updateGraphs(stats) {
|
||||
var cpuData = stats['cpuData'];
|
||||
if (typeof cpuData != 'undefined') {
|
||||
$('#div-CPUData').html("").html("<div class='row margin-double'><div><h2 class='grey'>CPU Load</h2><hr><div id='canvas-wrapper7'></div></div><hr></div>");
|
||||
updateCPUGraph(convertStateStatsToGraphData(cpuData));
|
||||
drawLineGraph(7, cpuData);
|
||||
} else {
|
||||
$('#div-CPUData').html("");
|
||||
}
|
||||
@ -216,7 +262,7 @@ function updateGraphs(stats) {
|
||||
var ramData = stats['ramData'];
|
||||
if (typeof ramData != 'undefined') {
|
||||
$('#div-RAMData').html("").html("<div class='row margin-double'><div><h2 class='grey'>RAM Usage</h2><hr><div id='canvas-wrapper8'></div></div><hr></div>");
|
||||
updateRAMGraph(convertStateStatsToGraphData(ramData));
|
||||
drawLineGraph(8, ramData);
|
||||
} else {
|
||||
$('#div-RAMData').html("");
|
||||
}
|
||||
@ -224,7 +270,7 @@ function updateGraphs(stats) {
|
||||
var cpuTemperatureData = stats['cpuTemperatureData'];
|
||||
if (typeof cpuTemperatureData != 'undefined') {
|
||||
$('#div-cpuTemperatureData').html("").html("<div class='row margin-double'><div><h2 class='grey'>CPU Temperature</h2><hr><div id='canvas-wrapper9'></div></div><hr></div>");
|
||||
updateCPUTemperatureGraph(convertStatsToGraphData(cpuTemperatureData));
|
||||
drawLineGraph(9, cpuTemperatureData);
|
||||
} else {
|
||||
$('#div-cpuTemperatureData').html("");
|
||||
}
|
||||
@ -232,29 +278,265 @@ function updateGraphs(stats) {
|
||||
scaleGraphs();
|
||||
}
|
||||
|
||||
function drawLineGraph(graphId, chartDataRaw) {
|
||||
var chartWrapperElmId = "#canvas-wrapper" + graphId;
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartDiv = "chart" + graphId;
|
||||
var sliderDiv = "slider" + graphId;
|
||||
var y_axis = "y_axis" + graphId;
|
||||
$(chartWrapperElmId).html("").html('<div id = "' + y_axis
|
||||
+ '" class="custom_y_axis"></div><div class="legend_container" id="legend_container'
|
||||
+ graphId + '"><div id="smoother' + graphId + '" title="Smoothing"></div><div class="legend" id="legend'
|
||||
+ graphId + '"></div></div><div id="' + chartDiv
|
||||
+ '" class="custom_rickshaw_graph"></div><div class="custom_x_axis"></div><div id="' + sliderDiv
|
||||
+ '" class="custom_slider"></div>');
|
||||
|
||||
var graphConfig = {
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 2,
|
||||
renderer: 'line',
|
||||
unstack: true,
|
||||
stack: false,
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series: []
|
||||
};
|
||||
|
||||
var k = 0;
|
||||
var min = Number.MAX_VALUE;
|
||||
var max = Number.MIN_VALUE;
|
||||
var range_min = 99999, range_max = 0;
|
||||
for (var i = 0; i < chartDataRaw.length; i++) {
|
||||
var chartData = [];
|
||||
if (chartDataRaw[i].stats.length > 0) {
|
||||
var max_val = parseInt(chartDataRaw[i].stats[0].value);
|
||||
var min_val = max_val;
|
||||
for (var j = 0; j < chartDataRaw[i].stats.length; j++) {
|
||||
var y_val = parseInt(chartDataRaw[i].stats[j].value);
|
||||
if (y_val > max_val) {
|
||||
max_val = y_val;
|
||||
if (range_max < max_val) {
|
||||
range_max = max_val;
|
||||
}
|
||||
} else if (y_val < min_val) {
|
||||
min_val = y_val;
|
||||
if (range_min > min_val) {
|
||||
range_min = min_val;
|
||||
}
|
||||
}
|
||||
chartData.push({
|
||||
x: parseInt(chartDataRaw[i].stats[j].time),
|
||||
y: y_val
|
||||
});
|
||||
}
|
||||
graphConfig['series'].push({
|
||||
'color': color[k],
|
||||
'data': summerizeLine(chartData),
|
||||
'name': chartDataRaw[i].device,
|
||||
'scale': d3.scale.linear().domain([Math.min(min, min_val), Math.max(max, max_val)]).nice()
|
||||
});
|
||||
}
|
||||
if (++k == color.length) {
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (graphConfig['series'].length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var graph = new Rickshaw.Graph(graphConfig);
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.Time({
|
||||
graph: graph
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y.Scaled({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410,
|
||||
'scale': d3.scale.linear().domain([Math.min(min, range_min), Math.max(max, range_max)]).nice()
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
|
||||
var legend = new Rickshaw.Graph.Legend({
|
||||
graph: graph,
|
||||
element: document.getElementById('legend' + graphId)
|
||||
|
||||
});
|
||||
|
||||
var hoverDetail = new Rickshaw.Graph.HoverDetail({
|
||||
graph: graph
|
||||
});
|
||||
|
||||
var shelving = new Rickshaw.Graph.Behavior.Series.Toggle({
|
||||
graph: graph,
|
||||
legend: legend
|
||||
});
|
||||
|
||||
var order = new Rickshaw.Graph.Behavior.Series.Order({
|
||||
graph: graph,
|
||||
legend: legend
|
||||
});
|
||||
|
||||
var highlighter = new Rickshaw.Graph.Behavior.Series.Highlight({
|
||||
graph: graph,
|
||||
legend: legend
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function drawBarGraph(graphId, chartDataRaw) {
|
||||
var chartWrapperElmId = "#canvas-wrapper" + graphId;
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartDiv = "chart" + graphId;
|
||||
var sliderDiv = "slider" + graphId;
|
||||
var y_axis = "y_axis" + graphId;
|
||||
$(chartWrapperElmId).html("").html('<div id = "' + y_axis
|
||||
+ '" class="custom_y_axis"></div><div class="legend_container" id="legend_container'
|
||||
+ graphId + '"><div id="smoother' + graphId + '" title="Smoothing"></div><div class="legend" id="legend'
|
||||
+ graphId + '"></div></div><div id="' + chartDiv
|
||||
+ '" class="custom_rickshaw_graph"></div><div class="custom_x_axis"></div><div id="' + sliderDiv
|
||||
+ '" class="custom_slider"></div>');
|
||||
|
||||
var graphConfig = {
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 50 * chartDataRaw.length,
|
||||
strokeWidth: 0.5,
|
||||
renderer: 'binary_bar',
|
||||
offset: 'zero',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series: []
|
||||
};
|
||||
|
||||
var k = 0;
|
||||
for (var i = 0; i < chartDataRaw.length; i++) {
|
||||
var chartData = [];
|
||||
if (chartDataRaw[i].stats.length > 0) {
|
||||
for (var j = 0; j < chartDataRaw[i].stats.length; j++) {
|
||||
chartData.push({
|
||||
x: parseInt(chartDataRaw[i].stats[j].time),
|
||||
y: parseInt(chartDataRaw[i].stats[j].value)
|
||||
});
|
||||
}
|
||||
graphConfig['series'].push({
|
||||
'color': color[k],
|
||||
'data': summerizeBar(chartData),
|
||||
'name': chartDataRaw[i].device
|
||||
});
|
||||
}
|
||||
if (++k == color.length) {
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (graphConfig['series'].length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var graph = new Rickshaw.Graph(graphConfig);
|
||||
|
||||
graph.registerRenderer(new Rickshaw.Graph.Renderer.BinaryBar({graph: graph}));
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.Time({
|
||||
graph: graph
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 55 * chartDataRaw.length,
|
||||
tickFormat: function (y) {
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
|
||||
var legend = new Rickshaw.Graph.Legend({
|
||||
graph: graph,
|
||||
element: document.getElementById('legend' + graphId)
|
||||
|
||||
});
|
||||
|
||||
var shelving = new Rickshaw.Graph.Behavior.Series.Toggle({
|
||||
graph: graph,
|
||||
legend: legend
|
||||
});
|
||||
|
||||
var order = new Rickshaw.Graph.Behavior.Series.Order({
|
||||
graph: graph,
|
||||
legend: legend
|
||||
});
|
||||
|
||||
var highlighter = new Rickshaw.Graph.Behavior.Series.Highlight({
|
||||
graph: graph,
|
||||
legend: legend
|
||||
});
|
||||
}
|
||||
|
||||
function scaleGraphs() {
|
||||
var sliders = $('.right_handle');
|
||||
if (sliders.length == 0) {
|
||||
return;
|
||||
}
|
||||
var graphWidth = 0;
|
||||
for (var i = 1; i < 10; i++){
|
||||
if ($('#canvas-wrapper' + i).length){
|
||||
for (var i = 1; i < 10; i++) {
|
||||
if ($('#canvas-wrapper' + i).length) {
|
||||
graphWidth = $('#canvas-wrapper' + i).width() - 50;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (graphWidth <= 0){
|
||||
if (graphWidth <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Scale graphs
|
||||
var sliderX = graphWidth * 60 * 60 / (toDate - fromDate);
|
||||
var sliderX = graphWidth * 60 * 60000 / (toDate - fromDate);
|
||||
if (sliderX < graphWidth) {
|
||||
// fake handle move
|
||||
if (sliderX < 100) {
|
||||
sliderX = 100;
|
||||
if (sliderX < 50) {
|
||||
sliderX = 50;
|
||||
}
|
||||
var edown = document.createEvent("HTMLEvents");
|
||||
edown.initEvent("mousedown", true, true);
|
||||
@ -272,42 +554,6 @@ function scaleGraphs() {
|
||||
}
|
||||
}
|
||||
|
||||
function convertStatsToGraphData(stats) {
|
||||
|
||||
var graphData = new Array();
|
||||
if (!stats) {
|
||||
return graphData;
|
||||
}
|
||||
for (var i = 0; i < stats.length; i++) {
|
||||
graphData.push({x: parseInt(stats[i]['time']) * 1000, y: stats[i]['value']})
|
||||
}
|
||||
|
||||
return graphData;
|
||||
}
|
||||
|
||||
|
||||
function convertStateStatsToGraphData(stats) {
|
||||
|
||||
var graphData = new Array();
|
||||
if (!stats) {
|
||||
return graphData;
|
||||
}
|
||||
var yValue;
|
||||
for (var i = 0; i < stats.length; i++) {
|
||||
yValue = -1;
|
||||
|
||||
if (stats[i]['value'].toUpperCase() == 'ON') {
|
||||
yValue = 1;
|
||||
} else if (stats[i]['value'].toUpperCase() == 'OFF') {
|
||||
yValue = 0;
|
||||
}
|
||||
|
||||
graphData.push({x: parseInt(stats[i]['time']) * 1000, y: yValue})
|
||||
}
|
||||
|
||||
return graphData;
|
||||
}
|
||||
|
||||
function convertDate(date) {
|
||||
var month = date.getMonth() + 1;
|
||||
var day = date.getDate();
|
||||
@ -316,4 +562,36 @@ function convertDate(date) {
|
||||
return date.getFullYear() + '-' + (('' + month).length < 2 ? '0' : '')
|
||||
+ month + '-' + (('' + day).length < 2 ? '0' : '') + day + " " + (('' + hour).length < 2 ? '0' : '')
|
||||
+ hour + ":" + (('' + minute).length < 2 ? '0' : '') + minute;
|
||||
}
|
||||
|
||||
function summerizeLine(data) {
|
||||
if (data.length > 1500) {
|
||||
var nData = [];
|
||||
var i = 1;
|
||||
while (i < data.length) {
|
||||
var t_avg = (data[i - 1].x + data[i].x) / 2;
|
||||
var v_avg = (data[i - 1].y + data[i].y) / 2;
|
||||
nData.push({x: t_avg, y: v_avg});
|
||||
i += 2;
|
||||
}
|
||||
return summerizeLine(nData);
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
function summerizeBar(data) {
|
||||
if (data.length > 1500) {
|
||||
var nData = [];
|
||||
var i = 1;
|
||||
while (i < data.length - 1) {
|
||||
var t_avg = (data[i - 1].x + data[i].x) / 2;
|
||||
var v_avg = (data[i - 1].y + data[i].y + data[i + 1].y) / 3;
|
||||
nData.push({x: t_avg, y: Math.round(v_avg)});
|
||||
i += 2;
|
||||
}
|
||||
return summerizeBar(nData);
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
function updateBulbGraph(bulbData) {
|
||||
renderBulbChart(bulbData);
|
||||
}
|
||||
|
||||
|
||||
function renderBulbChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper6";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [[], []];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData[0].push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
chartData[1].push({x:parseInt(chartDataRaw[i].x), y:Math.abs(parseInt(chartDataRaw[i].y) - 1)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)) {
|
||||
// var rnd = Math.round(Math.random());
|
||||
// chartData[0].push({x: i * 1000, y: rnd});
|
||||
// chartData[1].push({x: i * 1000, y: Math.abs(rnd - 1)});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart6";
|
||||
var sliderDiv = "slider6";
|
||||
var x_axis = "x_axis6";
|
||||
var y_axis = "y_axis6";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 150,
|
||||
strokeWidth: 0.5,
|
||||
renderer: 'bar_no_gap',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series: [
|
||||
{color: '#5E610B', data: chartData[0]},
|
||||
{color: 'white', data: chartData[1]}
|
||||
]
|
||||
});
|
||||
|
||||
graph.registerRenderer(new Rickshaw.Graph.Renderer.BarNoGap({graph: graph}));
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 160,
|
||||
tickFormat: function (y) {
|
||||
switch (y) {
|
||||
case 1:
|
||||
return 'ON';
|
||||
case 0:
|
||||
return 'OFF';
|
||||
default :
|
||||
return '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
function updateCPUGraph(CPUData) {
|
||||
renderCPUChart(CPUData);
|
||||
}
|
||||
|
||||
function renderCPUChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper7";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData.push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart7";
|
||||
var sliderDiv = "slider7";
|
||||
var x_axis = "x_axis7";
|
||||
var y_axis = "y_axis7";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 1,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series:[
|
||||
{ color: '#2F0B3A', data: chartData }
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
function updateCPUTemperatureGraph(temperatureData) {
|
||||
console.log("cpuTemperatureData");
|
||||
renderCPUTemperatureChart(temperatureData);
|
||||
}
|
||||
|
||||
function renderCPUTemperatureChart(chartDataRaw) {
|
||||
var chartWrapperElmId = "#canvas-wrapper9";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++) {
|
||||
chartData.push({x: parseInt(chartDataRaw[i].x), y: parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart9";
|
||||
var sliderDiv = "slider9";
|
||||
var x_axis = "x_axis9";
|
||||
var y_axis = "y_axis9";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 1,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series: [
|
||||
{color: '#FF4000', data: chartData}
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
||||
@ -1,84 +0,0 @@
|
||||
function updateFanGraph(fanData) {
|
||||
renderFanChart(fanData);
|
||||
}
|
||||
|
||||
function renderFanChart(chartDataRaw) {
|
||||
var chartWrapperElmId = "#canvas-wrapper5";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [[], []];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData[0].push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
chartData[1].push({x:parseInt(chartDataRaw[i].x), y:Math.abs(parseInt(chartDataRaw[i].y) - 1)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)) {
|
||||
// var rnd = Math.round(Math.random());
|
||||
// chartData[0].push({x: i * 1000, y: rnd});
|
||||
// chartData[1].push({x: i * 1000, y: Math.abs(rnd - 1)});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart5";
|
||||
var sliderDiv = "slider5";
|
||||
var x_axis = "x_axis5";
|
||||
var y_axis = "y_axis5";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 150,
|
||||
strokeWidth: 0.5,
|
||||
renderer: 'bar_no_gap',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series: [
|
||||
{color: '#2F0B3A', data: chartData[0]},
|
||||
{color: 'white', data: chartData[1]}
|
||||
]
|
||||
});
|
||||
|
||||
graph.registerRenderer(new Rickshaw.Graph.Renderer.BarNoGap({graph: graph}));
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 160,
|
||||
tickFormat: function (y) {
|
||||
switch (y) {
|
||||
case 1:
|
||||
return 'ON';
|
||||
case 0:
|
||||
return 'OFF';
|
||||
default :
|
||||
return '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
function updateLightGraph(lightData) {
|
||||
renderLightChart(lightData);
|
||||
}
|
||||
|
||||
|
||||
function renderLightChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper2";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [[], []];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData[0].push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
chartData[1].push({x:parseInt(chartDataRaw[i].x), y:Math.abs(parseInt(chartDataRaw[i].y) - 1)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)) {
|
||||
// var rnd = Math.round(Math.random());
|
||||
// chartData[0].push({x: i * 1000, y: rnd});
|
||||
// chartData[1].push({x: i * 1000, y: Math.abs(rnd - 1)});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart2";
|
||||
var sliderDiv = "slider2";
|
||||
var x_axis = "x_axis2";
|
||||
var y_axis = "y_axis2";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 150,
|
||||
strokeWidth: 0.5,
|
||||
renderer: 'bar_no_gap',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series: [
|
||||
{color: 'steelblue', data: chartData[0]},
|
||||
{color: 'white', data: chartData[1]}
|
||||
]
|
||||
});
|
||||
|
||||
graph.registerRenderer(new Rickshaw.Graph.Renderer.BarNoGap({graph: graph}));
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 160,
|
||||
tickFormat: function (y) {
|
||||
switch (y) {
|
||||
case 1:
|
||||
return 'ON';
|
||||
case 0:
|
||||
return 'OFF';
|
||||
default :
|
||||
return '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
function updateMotionGraph(motionData) {
|
||||
renderMotionChart(motionData);
|
||||
}
|
||||
|
||||
|
||||
function renderMotionChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper3";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData.push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart3";
|
||||
var sliderDiv = "slider3";
|
||||
var x_axis = "x_axis3";
|
||||
var y_axis = "y_axis3";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 0.5,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series:[
|
||||
{ color: '#2F0B3A', data: chartData }
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
function updateRAMGraph(RAMData) {
|
||||
renderRAMChart(RAMData);
|
||||
}
|
||||
|
||||
function renderRAMChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper8";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData.push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart8";
|
||||
var sliderDiv = "slider8";
|
||||
var x_axis = "x_axis8";
|
||||
var y_axis = "y_axis8";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 1,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series:[
|
||||
{ color: '#170B3B', data: chartData }
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
function updateSonarGraph(sonarData) {
|
||||
renderSonarChart(sonarData);
|
||||
}
|
||||
|
||||
function renderSonarChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper4";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData.push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart4";
|
||||
var sliderDiv = "slider4";
|
||||
var x_axis = "x_axis4";
|
||||
var y_axis = "y_axis4";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 1,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series:[
|
||||
{ color: '#170B3B', data: chartData }
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
function updateTemperatureGraph(temperatureData) {
|
||||
console.log("temperatureData");
|
||||
renderTemperatureChart(temperatureData);
|
||||
}
|
||||
|
||||
function renderTemperatureChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper1";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData.push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart1";
|
||||
var sliderDiv = "slider1";
|
||||
var x_axis = "x_axis1";
|
||||
var y_axis = "y_axis1";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 1,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series:[
|
||||
{ color: '#FF4000', data: chartData }
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@
|
||||
|
||||
/* Inspired by Lee Byron's test data generator. */
|
||||
function stream_layers(n, m, o) {
|
||||
if (arguments.length < 3) o = 0;
|
||||
function bump(a) {
|
||||
var x = 1 / (.1 + Math.random()),
|
||||
y = 2 * Math.random() - .5,
|
||||
z = 10 / (.1 + Math.random());
|
||||
for (var i = 0; i < m; i++) {
|
||||
var w = (i / m - y) * z;
|
||||
a[i] += x * Math.exp(-w * w);
|
||||
}
|
||||
}
|
||||
return d3.range(n).map(function() {
|
||||
var a = [], i;
|
||||
for (i = 0; i < m; i++) a[i] = o + o * Math.random();
|
||||
for (i = 0; i < 5; i++) bump(a);
|
||||
return a.map(stream_index);
|
||||
});
|
||||
}
|
||||
|
||||
/* Another layer generator using gamma distributions. */
|
||||
function stream_waves(n, m) {
|
||||
return d3.range(n).map(function(i) {
|
||||
return d3.range(m).map(function(j) {
|
||||
var x = 20 * j / m - i / 3;
|
||||
return 2 * x * Math.exp(-.5 * x);
|
||||
}).map(stream_index);
|
||||
});
|
||||
}
|
||||
|
||||
function stream_index(d, i) {
|
||||
return {x: i, y: Math.max(0, d)};
|
||||
}
|
||||
|
||||
@ -8,8 +8,6 @@
|
||||
<p class="margin-bottom-double light-grey ">Connect your Android
|
||||
to the WSO2 device cloud. </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row margin-bottom-double">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top">
|
||||
<img src="{{self.publicURL}}/images/android.png" class="img-responsive">
|
||||
</div>
|
||||
@ -20,11 +18,11 @@
|
||||
<br><br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Arduino Uno<br><br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Arduino Ethernet / WiFi Shield
|
||||
<br /><br />
|
||||
<form method="POST" class="float-left margin-right"
|
||||
|
||||
@ -8,8 +8,6 @@
|
||||
<p class="margin-bottom-double light-grey ">Connect your Android Sense
|
||||
to the WSO2 device cloud. </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row margin-bottom-double">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top">
|
||||
<img src="{{self.publicURL}}/images/android_sense.png" class="img-responsive">
|
||||
</div>
|
||||
@ -20,7 +18,7 @@
|
||||
<br><br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Android Phone<br><br>
|
||||
<br/><br/>
|
||||
|
||||
|
||||
@ -41,13 +41,13 @@
|
||||
<!-- common navigation -->
|
||||
<div id="hiddenNav" class="wr-hidden-nav">
|
||||
<ul>
|
||||
<li><a href="/iotserver/dashboard"><i class="fw fw-dashboard"></i>Dashboard</a></li>
|
||||
<li><a href="/iotserver/devices"><i class="fw fw-mobile"></i>My Devices</a></li>
|
||||
<li><a href="/iotserver/groups"><i class="fw fw-group"></i>My Groups</a></li>
|
||||
<li><a href="/iotserver/groups"><i class="fw fw-grid"></i>My Groups</a></li>
|
||||
{{#if permissions.ADD_USER}}
|
||||
<li><a href="/iotserver/users"><i class="fw fw-user"></i>User Management</a></li>
|
||||
{{/if}}
|
||||
<li><a href="/iotserver/policies"><i class="fw fw-policy"></i>Policy Management</a></li>
|
||||
<li><a href="/iotserver/dashboard"><i class="fw fw-settings"></i>Dashboard</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- /common navigation -->
|
||||
|
||||
@ -10,12 +10,13 @@ function onRequest(context) {
|
||||
"group-mgt": [],
|
||||
"store": [],
|
||||
"dashboard": [],
|
||||
"analytics" : []
|
||||
"analytics" : [],
|
||||
"events" : []
|
||||
};
|
||||
var dashboardLink = {
|
||||
title: "Go back to Dashboard",
|
||||
icon: "fw-left-arrow",
|
||||
url: "/iotserver"
|
||||
url: "/iotserver/dashboard"
|
||||
};
|
||||
|
||||
var deviceMgtLink = {
|
||||
@ -24,21 +25,35 @@ function onRequest(context) {
|
||||
url: "/iotserver/devices"
|
||||
};
|
||||
|
||||
var groupMgtLink = {
|
||||
title: "Go back to Groups",
|
||||
icon: "fw-left-arrow",
|
||||
url: "/iotserver/groups"
|
||||
};
|
||||
|
||||
var storeLink = {
|
||||
title: "Go back to Store",
|
||||
icon: "fw-left-arrow",
|
||||
url: "/iotserver"
|
||||
};
|
||||
|
||||
|
||||
links.users.push(dashboardLink);
|
||||
links.policies.push(dashboardLink);
|
||||
links.profiles.push(dashboardLink);
|
||||
links.store.push(dashboardLink);
|
||||
links.events.push(dashboardLink);
|
||||
|
||||
//links.store.push(dashboardLink);
|
||||
links.store.push(storeLink);
|
||||
links.analytics.push(deviceMgtLink);
|
||||
links['device-mgt'].push(dashboardLink);
|
||||
|
||||
links['group-mgt'].push(dashboardLink);
|
||||
var groupId = request.getParameter("groupId");
|
||||
if (groupId){
|
||||
links.analytics.push(groupMgtLink);
|
||||
links['device-mgt'].push(groupMgtLink);
|
||||
}else{
|
||||
links.analytics.push(deviceMgtLink);
|
||||
links['device-mgt'].push(dashboardLink);
|
||||
}
|
||||
|
||||
if (!carbonUser) {
|
||||
//user is not logged in
|
||||
@ -75,6 +90,12 @@ function onRequest(context) {
|
||||
icon: "fw-add",
|
||||
url: "/iotserver/devices/add-device"
|
||||
});
|
||||
links["device-mgt"].push({
|
||||
title: "Add Group",
|
||||
icon: "fw-add",
|
||||
url: "#",
|
||||
class: "add-group-link"
|
||||
});
|
||||
}
|
||||
if (permissions.ADD_DEVICE) {
|
||||
links["group-mgt"].push({
|
||||
|
||||
@ -8,8 +8,6 @@
|
||||
<p class="margin-bottom-double light-grey ">Connect your Arduino Uno device
|
||||
to the WSO2 Device Cloud. </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row margin-bottom-double">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top">
|
||||
<img src="{{self.publicURL}}/images/arduino.png" class="img-responsive">
|
||||
</div>
|
||||
@ -20,11 +18,11 @@
|
||||
<br><br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Arduino Uno<br><br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Arduino Ethernet / WiFi Shield
|
||||
<br /><br />
|
||||
<form method="POST" class="form-login-box"
|
||||
|
||||
@ -18,11 +18,47 @@
|
||||
</span>
|
||||
View
|
||||
</a>
|
||||
<a href="devices/add-device">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-add fw-stack-1x"></i>
|
||||
</span>
|
||||
Add
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="wr-stats-board-tile">
|
||||
<div class="tile-name">Groups</div>
|
||||
<div>
|
||||
<div class="tile-icon"><i class="fw fw-policy"></i></div>
|
||||
<div class="tile-stats">
|
||||
<span id="group-count">Loading...</span>
|
||||
<span class="tile-stats-free">
|
||||
<a href="groups">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-view fw-stack-1x"></i>
|
||||
</span>
|
||||
View
|
||||
</a>
|
||||
<a href="groups/add-group">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-add fw-stack-1x"></i>
|
||||
</span>
|
||||
Add
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#if permissions.ADD_USER}}
|
||||
<div class="col-md-4">
|
||||
<div class="wr-stats-board-tile">
|
||||
@ -39,7 +75,36 @@
|
||||
</span>
|
||||
View
|
||||
</a>
|
||||
<a href="user-create.html">
|
||||
<!--<a href="user-create.html">-->
|
||||
<!--<span class="fw-stack">-->
|
||||
<!--<i class="fw fw-ring fw-stack-2x"></i>-->
|
||||
<!--<i class="fw fw-add fw-stack-1x"></i>-->
|
||||
<!--</span>-->
|
||||
<!--Add-->
|
||||
<!--</a>-->
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="wr-stats-board-tile">
|
||||
<div class="tile-name">Policies</div>
|
||||
<div>
|
||||
<div class="tile-icon"><i class="fw fw-policy"></i></div>
|
||||
<div class="tile-stats">
|
||||
<span id="policy-count">Loading...</span>
|
||||
<span class="tile-stats-free">
|
||||
<a href="policies">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-view fw-stack-1x"></i>
|
||||
</span>
|
||||
View
|
||||
</a>
|
||||
<a href="policies/add-policy">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-add fw-stack-1x"></i>
|
||||
@ -51,29 +116,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="wr-stats-board-tile">
|
||||
<div class="tile-name">Policies</div>
|
||||
<div class="tile-name">Events</div>
|
||||
<div>
|
||||
<div class="tile-icon"><i class="fw fw-policy"></i></div>
|
||||
<div class="tile-icon"><i class="fw fw-apn"></i></div>
|
||||
<div class="tile-stats">
|
||||
<span id="policy-count">Loading...</span>
|
||||
<span id="events-count"> </span>
|
||||
<span class="tile-stats-free">
|
||||
<a href="policies.html">
|
||||
<a href="events">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-view fw-stack-1x"></i>
|
||||
</span>
|
||||
View
|
||||
</a>
|
||||
<a href="policy-create-wizard.html">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-add fw-stack-1x"></i>
|
||||
</span>
|
||||
Add
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -86,4 +144,6 @@
|
||||
{{/zone}}
|
||||
{{#zone "bottomJs"}}
|
||||
<script src="{{self.publicURL}}/js/dashboard.js"></script>
|
||||
<script id="event-stream" src="{{self.publicURL}}/templates/event-stream.hbs"
|
||||
type="text/x-handlebars-template"></script>
|
||||
{{/zone}}
|
||||
@ -1,20 +1,17 @@
|
||||
var updateStats = function (serviceURL, id) {
|
||||
invokerUtil.get(
|
||||
serviceURL,
|
||||
function (data) {
|
||||
$(id).html(data);
|
||||
function (result) {
|
||||
$(id).html(JSON.parse(result));
|
||||
}, function (message) {
|
||||
console.log(message);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
//updateStats("/mdm-admin/devices/count", "#device-count");
|
||||
//updateStats("/mdm-admin/policies/count", "#policy-count");
|
||||
//updateStats("/mdm-admin/users/count/" + "carbon.super", "#user-count");
|
||||
//TODO: get this value from devicecloud webservice
|
||||
$("#device-count").html("0");
|
||||
$("#policy-count").html("0");
|
||||
$("#user-count").html("0");
|
||||
$(document).ready(function () {
|
||||
updateStats("/iotserver/api/devices/count", "#device-count");
|
||||
updateStats("/iotserver/api/group/all/count", "#group-count");
|
||||
updateStats("/iotserver/api/policies/count", "#policy-count");
|
||||
updateStats("/iotserver/api/users/count", "#user-count");
|
||||
});
|
||||
@ -1,22 +1,22 @@
|
||||
{{#zone "main"}}
|
||||
<div class="row wr-device-board">
|
||||
<div class="col-lg-12 wr-secondary-bar">
|
||||
<label class="device-id device-select" data-deviceid="{{device.deviceIdentifier}}" data-type="{{device.type}}">
|
||||
<label class="device-id device-select" data-deviceid="{{device.deviceIdentifier}}"
|
||||
data-type="{{device.type}}">
|
||||
Device {{device.name}}
|
||||
<span class="lbl-device">
|
||||
{{#if device.viewModel.vendor}}
|
||||
{{#if device.viewModel.vendor}}
|
||||
({{device.viewModel.vendor}} {{device.viewModel.model}})
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wr-device-list row">
|
||||
<div class="wr-hidden-operations wr-advance-operations">
|
||||
|
||||
</div>
|
||||
<div class="col-md-12 wr-page-content">
|
||||
{{unit "operation-bar" deviceType=device.type}}
|
||||
{{unit "operation-bar" deviceType=device.type}}
|
||||
<div class="row">
|
||||
<div class="col-md-12 wr-stats-board">
|
||||
|
||||
@ -25,11 +25,13 @@
|
||||
<div class="col-lg-2 ast-desc-image">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-sm-4">
|
||||
<img src="{{self.publicURL}}/img/device_icons/{{device.type}}.png" style="width:200px" />
|
||||
<img src="{{self.publicURL}}/img/device_icons/{{device.type}}.png"
|
||||
style="width:200px"/>
|
||||
</div>
|
||||
<div class="col-lg-12 col-sm-4 ast-desc">
|
||||
<div class="ast-device-desc"><b>Owner:</b> {{device.owner}}</div>
|
||||
<div class="ast-device-desc"><b>Date of Enrollment:</b><br/> <span class="formatDate">{{device.enrollment}}</span></div>
|
||||
<div class="ast-device-desc"><b>Date of Enrollment:</b><br/> <span
|
||||
class="formatDate">{{device.dateOfEnrolment}}</span></div>
|
||||
<!--<div class="ast-device-desc"><b>Device:</b> {{device.viewModel.vendor}} {{device.properties.model}}</div>-->
|
||||
<!--<div class="ast-device-desc"><b>Model:</b> {{device.viewModel.model}}</div>-->
|
||||
<!--<div class="ast-device-desc"><b>IMEI:</b> {{device.viewModel.imei}}</div>-->
|
||||
@ -45,114 +47,142 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-6 col-md-6">
|
||||
{{#if device.viewModel.BatteryLevel}}
|
||||
{{#if device.viewModel.BatteryLevel}}
|
||||
<div class="col-lg-4">
|
||||
<div class="wr-stats-board-tile">
|
||||
<div class="tile-name">BATTERY</div>
|
||||
<div>
|
||||
<div class="tile-icon"><i class="fw fw-battery"></i></div>
|
||||
<div class="tile-stats">{{device.viewModel.BatteryLevel}}%</div>
|
||||
<div class="tile-icon"><i class="fw fw-battery"></i>
|
||||
</div>
|
||||
<div class="tile-stats">{{device.viewModel.BatteryLevel}}
|
||||
%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if device.viewModel.DeviceCapacity}}
|
||||
{{#if device.viewModel.DeviceCapacity}}
|
||||
<div class="col-lg-4">
|
||||
<div class="wr-stats-board-tile">
|
||||
<div class="tile-name">STORAGE</div>
|
||||
<div>
|
||||
<div class="tile-icon"><i class="fw fw-hdd"></i></div>
|
||||
<div class="tile-stats">{{device.viewModel.DeviceCapacityPercentage}}%<span class="tile-stats-free">{{device.viewModel.DeviceCapacityUsed}} GB Free</span></div>
|
||||
<div class="tile-icon"><i class="fw fw-hdd"></i>
|
||||
</div>
|
||||
<div class="tile-stats">{{device.viewModel.DeviceCapacityPercentage}}
|
||||
%<span class="tile-stats-free">{{device.viewModel.DeviceCapacityUsed}}
|
||||
GB Free</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if device.viewModel.internal_memory.FreeCapacity}}
|
||||
{{/if}}
|
||||
{{#if device.viewModel.internal_memory.FreeCapacity}}
|
||||
<div class="col-lg-4">
|
||||
<div class="wr-stats-board-tile">
|
||||
<div class="tile-name">LOCAL STORAGE</div>
|
||||
<div>
|
||||
<div class="tile-icon"><i class="fw fw-hdd"></i></div>
|
||||
<div class="tile-stats">{{device.viewModel.internal_memory.DeviceCapacityPercentage}}%<span class="tile-stats-free">{{device.viewModel.internal_memory.FreeCapacity}} GB Free</span></div>
|
||||
<div class="tile-icon"><i class="fw fw-hdd"></i>
|
||||
</div>
|
||||
<div class="tile-stats">{{device.viewModel.internal_memory.DeviceCapacityPercentage}}
|
||||
%<span class="tile-stats-free">{{device.viewModel.internal_memory.FreeCapacity}}
|
||||
GB Free</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if device.viewModel.external_memory.FreeCapacity}}
|
||||
{{/if}}
|
||||
{{#if device.viewModel.external_memory.FreeCapacity}}
|
||||
<div class="col-lg-4">
|
||||
<div class="wr-stats-board-tile">
|
||||
<div class="tile-name">EXTERNAL STORAGE</div>
|
||||
<div>
|
||||
<div class="tile-icon"><i class="fw fw-hdd"></i></div>
|
||||
<div class="tile-stats">{{device.viewModel.external_memory.DeviceCapacityPercentage}}%<span class="tile-stats-free">{{device.viewModel.external_memory.FreeCapacity}} GB Free</span></div>
|
||||
<div class="tile-icon"><i class="fw fw-hdd"></i>
|
||||
</div>
|
||||
<div class="tile-stats">{{device.viewModel.external_memory.DeviceCapacityPercentage}}
|
||||
%<span class="tile-stats-free">{{device.viewModel.external_memory.FreeCapacity}}
|
||||
GB Free</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /device summary -->
|
||||
|
||||
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
|
||||
<div class="panel-group" id="accordion" role="tablist"
|
||||
aria-multiselectable="true">
|
||||
|
||||
<!--device location -->
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading" role="tab" id="headingOne">
|
||||
<h2 class="sub-title panel-title">
|
||||
<a data-toggle="collapse" data-parent="#accordion"
|
||||
href="#collapseOne" aria-expanded="true"
|
||||
aria-controls="collapseOne">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-arrow fw-down fw-stack-1x"></i>
|
||||
</span>
|
||||
Device Details
|
||||
</a>
|
||||
</h2>
|
||||
</div>
|
||||
<div id="collapseOne" class="panel-collapse collapse in"
|
||||
role="tabpanel" aria-labelledby="headingOne">
|
||||
<div id="device-location" class="panel-body">
|
||||
IP Address: 0.0.0.0
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/device location -->
|
||||
|
||||
|
||||
<!-- statistics -->
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading" role="tab" id="headingFour">
|
||||
<h2 class="sub-title panel-title">
|
||||
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
|
||||
<a class="collapsed" data-toggle="collapse"
|
||||
data-parent="#accordion"
|
||||
href="#collapseFour" aria-expanded="false"
|
||||
aria-controls="collapseFour">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
|
||||
<i class="fw fw-arrow fw-down fw-stack-1x"></i>
|
||||
</span>
|
||||
Device Statistics
|
||||
</a>
|
||||
</h2>
|
||||
</div>
|
||||
<div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFour">
|
||||
<div id="collapseFour" class="panel-collapse collapse"
|
||||
role="tabpanel"
|
||||
aria-labelledby="headingFour">
|
||||
<div class="panel-body">
|
||||
<a href="../../devices/analytics?deviceId={{deviceId}}&deviceType={{deviceType}}" ><i class="fw fw-charts"></i> Show Statistics</a>
|
||||
<a href="../../analytics?deviceId={{deviceId}}&deviceType={{deviceType}}"><i
|
||||
class="fw fw-charts"></i> Show Statistics</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /statistics -->
|
||||
|
||||
<!-- device location -->
|
||||
<!--<div class="panel panel-default">-->
|
||||
<!--<div class="panel-heading" role="tab" id="headingOne">-->
|
||||
<!--<h2 class="sub-title panel-title">-->
|
||||
<!--<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">-->
|
||||
<!--<span class="fw-stack">-->
|
||||
<!--<i class="fw fw-ring fw-stack-2x"></i>-->
|
||||
<!--<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>-->
|
||||
<!--</span>-->
|
||||
<!--Device Location-->
|
||||
<!--</a>-->
|
||||
<!--</h2>-->
|
||||
<!--</div>-->
|
||||
<!--<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">-->
|
||||
<!--<div id="device-location" style="height:400px" class="panel-body">-->
|
||||
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!-- /device location -->
|
||||
|
||||
<!-- policies -->
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading" role="tab" id="headingTwo">
|
||||
<h2 class="sub-title panel-title">
|
||||
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
|
||||
<a class="collapsed" data-toggle="collapse"
|
||||
data-parent="#accordion"
|
||||
href="#collapseTwo" aria-expanded="false"
|
||||
aria-controls="collapseTwo">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
|
||||
<i class="fw fw-arrow fw-down fw-stack-1x"></i>
|
||||
</span>
|
||||
Policies
|
||||
</a>
|
||||
</h2>
|
||||
</div>
|
||||
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
|
||||
<div id="collapseTwo" class="panel-collapse collapse"
|
||||
role="tabpanel"
|
||||
aria-labelledby="headingTwo">
|
||||
<div class="panel-body">
|
||||
Not available yet
|
||||
</div>
|
||||
@ -162,27 +192,26 @@
|
||||
|
||||
<!-- installed applications -->
|
||||
<!--<div class="panel panel-default">-->
|
||||
<!--<div class="panel-heading" role="tab" id="headingThree">-->
|
||||
<!--<h2 class="sub-title panel-title">-->
|
||||
<!--<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">-->
|
||||
<!--<span class="fw-stack">-->
|
||||
<!--<i class="fw fw-ring fw-stack-2x"></i>-->
|
||||
<!--<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>-->
|
||||
<!--</span>-->
|
||||
<!--Installed Applications-->
|
||||
<!--</a>-->
|
||||
<!--</h2>-->
|
||||
<!--</div>-->
|
||||
<!--<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">-->
|
||||
<!--<div class="panel-body">-->
|
||||
<!--Not available yet-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="panel-heading" role="tab" id="headingThree">-->
|
||||
<!--<h2 class="sub-title panel-title">-->
|
||||
<!--<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">-->
|
||||
<!--<span class="fw-stack">-->
|
||||
<!--<i class="fw fw-ring fw-stack-2x"></i>-->
|
||||
<!--<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>-->
|
||||
<!--</span>-->
|
||||
<!--Installed Applications-->
|
||||
<!--</a>-->
|
||||
<!--</h2>-->
|
||||
<!--</div>-->
|
||||
<!--<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">-->
|
||||
<!--<div class="panel-body">-->
|
||||
<!--Not available yet-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!-- /installed applications -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -16,54 +16,13 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
function formatDates(){
|
||||
$(".formatDate").each(function(){
|
||||
function formatDates() {
|
||||
$(".formatDate").each(function () {
|
||||
var timeStamp = $(this).html();
|
||||
$(this).html(new Date(parseInt(timeStamp)).toUTCString());
|
||||
});
|
||||
}
|
||||
|
||||
(function () {
|
||||
var deviceId = $(".device-id");
|
||||
var deviceIdentifier = deviceId.data("deviceid");
|
||||
var deviceType = deviceId.data("type");
|
||||
var payload = [deviceIdentifier];
|
||||
if (deviceType == "ios") {
|
||||
var serviceUrl = "/ios/operation/deviceinfo";
|
||||
} else if (deviceType == "android") {
|
||||
var serviceUrl = "/mdm-android-agent/operation/device-info";
|
||||
}
|
||||
invokerUtil.post(serviceUrl, payload,
|
||||
function(message){
|
||||
console.log(message);
|
||||
}, function (message) {
|
||||
console.log(message);
|
||||
});
|
||||
$(document).ready(function(){
|
||||
loadOperationBar(deviceType);
|
||||
loadMap();
|
||||
formatDates();
|
||||
});
|
||||
function loadMap(){
|
||||
var map;
|
||||
function initialize() {
|
||||
var mapOptions = {
|
||||
zoom: 18
|
||||
};
|
||||
var lat = 6.9098591;
|
||||
var long = 79.8523753;
|
||||
map = new google.maps.Map(document.getElementById('device-location'),
|
||||
mapOptions);
|
||||
|
||||
var pos = new google.maps.LatLng(lat,
|
||||
long);
|
||||
var marker = new google.maps.Marker({
|
||||
position: pos,
|
||||
map: map
|
||||
});
|
||||
|
||||
map.setCenter(pos);
|
||||
}
|
||||
google.maps.event.addDomListener(window, 'load', initialize);
|
||||
}
|
||||
}());
|
||||
$(document).ready(function () {
|
||||
formatDates();
|
||||
});
|
||||
@ -1,8 +1,8 @@
|
||||
{{#zone "main"}}
|
||||
<span id="permission" data-permission="{{permissions}}"></span>
|
||||
<span id="request-group-id" data-groupId="{{groupId}}"></span>
|
||||
<span id="permission" data-user="{{user}}" data-permission="{{permissions}}"></span>
|
||||
<span id="request-group-id" data-groupid="{{groupId}}"></span>
|
||||
<!-- form content placeholder -->
|
||||
<div id="ast-container" class="ast-container list-view">
|
||||
<div id="ast-container-parent" class="ast-container">
|
||||
<!-- no devices found -->
|
||||
<div class="container-fluid wr-content-alt">
|
||||
<div class="ctrl-info-panel col-md-6 col-centered">
|
||||
@ -52,6 +52,16 @@
|
||||
<!-- /no devices found -->
|
||||
</div>
|
||||
|
||||
<div id="no-devices-in-group-div-content" class="hide">
|
||||
<!-- no devices found -->
|
||||
<div class="container-fluid">
|
||||
<div class="ctrl-info-panel col-md-6 col-centered">
|
||||
<h3>You don't have any associated devices here.</h3>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /no devices found -->
|
||||
</div>
|
||||
|
||||
<div id="remove-device-modal-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
@ -77,12 +87,6 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Device was successfully removed.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="remove-device-200-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -118,12 +122,6 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Device was successfully updated.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="edit-device-200-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -138,13 +136,13 @@
|
||||
|
||||
<div id="user-groups">Loading...</div>
|
||||
<div class="buttons">
|
||||
<a href="#" id="group-device-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
|
||||
<a href="#" id="group-device-yes-link" class="btn-operations">
|
||||
Assign
|
||||
</a>
|
||||
|
||||
<a href="#" id="group-device-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -156,12 +154,6 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Device was successfully associated with group.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="group-associate-device-200-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -172,12 +164,6 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Device was successfully removed from group.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="group-deassociate-device-200-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -246,8 +232,238 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="share-group-w1-modal-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Select user to manage group sharing</h3>
|
||||
<div id="user-names">Loading...</div>
|
||||
<div class="buttons">
|
||||
<a href="#" id="share-group-next-link" class="btn-operations">
|
||||
Next
|
||||
</a>
|
||||
|
||||
<a href="#" id="share-group-w1-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="share-group-w2-modal-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Select sharing roles</h3>
|
||||
<br />
|
||||
<div id="user-roles">Loading...</div>
|
||||
<div class="buttons">
|
||||
<a href="#" id="share-group-yes-link" class="btn-operations">
|
||||
OK
|
||||
</a>
|
||||
|
||||
<a href="#" id="share-group-w2-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="share-group-200-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Group sharing updated successfully.</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="remove-group-modal-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Do you really want to remove this group from your Group List?</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="remove-group-yes-link" class="btn-operations">
|
||||
Yes
|
||||
</a>
|
||||
|
||||
<a href="#" id="remove-group-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="remove-group-200-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Group was successfully removed.</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="add-group-modal-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Please enter name and description for new group</h3>
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
<input id="add-group-name" style="color:#3f3f3f;padding:5px" type="text" value=""
|
||||
placeholder="Group Name" size="60">
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
<input id="add-group-description" style="color:#3f3f3f;padding:5px" type="text" value=""
|
||||
placeholder="Group Description" size="60">
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<a href="#" id="add-group-yes-link" class="btn-operations">
|
||||
Add Group
|
||||
</a>
|
||||
|
||||
<a href="#" id="add-group-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="add-group-200-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Group successfully added.</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="edit-group-modal-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Please enter new name and description for the group</h3>
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
<input id="edit-group-name" style="color:#3f3f3f;padding:5px" type="text" value=""
|
||||
placeholder="Group Name" size="60">
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
<input id="edit-group-description" style="color:#3f3f3f;padding:5px" type="text" value=""
|
||||
placeholder="Group Description" size="60">
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<a href="#" id="edit-group-yes-link" class="btn-operations">
|
||||
Update
|
||||
</a>
|
||||
|
||||
<a href="#" id="edit-group-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="edit-group-200-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Group was successfully updated.</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="group-400-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Exception at backend. Try Later.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="group-400-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="group-403-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Action not permitted.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="group-403-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="group-409-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Group does not exist.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="group-409-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="group-unexpected-error-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Group does not exist.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="group-unexpected-error-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{/zone}}
|
||||
{{#zone "bottomJs"}}
|
||||
<script id="group-listing" src="{{self.publicURL}}/templates/group-listing.hbs"
|
||||
type="text/x-handlebars-template"></script>
|
||||
<script id="device-listing" data-image-resource="{{self.publicURL}}/images/"
|
||||
src="{{self.publicURL}}/templates/device-listing.hbs" type="text/x-handlebars-template"></script>
|
||||
<script src="{{self.publicURL}}/js/device-listing.js"></script>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
var log = new Log("modules/device-listing.js");
|
||||
|
||||
function onRequest(context){
|
||||
var constants = require("/modules/constants.js");
|
||||
var userModule = require("/modules/user.js").userModule;
|
||||
var permissions = [];
|
||||
if(userModule.isAuthorized("/permission/device-mgt/admin/devices/list")){
|
||||
@ -19,6 +20,6 @@ function onRequest(context){
|
||||
}else{
|
||||
context.groupId = 0;
|
||||
}
|
||||
|
||||
context.user = session.get(constants.USER_SESSION_KEY).username;
|
||||
return context;
|
||||
}
|
||||
@ -16,12 +16,17 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
var groupId, username;
|
||||
|
||||
(function () {
|
||||
var cache = {};
|
||||
var permissionSet = {};
|
||||
var validateAndReturn = function (value) {
|
||||
return (value == undefined || value == null) ? "Unspecified" : value;
|
||||
};
|
||||
Handlebars.registerHelper("groupMap", function (group) {
|
||||
group.id = validateAndReturn(group.id);
|
||||
});
|
||||
Handlebars.registerHelper("deviceMap", function (device) {
|
||||
device.owner = validateAndReturn(device.owner);
|
||||
device.ownership = validateAndReturn(device.ownership);
|
||||
@ -33,6 +38,13 @@
|
||||
}, {});
|
||||
}
|
||||
});
|
||||
Handlebars.registerHelper("if_owner", function (owner, opts) {
|
||||
if (owner == username) {
|
||||
return opts.fn(this);
|
||||
} else {
|
||||
opts.inverse(this);
|
||||
}
|
||||
});
|
||||
|
||||
//This method is used to setup permission for device listing
|
||||
$.setPermission = function (permission) {
|
||||
@ -47,13 +59,12 @@
|
||||
/*
|
||||
* Setting-up global variables.
|
||||
*/
|
||||
var deviceCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']";
|
||||
var assetContainer = "#ast-container";
|
||||
var deviceCheckbox = "#ast-container-parent .ctrl-wr-asset .itm-select input[type='checkbox']";
|
||||
var assetContainerParent = "#ast-container-parent";
|
||||
|
||||
/*
|
||||
* DOM ready functions.
|
||||
*/
|
||||
var groupId;
|
||||
$(document).ready(function () {
|
||||
/* Adding selected class for selected devices */
|
||||
$(deviceCheckbox).each(function () {
|
||||
@ -61,6 +72,7 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
var i;
|
||||
username = $("#permission").data("user");
|
||||
var permissionList = $("#permission").data("permission");
|
||||
for (i = 0; i < permissionList.length; i++) {
|
||||
$.setPermission(permissionList[i]);
|
||||
@ -76,6 +88,7 @@ $(document).ready(function () {
|
||||
|
||||
groupId = $("#request-group-id").data("groupid");
|
||||
loadDevices();
|
||||
attachGroupAdding();
|
||||
});
|
||||
|
||||
/*
|
||||
@ -113,9 +126,9 @@ function changeDeviceView(view, selection) {
|
||||
});
|
||||
$(selection).addClass("selected");
|
||||
if (view == "list") {
|
||||
$(assetContainer).addClass("list-view");
|
||||
$(".ast-container .devices-set").addClass("list-view");
|
||||
} else {
|
||||
$(assetContainer).removeClass("list-view");
|
||||
$(".ast-container .devices-set").removeClass("list-view");
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,63 +144,61 @@ function addDeviceSelectedClass(checkbox) {
|
||||
$(checkbox).closest(".ctrl-wr-asset").removeClass("selected device-select");
|
||||
}
|
||||
}
|
||||
function loadDevices(searchType, searchParam) {
|
||||
var deviceListing = $("#device-listing");
|
||||
var deviceListingSrc = deviceListing.attr("src");
|
||||
var imageResource = deviceListing.data("image-resource");
|
||||
$.template("device-listing", deviceListingSrc, function (template) {
|
||||
|
||||
function loadDevices() {
|
||||
var groupListing = $("#group-listing");
|
||||
var groupListingSrc = groupListing.attr("src");
|
||||
$.template("group-listing", groupListingSrc, function (template) {
|
||||
var serviceURL;
|
||||
if ($.hasPermission("LIST_DEVICES")) {
|
||||
if (groupId && groupId != "0") {
|
||||
serviceURL = "/iotserver/api/group/id/" + groupId + "/device/all";
|
||||
} else {
|
||||
serviceURL = "/iotserver/api/devices/all";
|
||||
}
|
||||
} else if ($.hasPermission("LIST_OWN_DEVICES")) {
|
||||
//Get authenticated users devices
|
||||
if (groupId && groupId != "0") {
|
||||
serviceURL = "/iotserver/api/group/id/" + groupId + "/device/all";
|
||||
} else {
|
||||
serviceURL = "/iotserver/api/devices/all";
|
||||
}
|
||||
if (groupId && groupId != "0") {
|
||||
serviceURL = "/iotserver/api/group/id/" + groupId + "/device/all";
|
||||
} else {
|
||||
$("#ast-container").html("Permission denied");
|
||||
return;
|
||||
}
|
||||
if (searchParam) {
|
||||
if (searchType == "users") {
|
||||
serviceURL = serviceURL + "?user=" + searchParam;
|
||||
} else if (searchType == "user-roles") {
|
||||
serviceURL = serviceURL + "?role=" + searchParam;
|
||||
} else {
|
||||
serviceURL = serviceURL + "?type=" + searchParam;
|
||||
}
|
||||
serviceURL = "/iotserver/api/devices/all";
|
||||
}
|
||||
var successCallback = function (data) {
|
||||
data = JSON.parse(data);
|
||||
var viewModel = {};
|
||||
var groups;
|
||||
if (groupId && groupId != "0") {
|
||||
data.data = data;
|
||||
}
|
||||
viewModel.devices = data.data;
|
||||
viewModel.imageLocation = imageResource;
|
||||
if (!data.data || data.data.length <= 0) {
|
||||
if (groupId && groupId != "0") {
|
||||
$("#ast-container").html($("#no-grouped-devices-div-content").html());
|
||||
} else {
|
||||
$("#ast-container").html($("#no-devices-div-content").html());
|
||||
}
|
||||
groups = data;
|
||||
} else {
|
||||
groups = data.data;
|
||||
}
|
||||
if (groups.length == 1 && groups[0].id == 0 && groups[0].devices.length == 0) {
|
||||
$("#ast-container-parent").html($("#no-devices-div-content").html());
|
||||
} else {
|
||||
viewModel.groups = groups;
|
||||
var content = template(viewModel);
|
||||
$("#ast-container").html(content);
|
||||
/*
|
||||
* On device checkbox select add parent selected style class
|
||||
*/
|
||||
$(deviceCheckbox).click(function () {
|
||||
addDeviceSelectedClass(this);
|
||||
$("#ast-container-parent").html(content);
|
||||
var deviceListing = $("#device-listing");
|
||||
var deviceListingSrc = deviceListing.attr("src");
|
||||
var imageResource = deviceListing.data("image-resource");
|
||||
$.template("device-listing", deviceListingSrc, function (template) {
|
||||
for (var g in groups) {
|
||||
if (groups[g].devices && groups[g].devices.length > 0) {
|
||||
viewModel = {};
|
||||
viewModel.devices = groups[g].devices;
|
||||
viewModel.imageLocation = imageResource;
|
||||
content = template(viewModel);
|
||||
} else {
|
||||
if (groupId && groupId != "0") {
|
||||
content = $("#no-grouped-devices-div-content").html();
|
||||
} else {
|
||||
content = $("#no-devices-in-group-div-content").html();
|
||||
}
|
||||
}
|
||||
$("#ast-container-" + groups[g].id).html(content);
|
||||
}
|
||||
/*
|
||||
* On device checkbox select add parent selected style class
|
||||
*/
|
||||
$(deviceCheckbox).click(function () {
|
||||
addDeviceSelectedClass(this);
|
||||
});
|
||||
attachGroupEvents();
|
||||
attachDeviceEvents();
|
||||
formatDates();
|
||||
});
|
||||
attachEvents();
|
||||
//formatDates();
|
||||
}
|
||||
};
|
||||
invokerUtil.get(serviceURL,
|
||||
@ -252,7 +263,7 @@ function hidePopup() {
|
||||
/**
|
||||
* Following functions should be triggered after AJAX request is made.
|
||||
*/
|
||||
function attachEvents() {
|
||||
function attachDeviceEvents() {
|
||||
/**
|
||||
* Following click function would execute
|
||||
* when a user clicks on "Remove" link
|
||||
@ -274,9 +285,9 @@ function attachEvents() {
|
||||
if (status == 200) {
|
||||
$(modalPopupContent).html($('#remove-device-200-content').html());
|
||||
$('div[data-deviceid="' + deviceId + '"]').remove();
|
||||
$("a#remove-device-200-link").click(function () {
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}, 2000);
|
||||
} else if (status == 400) {
|
||||
$(modalPopupContent).html($('#remove-device-400-content').html());
|
||||
$("a#remove-device-400-link").click(function () {
|
||||
@ -335,9 +346,9 @@ function attachEvents() {
|
||||
if (status == 200) {
|
||||
$(modalPopupContent).html($('#edit-device-200-content').html());
|
||||
$("div[data-deviceid='" + deviceId + "'] .ast-name").html(newDeviceName);
|
||||
$("a#edit-device-200-link").click(function () {
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}, 2000);
|
||||
} else if (status == 400) {
|
||||
$(modalPopupContent).html($('#device-400-content').html());
|
||||
$("a#device-400-link").click(function () {
|
||||
@ -374,81 +385,376 @@ function attachEvents() {
|
||||
* when a user clicks on "Group" link
|
||||
* on Device Management page in WSO2 MDM Console.
|
||||
*/
|
||||
$("a.group-device-link").click(function () {
|
||||
var deviceId = $(this).data("deviceid");
|
||||
var deviceType = $(this).data("devicetype");
|
||||
var endPoint = "/iotserver/api/group/all";
|
||||
if ($("a.group-device-link").length > 0) {
|
||||
$("a.group-device-link").click(function () {
|
||||
var deviceId = $(this).data("deviceid");
|
||||
var deviceType = $(this).data("devicetype");
|
||||
var endPoint = "/iotserver/api/group/all";
|
||||
|
||||
$(modalPopupContent).html($('#group-device-modal-content').html());
|
||||
$('#user-groups').html("Loading...");
|
||||
$("a#group-device-yes-link").hide();
|
||||
$(modalPopupContent).html($('#group-device-modal-content').html());
|
||||
$('#user-groups').html("Loading...");
|
||||
$("a#group-device-yes-link").hide();
|
||||
showPopup();
|
||||
|
||||
invokerUtil.get(endPoint,
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var groups = JSON.parse(data);
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
if (groups.length <= 0) {
|
||||
$('#user-groups').html("There is no any groups available");
|
||||
return;
|
||||
}
|
||||
var str = '<br /><select id="assign-group-selector" style="color:#3f3f3f;padding:5px;width:250px;">';
|
||||
for (var group in groups) {
|
||||
str += '<option value="' + groups[group].id + '">' + groups[group].name + '</option>';
|
||||
}
|
||||
str += '</select>';
|
||||
$('#user-groups').html(str);
|
||||
$("a#group-device-yes-link").show();
|
||||
$("a#group-device-yes-link").click(function () {
|
||||
var selectedGroupId = $('#assign-group-selector').val();
|
||||
endPoint = "/iotserver/api/group/id/" + selectedGroupId + "/assign";
|
||||
var device = {"deviceId": deviceId, "deviceType": deviceType};
|
||||
invokerUtil.post(
|
||||
endPoint,
|
||||
device,
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
$(modalPopupContent).html($('#group-associate-device-200-content').html());
|
||||
loadDevices();
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
}, 2000);
|
||||
} else if (status == 400) {
|
||||
$(modalPopupContent).html($('#device-400-content').html());
|
||||
$("a#device-400-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 403) {
|
||||
$(modalPopupContent).html($('#device-403-content').html());
|
||||
$("a#device-403-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 409) {
|
||||
$(modalPopupContent).html($('#device-409-content').html());
|
||||
$("a#device-409-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
},
|
||||
function () {
|
||||
$(modalPopupContent).html($('#device-unexpected-error-content').html());
|
||||
$("a#device-unexpected-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
function () {
|
||||
$(modalPopupContent).html($('#device-unexpected-error-content').html());
|
||||
$("a#device-unexpected-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
});
|
||||
|
||||
$("a#group-device-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var errorHandler = function () {
|
||||
$(modalPopupContent).html($('#add-group-unexpected-error-content').html());
|
||||
$("a#group-unexpected-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
};
|
||||
|
||||
function attachGroupAdding() {
|
||||
/**
|
||||
* Following click function would execute
|
||||
* when a user clicks on "Remove" link
|
||||
* on Group Management page in WSO2 IoT Server Console.
|
||||
*/
|
||||
$("a.add-group-link").click(function () {
|
||||
var addGroupApi = "/iotserver/api/group/add";
|
||||
$(modalPopupContent).html($('#add-group-modal-content').html());
|
||||
showPopup();
|
||||
|
||||
invokerUtil.get(endPoint,
|
||||
$("a#add-group-yes-link").click(function () {
|
||||
var newGroupName = $('#add-group-name').val();
|
||||
var newGroupDescription = $('#add-group-description').val();
|
||||
var group = {"name": newGroupName, "description": newGroupDescription};
|
||||
invokerUtil.post(
|
||||
addGroupApi,
|
||||
group,
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
if (data != "false") {
|
||||
$(modalPopupContent).html($('#add-group-200-content').html());
|
||||
loadDevices();
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
}, 2000);
|
||||
} else {
|
||||
$(modalPopupContent).html($('#group-400-content').html());
|
||||
$("a#group-400-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
} else if (status == 400) {
|
||||
$(modalPopupContent).html($('#group-400-content').html());
|
||||
$("a#group-400-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 403) {
|
||||
$(modalPopupContent).html($('#agroup-403-content').html());
|
||||
$("a#group-403-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 409) {
|
||||
$(modalPopupContent).html($('#group-409-content').html());
|
||||
$("a#group-409-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
}, errorHandler
|
||||
);
|
||||
});
|
||||
|
||||
$("a#add-group-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Following functions should be triggered after AJAX request is made.
|
||||
*/
|
||||
function attachGroupEvents() {
|
||||
|
||||
/**
|
||||
* Following click function would execute
|
||||
* when a user clicks on "Share" link
|
||||
* on Group Management page in WSO2 IoT Server Console.
|
||||
*/
|
||||
$("a.share-group-link").click(function () {
|
||||
var groupId = $(this).data("groupid");
|
||||
$(modalPopupContent).html($('#share-group-w1-modal-content').html());
|
||||
$('#user-names').html('Loading...');
|
||||
showPopup();
|
||||
$("a#share-group-next-link").hide();
|
||||
invokerUtil.get("/iotserver/api/users",
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var groups = JSON.parse(data);
|
||||
var users = JSON.parse(data);
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
if (groups.length <= 0) {
|
||||
$('#user-groups').html("There is no any groups available");
|
||||
return;
|
||||
}
|
||||
var str = '<br /><select id="assign-group-selector" style="color:#3f3f3f;padding:5px;width:250px;">';
|
||||
for (var group in groups) {
|
||||
str += '<option value="' + groups[group].id + '">' + groups[group].name + '</option>';
|
||||
var str = '<br /><select id="share-user-selector" style="color:#3f3f3f;padding:5px;width:250px;">';
|
||||
var hasUsers = false;
|
||||
for (var user in users) {
|
||||
if (users[user].username != username) {
|
||||
str += '<option value="' + users[user].username + '">' + users[user].username + '</option>';
|
||||
hasUsers = true;
|
||||
}
|
||||
}
|
||||
str += '</select>';
|
||||
$('#user-groups').html(str);
|
||||
$("a#group-device-yes-link").show();
|
||||
$("a#group-device-yes-link").click(function () {
|
||||
var selectedGroupId = $('#assign-group-selector').val();
|
||||
endPoint = "/iotserver/api/group/id/" + selectedGroupId + "/assign";
|
||||
var device = {"deviceId": deviceId, "deviceType": deviceType};
|
||||
invokerUtil.post(
|
||||
endPoint,
|
||||
device,
|
||||
if (!hasUsers) {
|
||||
str = "There is no any other users registered";
|
||||
$('#user-names').html(str);
|
||||
return;
|
||||
}
|
||||
$('#user-names').html(str);
|
||||
$("a#share-group-next-link").show();
|
||||
$("a#share-group-next-link").click(function () {
|
||||
var selectedUser = $('#share-user-selector').val();
|
||||
$(modalPopupContent).html($('#share-group-w2-modal-content').html());
|
||||
$('#user-roles').html('Loading...');
|
||||
$("a#share-group-yes-link").hide();
|
||||
invokerUtil.get("/iotserver/api/group/id/" + groupId + "/" + selectedUser + "/rolemapping",
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var roleMap = JSON.parse(data);
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
$(modalPopupContent).html($('#group-associate-device-200-content').html());
|
||||
$("a#group-associate-device-200-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 400) {
|
||||
$(modalPopupContent).html($('#device-400-content').html());
|
||||
$("a#device-400-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 403) {
|
||||
$(modalPopupContent).html($('#device-403-content').html());
|
||||
$("a#device-403-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 409) {
|
||||
$(modalPopupContent).html($('#device-409-content').html());
|
||||
$("a#device-409-link").click(function () {
|
||||
hidePopup();
|
||||
var str = '';
|
||||
var isChecked = '';
|
||||
var hasRoles = false;
|
||||
for (var role in roleMap) {
|
||||
if (roleMap[role].assigned == true) {
|
||||
isChecked = 'checked';
|
||||
}
|
||||
str += '<label class="checkbox-text"><input type="checkbox" id="user-role-' + roleMap[role].role + '" value="' + roleMap[role].role
|
||||
+ '" ' + isChecked + '/>' + roleMap[role].role + '</label> ';
|
||||
hasRoles = true;
|
||||
}
|
||||
if (!hasRoles) {
|
||||
str = "There is no any roles for this group";
|
||||
return;
|
||||
}
|
||||
$('#user-roles').html(str);
|
||||
$("a#share-group-yes-link").show();
|
||||
$("a#share-group-yes-link").click(function () {
|
||||
var updatedRoleMap = [];
|
||||
for (var role in roleMap) {
|
||||
if ($('#user-role-' + roleMap[role].role).is(':checked') != roleMap[role].assigned) {
|
||||
roleMap[role].assigned = $('#user-role-' + roleMap[role].role).is(':checked');
|
||||
updatedRoleMap.push(roleMap[role]);
|
||||
}
|
||||
}
|
||||
invokerUtil.post("/iotserver/api/group/id/" + groupId + "/" + selectedUser + "/roleupdate",
|
||||
updatedRoleMap,
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
$(modalPopupContent).html($('#share-group-200-content').html());
|
||||
loadDevices();
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
}, 2000);
|
||||
} else {
|
||||
displayErrors(status);
|
||||
}
|
||||
}, errorHandler);
|
||||
});
|
||||
} else {
|
||||
displayErrors(status);
|
||||
}
|
||||
},
|
||||
function () {
|
||||
$(modalPopupContent).html($('#device-unexpected-error-content').html());
|
||||
$("a#device-unexpected-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
});
|
||||
}, errorHandler);
|
||||
$("a#share-group-w2-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
displayErrors(status);
|
||||
}
|
||||
}, errorHandler);
|
||||
|
||||
$("a#share-group-w1-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Following click function would execute
|
||||
* when a user clicks on "Remove" link
|
||||
* on Group Management page in WSO2 IoT Server Console.
|
||||
*/
|
||||
$("a.remove-group-link").click(function () {
|
||||
var groupId = $(this).data("groupid");
|
||||
var removeGroupApi = "/iotserver/api/group/id/" + groupId + "/remove";
|
||||
|
||||
$(modalPopupContent).html($('#remove-group-modal-content').html());
|
||||
showPopup();
|
||||
|
||||
$("a#remove-group-yes-link").click(function () {
|
||||
invokerUtil.delete(
|
||||
removeGroupApi,
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
$(modalPopupContent).html($('#remove-group-200-content').html());
|
||||
loadDevices();
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
}, 2000);
|
||||
} else {
|
||||
displayErrors(status);
|
||||
}
|
||||
},
|
||||
function () {
|
||||
$(modalPopupContent).html($('#group-unexpected-error-content').html());
|
||||
$("a#group-unexpected-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
},
|
||||
function () {
|
||||
$(modalPopupContent).html($('#device-unexpected-error-content').html());
|
||||
$("a#device-unexpected-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
});
|
||||
);
|
||||
});
|
||||
|
||||
$("a#group-device-cancel-link").click(function () {
|
||||
$("a#remove-group-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Following click function would execute
|
||||
* when a user clicks on "Edit" link
|
||||
* on Device Management page in WSO2 MDM Console.
|
||||
*/
|
||||
$("a.edit-group-link").click(function () {
|
||||
var groupId = $(this).data("groupid");
|
||||
var groupName = $(this).data("groupname");
|
||||
var groupDescription = $(this).data("groupdescription");
|
||||
var editGroupApi = "/iotserver/api/group/id/" + groupId + "/update";
|
||||
|
||||
$(modalPopupContent).html($('#edit-group-modal-content').html());
|
||||
$('#edit-group-name').val(groupName);
|
||||
$('#edit-group-description').val(groupDescription);
|
||||
showPopup();
|
||||
|
||||
$("a#edit-group-yes-link").click(function () {
|
||||
var newGroupName = $('#edit-group-name').val();
|
||||
var newGroupDescription = $('#edit-group-description').val();
|
||||
var group = {"name": newGroupName, "description": newGroupDescription};
|
||||
invokerUtil.post(
|
||||
editGroupApi,
|
||||
group,
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
if (data != "false") {
|
||||
$(modalPopupContent).html($('#edit-group-200-content').html());
|
||||
loadDevices();
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
}, 2000);
|
||||
} else {
|
||||
$(modalPopupContent).html($('#group-409-content').html());
|
||||
$("a#group-409-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
displayErrors(status);
|
||||
}
|
||||
},
|
||||
function () {
|
||||
$(modalPopupContent).html($('#group-unexpected-error-content').html());
|
||||
$("a#group-unexpected-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$("a#edit-group-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function displayErrors(status) {
|
||||
if (status == 400) {
|
||||
$(modalPopupContent).html($('#group-400-content').html());
|
||||
$("a#group-400-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 403) {
|
||||
$(modalPopupContent).html($('#group-403-content').html());
|
||||
$("a#group-403-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 409) {
|
||||
$(modalPopupContent).html($('#group-409-content').html());
|
||||
$("a#group-409-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,16 +8,16 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="itm-ast">
|
||||
<a href="device/{{type}}/{{deviceIdentifier}}">
|
||||
<a href="/iotserver/device/{{type}}/{{deviceIdentifier}}">
|
||||
<div class="ast-img"><img src="{{../imageLocation}}{{type}}.png"/></div>
|
||||
<div class="ast-desc">
|
||||
<div class="ast-title">
|
||||
<h3 class="ast-name">{{name}}</h3>
|
||||
<span class="ast-auth">Device Type: {{type}}</span>
|
||||
<span class="ast-auth">Date of Enrollment: <span class="formatDate">{{dateOfEnrolment}}</span></span>
|
||||
<span class="ast-auth">Enrolled On: <span class="formatDate">{{enrolmentInfo.dateOfEnrolment}}</span></span>
|
||||
</div>
|
||||
<div class="ast-model">
|
||||
<span class="ast-ver">{{owner}}</span>
|
||||
<span class="ast-ver">Owner: {{enrolmentInfo.owner}}</span>
|
||||
<span class="ast-published">{{status}}</span>
|
||||
|
||||
<div class="ast-btn-group">
|
||||
@ -28,13 +28,22 @@
|
||||
</span>
|
||||
<span class="lbl-action">View</span>
|
||||
</a>
|
||||
<a href="#" class="group-device-link" data-deviceid="{{deviceIdentifier}}" data-devicetype="{{type}}" data-devicename="{{name}}">
|
||||
<a href="/iotserver/analytics?deviceId={{deviceIdentifier}}&deviceType={{type}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-group fw-stack-1x"></i>
|
||||
<i class="fw fw-statistics fw-stack-1x"></i>
|
||||
</span>
|
||||
<span class="lbl-action">Group</span>
|
||||
<span class="lbl-action">Stats</span>
|
||||
</a>
|
||||
{{#if_owner enrolmentInfo.owner }}
|
||||
<a href="#" class="group-device-link" data-deviceid="{{deviceIdentifier}}" data-devicetype="{{type}}" data-devicename="{{name}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-grid fw-stack-1x"></i>
|
||||
</span>
|
||||
<span class="lbl-action">Group</span>
|
||||
</a>
|
||||
{{/if_owner}}
|
||||
<a href="#" class="edit-device-link" data-deviceid="{{deviceIdentifier}}" data-devicetype="{{type}}" data-devicename="{{name}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
{{#each groups}}
|
||||
{{groupMap this}}
|
||||
<div class="ast-container list-view">
|
||||
<div class="row wr-device-board list-view" style="font-size: inherit; background: #fff;">
|
||||
<div class="col-lg-12 wr-secondary-bar" style="width: inherit;">
|
||||
<label class="device-id device-select" style="font-size: 20px; margin-bottom: 0px;">
|
||||
{{#if name}}
|
||||
{{name}} Devices
|
||||
{{else}}
|
||||
Ungrouped Devices
|
||||
{{/if}}
|
||||
</label>
|
||||
</div>
|
||||
{{#if name}}
|
||||
<div class="ast-model">
|
||||
<a href="/iotserver/analytics?groupId={{id}}&name={{name}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-statistics fw-stack-1x"></i>
|
||||
</span>
|
||||
<span class="lbl-action">Stats</span>
|
||||
</a>
|
||||
<a href="#" class="share-group-link" data-groupid="{{id}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-share fw-stack-1x"></i>
|
||||
</span>
|
||||
<span class="lbl-action">Share</span>
|
||||
</a>
|
||||
<a href="#" class="edit-group-link" data-groupid="{{id}}" data-groupname="{{name}}"
|
||||
data-groupdescription="{{description}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-edit fw-stack-1x"></i>
|
||||
</span>
|
||||
<span class="lbl-action">Edit</span>
|
||||
</a>
|
||||
<a href="#" class="remove-group-link" data-groupid="{{id}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-delete fw-stack-1x"></i>
|
||||
</span>
|
||||
<span class="lbl-action">Delete</span>
|
||||
</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div id="ast-container-{{id}}" class="ast-container devices-set list-view">
|
||||
</div>
|
||||
<br/>
|
||||
{{/each}}
|
||||
|
||||
@ -8,8 +8,6 @@
|
||||
<p class="margin-bottom-double light-grey ">Connect your Digital Display device
|
||||
to the WSO2 device cloud. </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row margin-bottom-double">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top">
|
||||
<img src="{{self.publicURL}}/images/digital_display.png" class="img-responsive">
|
||||
</div>
|
||||
@ -20,11 +18,11 @@
|
||||
<br><br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Raspberry Pi<br><br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>HDMI Supported Digital Display
|
||||
<br /><br />
|
||||
<form method="POST" class="float-left margin-right"
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
{{#zone "main"}}
|
||||
<div class="container container-bg white-bg">
|
||||
<div class=" margin-top-double">
|
||||
<div class="row row padding-top-double padding-bottom-double margin-bottom-double">
|
||||
<div class="col-lg-12 margin-top-double">
|
||||
<h1 class="grey ">Device Events Stream</h1>
|
||||
<hr>
|
||||
<p class="margin-bottom-double light-grey ">Events Analyzer </p>
|
||||
</div>
|
||||
<div id="event-stream-place-holder" style="padding-top: 20px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/zone}}
|
||||
{{#zone "bottomJs"}}
|
||||
<script src="{{self.publicURL}}/js/events.js"></script>
|
||||
<script id="event-stream" src="{{self.publicURL}}/templates/event-stream.hbs"
|
||||
type="text/x-handlebars-template"></script>
|
||||
{{/zone}}
|
||||
@ -0,0 +1,6 @@
|
||||
function onRequest(context){
|
||||
var userModule = require("/modules/user.js").userModule;
|
||||
var permissions = userModule.getUIPermissions();
|
||||
context.permissions = permissions;
|
||||
return context;
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
$(document).ready(function () {
|
||||
displayEvents();
|
||||
});
|
||||
|
||||
var displayEvents = function () {
|
||||
var eventListing = $("#event-stream");
|
||||
var eventListingSrc = eventListing.attr("src");
|
||||
$.template("event-stream", eventListingSrc, function (template) {
|
||||
var serviceURL = "/iotserver/api/event/list";
|
||||
var successCallback = function (data) {
|
||||
var viewModel = {};
|
||||
viewModel.data = JSON.parse(data);
|
||||
var content = template(viewModel);
|
||||
$("#event-stream-place-holder").html(content);
|
||||
formatDates();
|
||||
};
|
||||
invokerUtil.get(serviceURL,
|
||||
successCallback, function (message) {
|
||||
console.log(message);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function formatDates() {
|
||||
$(".formatDate").each(function () {
|
||||
var timeStamp = $(this).html();
|
||||
$(this).html(new Date(parseInt(timeStamp)).toUTCString());
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
<div style="padding: 15px;">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Time</th>
|
||||
<th width="20%">Device</th>
|
||||
<th>Activity</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each data}}
|
||||
<tr>
|
||||
<td width="20%" class="formatDate">{{time}}</td>
|
||||
<td width="20%">{{deviceName}}</td>
|
||||
<td>{{activity}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -8,11 +8,9 @@
|
||||
<p class="margin-bottom-double light-grey ">Connect your Fire Alarm device
|
||||
to the WSO2 device cloud. </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row margin-bottom-double">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top">
|
||||
<img src="{{self.publicURL}}/images/firealarm.png" class="img-responsive">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6 col-md-8 col-lg-8 padding-top">
|
||||
<h2 class="uppercase">Ingredients</h2>
|
||||
<hr>
|
||||
@ -20,25 +18,25 @@
|
||||
<br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Raspberry Pi (Internet Enabled)
|
||||
 
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>DHT11 Temperature Sensor<br/><br/>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>LED
|
||||
       
|
||||
       
|
||||
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Buzzer(3v)<br><br>
|
||||
<a href="#" class="download-link btn-operations" data-devicetype="firealarm" data-sketchtype="firealarm">Download</a>
|
||||
<a href="#" class="download-link btn-operations" data-devicetype="firealarm" data-sketchtype="firealarm"><i class="fw fw-download"></i> Download</a>
|
||||
<!--form method="POST" class="form-login-box float-left"
|
||||
action="{{sketchPath}}">
|
||||
<input type="hidden" name="deviceType" value="firealarm" />
|
||||
|
||||
@ -1,213 +0,0 @@
|
||||
{{#zone "main"}}
|
||||
<div class="container container-bg white-bg">
|
||||
<div class=" margin-top-double">
|
||||
<div class="row row padding-top-double padding-bottom-double margin-bottom-double">
|
||||
<div class="col-lg-12 margin-top-double">
|
||||
<h1 class="grey ">Fire Alarm</h1>
|
||||
<hr>
|
||||
<p class="margin-bottom-double light-grey ">Connect your Fire Alarm device
|
||||
to the WSO2 device cloud. </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row margin-bottom-double">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top">
|
||||
<img src="{{self.publicURL}}/images/firealarm.png" class="img-responsive">
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6 col-md-8 col-lg-8 padding-top">
|
||||
<h2 class="uppercase">Ingredients</h2>
|
||||
<hr>
|
||||
<p class="grey margin-top">Hardware Requirements </p>
|
||||
<br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
</span>Raspberry Pi (Internet Enabled)
|
||||
 
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
</span>DHT11 Temperature Sensor<br/><br/>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
</span>LED
|
||||
       
|
||||
       
|
||||
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
</span>Buzzer(3v)<br><br>
|
||||
<a href="#" class="download-link btn-operations" data-devicetype="firealarm" data-sketchtype="firealarm">Download</a>
|
||||
<!--form method="POST" class="form-login-box float-left"
|
||||
action="{{sketchPath}}">
|
||||
<input type="hidden" name="deviceType" value="firealarm" />
|
||||
<input type="hidden" name="sketchType" value="firealarm" />
|
||||
<button class="wr-btn margin-right" type="submit">Create
|
||||
Sketch
|
||||
for Ethernet</button>
|
||||
</form-->
|
||||
<br/>
|
||||
|
||||
</div>
|
||||
<div class ="col-xs-12 col-sm-6 col-md-3 col-lg-12 padding-double grey-bg ">
|
||||
<h2 class="uppercase">Prepare</h2><hr>
|
||||
<p class="grey margin-top"><b>Get your device ready</b></p>
|
||||
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
|
||||
<span class="circle">01 </span> <span class="padding-left"><b>Set up your RaspberryPi device as shown in the schematic below and get the FireAlarm setup.</b></span>
|
||||
</div>
|
||||
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom">
|
||||
<span class="circle">02 </span> <span class="padding-left"><b>Connect a monitor to your RaspberryPi via the HDMI cable to get a UI view of the device.</b></span>
|
||||
</div>
|
||||
<div class="margin-doubles padding-top-double margin-bottom-double light-grey margin-left-double margin-bottom">
|
||||
<span class="circle">03 </span> <span class="padding-left"><b>Get the RaspberryPi to connect to the internet (via Ethernet or Wifi) and note its IP_ADDRESS</b></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class ="col-xs-12 col-sm-6 col-md-3 col-lg-12 padding-double grey-bg ">
|
||||
<h2 class="uppercase">Schematic Diagram</h2><hr>
|
||||
<p class="grey margin-top">Click on the image to zoom</p>
|
||||
<center>
|
||||
<a href="{{self.publicURL}}/images/schematicsGuide.png" target="_blank">
|
||||
<img src="{{self.publicURL}}/images/schematicsGuide.png" class="img-responsive" style="max-width: 500px; max-height: 500px" />
|
||||
</a>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row padding-top-double padding-bottom-double margin-bottom-double ">
|
||||
<div class="col-lg-12 margin-top-double">
|
||||
<h2 class="uppercase ">Connect (Quickstart)</h2>
|
||||
<hr>
|
||||
<p class="margin-bottom-double light-grey ">Internet of Things Foundation Quickstart connection </p>
|
||||
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
|
||||
<span class="circle">01 </span> <span class="padding-left"><b>Click on the <i>"Create DEB"</i> button above to get the download link for the FireAlarm setup files</b></span><br>
|
||||
</div>
|
||||
<br>
|
||||
<div>
|
||||
<span class="padding-left"><i>(The following commands can be issued by directly typing into the terminal of the device or by an <b>"ssh"</b> login from a remote PC)</i></span>
|
||||
</div>
|
||||
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
|
||||
<span class="circle">02 </span> <span class="padding-left"><b>Download the FireAlarm setup files using the following command: "wget <url_link_received_from_the_above_step>"</b></span><br>
|
||||
<i> This will download a zip file named "FireAlarmAgent.zip"</i>
|
||||
</div>
|
||||
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
|
||||
<span class="circle">03 </span> <span class="padding-left"><b>Run the following commands to successfuly install the package and get the service running:</b></span><br>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
|
||||
<span class="circle">04 </span> <span class="padding-left">Use the Sketch program to open the samples code samples/quickstart/quickstart.ino</span><br>
|
||||
</div>
|
||||
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
|
||||
<span class="circle">05 </span> <span class="padding-left">View the lower part of the Sketch pad window to check that the COM connection is shown as active</span><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="download-device-modal-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Please download the file from following link.</h3>
|
||||
<br/>
|
||||
<div class="buttons">
|
||||
<form method="POST" action="{{sketchPath}}">
|
||||
<input type="hidden" name="deviceType" value="firealarm" />
|
||||
<input type="hidden" name="sketchType" value="firealarm" />
|
||||
<button class="btn-operations" type="submit" style="font-size: 13px;border:none; padding: 10px 10px; display: inline-block; margin-right: 2px; text-decoration: none;">Download Now</button>
|
||||
|
||||
<a href="#" id="download-device-download-link" class="btn-operations">
|
||||
Copy Link
|
||||
</a>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="download-device-modal-content-links" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Please download the file from following link(Press CTRL+C).</h3>
|
||||
<br/>
|
||||
<div>
|
||||
<input id="download-device-url" style="color:#3f3f3f;padding:5px" type="text" value="" placeholder="Type here" size="60">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="device-400-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Exception at backend. Try Later.</h3>
|
||||
<div class="buttons">
|
||||
<a href="#" id="device-400-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="device-403-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Action not permitted.</h3>
|
||||
<div class="buttons">
|
||||
<a href="#" id="device-403-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="device-409-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Device Sketch does not exist.</h3>
|
||||
<div class="buttons">
|
||||
<a href="#" id="device-409-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="device-unexpected-error-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Unexpected error.</h3>
|
||||
<div class="buttons">
|
||||
<a href="#" id="device-unexpected-error-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{/zone}}
|
||||
{{#zone "topCss"}}
|
||||
<link href="{{self.publicURL}}/css/fontwso2.css" rel="stylesheet">
|
||||
<link href="{{self.publicURL}}/css/fontwso2-extend.css" rel="stylesheet">
|
||||
{{/zone}}
|
||||
{{#zone "bottomJs"}}
|
||||
<script src="{{self.publicURL}}/js/firealarm.js"></script>
|
||||
{{/zone}}
|
||||
@ -73,12 +73,20 @@ function attachEvents() {
|
||||
payload,
|
||||
function (data, textStatus, jqxhr) {
|
||||
if(jqxhr.status == 200) {
|
||||
$(modalPopupContent).html($('#download-device-modal-content-links').html());
|
||||
$("#download-device-url").val(data);
|
||||
$("#download-device-url").focus(function () {
|
||||
$(this).select();
|
||||
});
|
||||
showPopup();
|
||||
if(data == "403"){
|
||||
$(modalPopupContent).html($('#device-403-content').html());
|
||||
$("#device-403-link").click(function () {
|
||||
window.location = "/iotserver/login";
|
||||
});
|
||||
showPopup();
|
||||
}else {
|
||||
$(modalPopupContent).html($('#download-device-modal-content-links').html());
|
||||
$("#download-device-url").val(data);
|
||||
$("#download-device-url").focus(function () {
|
||||
$(this).select();
|
||||
});
|
||||
showPopup();
|
||||
}
|
||||
}else{
|
||||
$(modalPopupContent).html($('#device-403-content').html());
|
||||
$("#device-403-link").click(function () {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{{#zone "footer"}}
|
||||
<footer class="footer">
|
||||
<p>
|
||||
WSO2 IOT Device Manager v.1.0.0 | © <script>document.write(new Date().getFullYear());</script> <a href="http://wso2.com/" target="_blank"><i class="fw fw-wso2"></i> Inc</a>. All Rights Reserved.
|
||||
WSO2 IoT Device Manager v.1.0.0 | © <script>document.write(new Date().getFullYear());</script> <a href="http://wso2.com/" target="_blank"><i class="fw fw-wso2"></i> Inc</a>. All Rights Reserved.
|
||||
</p>
|
||||
</footer>
|
||||
{{/zone}}
|
||||
@ -60,7 +60,7 @@
|
||||
href="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
|
||||
<i class="fw fw-arrow fw-down fw-stack-1x"></i>
|
||||
</span>
|
||||
Group Statistics
|
||||
</a>
|
||||
@ -69,7 +69,7 @@
|
||||
<div id="collapseFour" class="panel-collapse collapse" role="tabpanel"
|
||||
aria-labelledby="headingFour">
|
||||
<div class="panel-body">
|
||||
<a href="/iotserver/groups/analytics?groupId={{group.id}}"><i class="fw fw-charts"></i>
|
||||
<a href="/iotserver/analytics?groupId={{group.id}}&name={{group.name}}"><i class="fw fw-charts"></i>
|
||||
Show Statistics</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -83,7 +83,7 @@
|
||||
href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
|
||||
<i class="fw fw-arrow fw-down fw-stack-1x"></i>
|
||||
</span>
|
||||
Group Devices
|
||||
</a>
|
||||
|
||||
@ -38,13 +38,13 @@
|
||||
<h3>Select user to manage group sharing</h3>
|
||||
<div id="user-names">Loading...</div>
|
||||
<div class="buttons">
|
||||
<a href="#" id="share-group-w1-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
|
||||
<a href="#" id="share-group-next-link" class="btn-operations">
|
||||
Next
|
||||
</a>
|
||||
|
||||
<a href="#" id="share-group-w1-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -59,13 +59,13 @@
|
||||
<br />
|
||||
<div id="user-roles">Loading...</div>
|
||||
<div class="buttons">
|
||||
<a href="#" id="share-group-w2-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
|
||||
<a href="#" id="share-group-yes-link" class="btn-operations">
|
||||
OK
|
||||
</a>
|
||||
|
||||
<a href="#" id="share-group-w2-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -77,12 +77,6 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Group sharing updated successfully.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="share-group-200-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -113,12 +107,6 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Group was successfully removed.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="remove-group-200-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -160,12 +148,6 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Group successfully added.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="add-group-200-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -207,12 +189,6 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Group was successfully updated.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="edit-group-200-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -64,7 +64,14 @@ $(document).ready(function () {
|
||||
return $("#content-filter-types").html();
|
||||
}
|
||||
});
|
||||
changeGroupView('grid', this);
|
||||
|
||||
loadGroups();
|
||||
changeGroupView('grid', $('a.ctrl-filter-grid'));
|
||||
|
||||
var path = window.location.pathname;
|
||||
if (path == '/iotserver/groups/add-group'){
|
||||
addNewGroup();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
@ -168,9 +175,6 @@ function loadGroups(searchType, searchParam) {
|
||||
});
|
||||
});
|
||||
}
|
||||
$(document).ready(function () {
|
||||
loadGroups();
|
||||
});
|
||||
|
||||
function formatDates() {
|
||||
$(".formatDate").each(function () {
|
||||
@ -236,58 +240,60 @@ function attachGroupAdding() {
|
||||
* when a user clicks on "Remove" link
|
||||
* on Group Management page in WSO2 IoT Server Console.
|
||||
*/
|
||||
$("a.add-group-link").click(function () {
|
||||
var addGroupApi = "/iotserver/api/group/add";
|
||||
$(modalPopupContent).html($('#add-group-modal-content').html());
|
||||
showPopup();
|
||||
$("a.add-group-link").click(addNewGroup);
|
||||
}
|
||||
|
||||
$("a#add-group-yes-link").click(function () {
|
||||
var newGroupName = $('#add-group-name').val();
|
||||
var newGroupDescription = $('#add-group-description').val();
|
||||
var group = {"name": newGroupName, "description": newGroupDescription};
|
||||
invokerUtil.post(
|
||||
addGroupApi,
|
||||
group,
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
if (data != "false") {
|
||||
$(modalPopupContent).html($('#add-group-200-content').html());
|
||||
$("a#add-group-200-link").click(function () {
|
||||
hidePopup();
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
$(modalPopupContent).html($('#group-400-content').html());
|
||||
$("a#group-400-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
} else if (status == 400) {
|
||||
var addNewGroup = function () {
|
||||
var addGroupApi = "/iotserver/api/group/add";
|
||||
$(modalPopupContent).html($('#add-group-modal-content').html());
|
||||
showPopup();
|
||||
|
||||
$("a#add-group-yes-link").click(function () {
|
||||
var newGroupName = $('#add-group-name').val();
|
||||
var newGroupDescription = $('#add-group-description').val();
|
||||
var group = {"name": newGroupName, "description": newGroupDescription};
|
||||
invokerUtil.post(
|
||||
addGroupApi,
|
||||
group,
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
if (data != "false") {
|
||||
$(modalPopupContent).html($('#add-group-200-content').html());
|
||||
loadGroups();
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
}, 2000);
|
||||
} else {
|
||||
$(modalPopupContent).html($('#group-400-content').html());
|
||||
$("a#group-400-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 403) {
|
||||
$(modalPopupContent).html($('#agroup-403-content').html());
|
||||
$("a#group-403-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 409) {
|
||||
$(modalPopupContent).html($('#group-409-content').html());
|
||||
$("a#group-409-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
}, errorHandler
|
||||
);
|
||||
});
|
||||
|
||||
$("a#add-group-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
|
||||
} else if (status == 400) {
|
||||
$(modalPopupContent).html($('#group-400-content').html());
|
||||
$("a#group-400-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 403) {
|
||||
$(modalPopupContent).html($('#agroup-403-content').html());
|
||||
$("a#group-403-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (status == 409) {
|
||||
$(modalPopupContent).html($('#group-409-content').html());
|
||||
$("a#group-409-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
}, errorHandler
|
||||
);
|
||||
});
|
||||
|
||||
$("a#add-group-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,8 +305,9 @@ function attachEvents() {
|
||||
* when a user clicks on "Share" link
|
||||
* on Group Management page in WSO2 IoT Server Console.
|
||||
*/
|
||||
$("a.view-group-link").click(function () {
|
||||
$("#group_data").closest('form').submit();
|
||||
$(".view-group-link").click(function () {
|
||||
var groupId = $(this).data("groupid");
|
||||
$("#group-data-form-" + groupId).closest('form').submit();
|
||||
});
|
||||
|
||||
/**
|
||||
@ -366,7 +373,7 @@ function attachEvents() {
|
||||
$("a#share-group-yes-link").click(function () {
|
||||
var updatedRoleMap = [];
|
||||
for (var role in roleMap) {
|
||||
if ($('#user-role-' + roleMap[role].role).is(':checked') != roleMap[role].assigned){
|
||||
if ($('#user-role-' + roleMap[role].role).is(':checked') != roleMap[role].assigned) {
|
||||
roleMap[role].assigned = $('#user-role-' + roleMap[role].role).is(':checked');
|
||||
updatedRoleMap.push(roleMap[role]);
|
||||
}
|
||||
@ -377,10 +384,11 @@ function attachEvents() {
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
$(modalPopupContent).html($('#share-group-200-content').html());
|
||||
$("a#share-group-200-link").click(function () {
|
||||
loadGroups();
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}else {
|
||||
}, 2000);
|
||||
} else {
|
||||
displayErrors(status);
|
||||
}
|
||||
}, errorHandler);
|
||||
@ -422,19 +430,11 @@ function attachEvents() {
|
||||
function (data, txtStatus, jqxhr) {
|
||||
var status = jqxhr.status;
|
||||
if (status == 200) {
|
||||
if (data != "false") {
|
||||
$(modalPopupContent).html($('#remove-group-200-content').html());
|
||||
$('div[data-group="' + groupId + '"]').remove();
|
||||
$("a#remove-group-200-link").click(function () {
|
||||
hidePopup();
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
$(modalPopupContent).html($('#group-409-content').html());
|
||||
$("a#group-409-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
$(modalPopupContent).html($('#remove-group-200-content').html());
|
||||
loadGroups();
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
}, 2000);
|
||||
} else {
|
||||
displayErrors(status);
|
||||
}
|
||||
@ -483,9 +483,9 @@ function attachEvents() {
|
||||
if (data != "false") {
|
||||
$(modalPopupContent).html($('#edit-group-200-content').html());
|
||||
$("div[data-groupid='" + groupId + "'] .ast-name").html(newGroupName);
|
||||
$("a#edit-group-200-link").click(function () {
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}, 2000);
|
||||
} else {
|
||||
$(modalPopupContent).html($('#group-409-content').html());
|
||||
$("a#group-409-link").click(function () {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{{#each groups}}
|
||||
{{groupMap this}}
|
||||
<form action="/iotserver/group/{{id}}" method="POST" id="group_data" >
|
||||
<form id="group-data-form-{{id}}" action="/iotserver/group/{{id}}" method="POST">
|
||||
<input type="hidden" name="name" value="{{name}}">
|
||||
<input type="hidden" name="deviceCount" value="{{deviceCount}}">
|
||||
<input type="hidden" name="dateOfCreation" value="{{dateOfCreation}}">
|
||||
@ -9,7 +9,7 @@
|
||||
<input type="hidden" name="users" value="{{users}}">
|
||||
</form>
|
||||
|
||||
<div class="ctrl-wr-asset" data-groupid="{{id}}">
|
||||
<div href="#" class="ctrl-wr-asset" data-groupid="{{id}}">
|
||||
<div class="itm-select">
|
||||
<label class="wr-input-control checkbox">
|
||||
<input type="checkbox"/>
|
||||
@ -17,24 +17,38 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="itm-ast">
|
||||
<div class="ast-img"><img src="{{../imageLocation}}group-icon.png"/></div>
|
||||
<div class="ast-img view-group-link" data-groupid="{{id}}"><img src="{{../imageLocation}}group-icon.png"/></div>
|
||||
<div class="ast-desc">
|
||||
<div class="ast-title">
|
||||
<div class="ast-title view-group-link" data-groupid="{{id}}">
|
||||
<h3 class="ast-name">{{name}}</h3>
|
||||
<span class="ast-auth">Device Count: {{deviceCount}}</span>
|
||||
<span class="ast-auth">Created On: <span class="formatDate">{{dateOfCreation}}</span></span>
|
||||
<span class="ast-ver">Shared with: {{users}}</span>
|
||||
</div>
|
||||
<div class="ast-model">
|
||||
<span class="ast-ver">Shared with: {{users}}</span>
|
||||
|
||||
<div href="#" class="ast-btn-group">
|
||||
<a class="view-group-link" data-group="{{this}}">
|
||||
<div class="ast-btn-group">
|
||||
<a href="#" data-groupid="{{id}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-view fw-stack-1x"></i>
|
||||
</span>
|
||||
<span class="lbl-action">View</span>
|
||||
</a>
|
||||
<a href="/iotserver/devices?groupId={{id}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-devices fw-stack-1x"></i>
|
||||
</span>
|
||||
<span class="lbl-action">Devices</span>
|
||||
</a>
|
||||
<a href="/iotserver/analytics?groupId={{id}}&name={{name}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-statistics fw-stack-1x"></i>
|
||||
</span>
|
||||
<span class="lbl-action">Stats</span>
|
||||
</a>
|
||||
<a href="#" class="share-group-link" data-groupid="{{id}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
|
||||
@ -12,12 +12,12 @@
|
||||
<form method="POST" class="form-login-box" action="{{loginPath}}">
|
||||
<label class="wr-input-label">Username</label>
|
||||
<div class="wr-input-control">
|
||||
<input name="username" type="text" value="" placeholder="input text"/>
|
||||
<input name="username" type="text" value="" placeholder="Enter username"/>
|
||||
</div>
|
||||
|
||||
<label class="wr-input-label">Password</label>
|
||||
<div class="wr-input-control">
|
||||
<input name="password" type="password" value="" placeholder="input text"/>
|
||||
<input name="password" type="password" value="" placeholder="Enter password"/>
|
||||
</div>
|
||||
|
||||
<div class="wr-input-control">
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{{#zone "main"}}
|
||||
<a href="javascript:toggleMoreOperations()" class="cu-btn-inner show-operations-btn hidden" id="showOperationsBtn">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1-5x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1-5x"></i>
|
||||
</span>
|
||||
<span class="btn-text">Operations</span>
|
||||
</a>
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
<h1 class="wr-title">Policy creation is successful</h1>
|
||||
Please click <b>"Finish"</b> to complete the process and go back to the policy list
|
||||
<hr />
|
||||
<button class="wr-btn wizard-stepper" data-current="policy-message" data-direct="/mdm/policies/" onclick="window.location.href=''">
|
||||
<button class="wr-btn wizard-stepper" data-current="policy-message" data-direct="/iotserver/policies/" onclick="window.location.href='/iotserver/policies/'">
|
||||
Finish
|
||||
</button>
|
||||
|
||||
@ -92,7 +92,7 @@
|
||||
</label>
|
||||
<div class="wr-input-control">
|
||||
<div class="cus-col-50">
|
||||
<input id="policy-name-input" type="text" value="" placeholder="input text"/>
|
||||
<input id="policy-name-input" type="text" value="" placeholder="Policy name here" required/>
|
||||
</div>
|
||||
<br class="c-both" />
|
||||
</div>
|
||||
@ -103,7 +103,7 @@
|
||||
</label>
|
||||
<div class="wr-input-control">
|
||||
<div class="cus-col-50">
|
||||
<textarea id="policy-description-input" placeholder="description"></textarea>
|
||||
<textarea id="policy-description-input" placeholder="Policy description here" required></textarea>
|
||||
</div>
|
||||
<br class="c-both" />
|
||||
</div>
|
||||
@ -134,7 +134,7 @@
|
||||
</label>
|
||||
<div class="wr-input-control">
|
||||
<div class="cus-col-100">
|
||||
<textarea id="policy-definition-input" placeholder="Enter the policy" style="width: 100%;"></textarea>
|
||||
<textarea id="policy-definition-input" placeholder="Enter the policy" style="width: 100%;" required></textarea>
|
||||
</div>
|
||||
<br class="c-both" />
|
||||
</div>
|
||||
@ -155,7 +155,7 @@
|
||||
|
||||
<div class="row wr-wizard">
|
||||
<div class="col-md-4 col-xs-4">
|
||||
<div class="itm-wiz itm-wiz-current" data-step="policy-devicetype"><div class="wiz-no">1</div><div class="wiz-lbl hidden-xs"><span>Select Platform</span></div></div>
|
||||
<div class="itm-wiz itm-wiz-current" data-step="policy-devicetype"><div class="wiz-no">1</div><div class="wiz-lbl hidden-xs"><span>Select Device Type</span></div></div>
|
||||
<br class="c-both" />
|
||||
</div>
|
||||
<div class="col-md-4 col-xs-4">
|
||||
|
||||
21
modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/js/policy-create.js
Normal file → Executable file
21
modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/js/policy-create.js
Normal file → Executable file
@ -57,20 +57,20 @@ function savePolicy(){
|
||||
profile: {
|
||||
profileName: policy.policyName,
|
||||
deviceType: {
|
||||
id: policy.devicetypeId
|
||||
id: policy.devicetypeId,
|
||||
name: policy.devicetype
|
||||
},
|
||||
policyDefinition: policy.policyDefinition
|
||||
policyDefinition: policy.policyDefinition,
|
||||
policyDescription: policy.policyDescription
|
||||
}
|
||||
};
|
||||
|
||||
console.log(payload);
|
||||
invokerUtil.post("/iotserver/api/policies/add", payload, function(){
|
||||
$(".policy-message").removeClass("hidden");
|
||||
$(".add-policy").addClass("hidden");
|
||||
}, function(){
|
||||
|
||||
//invokerUtil.post("/iotserver/policy-api/policy/add", payload, function(){
|
||||
// $(".policy-message").removeClass("hidden");
|
||||
// $(".add-policy").addClass("hidden");
|
||||
//}, function(){
|
||||
//
|
||||
//});
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
@ -104,8 +104,7 @@ $(document).ready(function(){
|
||||
savePolicy();
|
||||
};
|
||||
stepperRegistry['policy-profile'] = function (actionButton){
|
||||
var deviceType = policy.devicetype;
|
||||
policy.policyDefinition = $("#policy-definition-input").val();
|
||||
policy.policyDefinition = window.queryEditor.getValue();
|
||||
};
|
||||
stepperRegistry['policy-devicetype'] = function (actionButton){
|
||||
policy.devicetype = $(actionButton).data("devicetype");
|
||||
|
||||
@ -3,42 +3,47 @@
|
||||
<div class="col-md-12">
|
||||
<!-- content -->
|
||||
<div class="wr-content">
|
||||
<p class="page-sub-title">Policies</p>
|
||||
<p>{{listPolicyStatus}}</p>
|
||||
|
||||
<div class="wr-list-group wr-sortable">
|
||||
{{#if policies}}
|
||||
{{#each policies}}
|
||||
<span id="{{id}}" class="list-group-item">
|
||||
<i class="wr-sortable-icon fw fw-sort hide"></i>
|
||||
<i class="wr-list-icon fw fw-user"></i>
|
||||
<div class="wr-list-desc">
|
||||
<h3 class="wr-list-name">{{policyName}}</h3>
|
||||
<span class="wr-list-username">{{policyName}}</span>
|
||||
</div>
|
||||
<span class="list-group-item-actions">
|
||||
<!--a href="#" class="invite-user-link cu-btn-inner" data-policyname="{{policyName}}">
|
||||
{{#if policies}}
|
||||
{{#each policies}}
|
||||
<span id="{{id}}" class="list-group-item">
|
||||
<i class="wr-sortable-icon fw fw-sort hide"></i>
|
||||
<i class="wr-list-icon fw fw-user"></i>
|
||||
<div class="wr-list-desc">
|
||||
<h3 class="wr-list-name">{{policyName}}</h3>
|
||||
<span class="wr-list-username">{{deviceType}} | Last Updated: <span
|
||||
class="formatDate">{{updated}}</span></span>
|
||||
</div>
|
||||
<span class="list-group-item-actions">
|
||||
<!--a href="#" class="invite-user-link cu-btn-inner" data-policyname="{{policyName}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-invitation fw-stack-1x"></i>
|
||||
</span>
|
||||
Invite
|
||||
</a-->
|
||||
<a href="#" class="remove-policy-link cu-btn-inner"
|
||||
data-devicetype="{{deviceType}}"
|
||||
data-policyname="{{policyName}}"
|
||||
data-policyuuid="{{id}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-invitation fw-stack-1x"></i>
|
||||
<i class="fw fw-delete fw-stack-1x"></i>
|
||||
</span>
|
||||
Invite
|
||||
</a-->
|
||||
<a href="#" class="remove-user-link cu-btn-inner" data-policyname="{{policyName}}">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-delete fw-stack-1x"></i>
|
||||
Remove
|
||||
</a>
|
||||
</span>
|
||||
Remove
|
||||
</a>
|
||||
<div class="clearfix"></div>
|
||||
</span>
|
||||
<div class="clearfix"></div>
|
||||
</span>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<!-- no policies found -->
|
||||
<div class="container-fluid wr-content-alt">
|
||||
<div class="ctrl-info-panel col-md-6 col-centered">
|
||||
<h2>You don't have any Policies added at the moment.</h2>
|
||||
|
||||
<p>
|
||||
</a><a href="/iotserver/policies/add-policy" class="cu-btn">
|
||||
<span class="fw-stack">
|
||||
@ -51,7 +56,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- /no policies found -->
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<!-- /content -->
|
||||
@ -59,13 +64,113 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div id="remove-policy-modal-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Do you really want to remove this policy from IoT Server?</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="remove-policy-yes-link" class="btn-operations">
|
||||
Yes
|
||||
</a>
|
||||
|
||||
<a href="#" id="remove-policy-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="remove-policy-200-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Policy was successfully removed.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="remove-policy-200-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="remove-policy-400-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Exception at backend. Try Later.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="remove-policy-400-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="remove-policy-403-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Action not permitted.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="remove-policy-403-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="remove-policy-409-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Policy does not exist.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="remove-policy-409-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="remove-policy-unexpected-error-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Policy does not exist.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="remove-policy-unexpected-error-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{{/zone}}
|
||||
{{#zone "common-navigation"}}
|
||||
<!--Later add the navigation menu from here-->
|
||||
{{/zone}}
|
||||
{{#zone "action-bar"}}
|
||||
{{#if permissions.ADD_POLICY}}
|
||||
<a href="/iotserver/policies/add-policy" class="cu-btn">
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
@ -73,7 +178,6 @@
|
||||
</span>
|
||||
Add Policy
|
||||
</a>
|
||||
{{/if}}
|
||||
{{/zone}}
|
||||
{{#zone "bottomJs"}}
|
||||
<script src="{{self.publicURL}}/js/policy-listing.js"></script>
|
||||
|
||||
@ -2,14 +2,16 @@ function onRequest(context) {
|
||||
// var log = new Log("policy-listing");
|
||||
var policyModule = require("/modules/policy.js").policyModule;
|
||||
var allPolicies = policyModule.getPolicies();
|
||||
//log.info((allPolicies));
|
||||
if (!allPolicies || allPolicies.length == 0) {
|
||||
context.policies = [];
|
||||
context.listPolicyStatus = "Oops, Sorry, No other Policies found.";
|
||||
context.listPolicyStatus = "";
|
||||
} else {
|
||||
var i, filteredPoliciesList = [];
|
||||
for (i = 0; i < allPolicies.length; i++) {
|
||||
filteredPoliciesList.push(allPolicies[i]);
|
||||
}
|
||||
//log.info(filteredPoliciesList.length);
|
||||
context.policies = filteredPoliciesList;
|
||||
context.listPolicyStatus = "Total number of Policies found : " + filteredPoliciesList.length;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
$(function () {
|
||||
var sortableElem = '.wr-sortable';
|
||||
$(sortableElem).sortable({
|
||||
beforeStop : function () {
|
||||
beforeStop: function () {
|
||||
var sortedIDs = $(this).sortable('toArray');
|
||||
console.log(sortedIDs);
|
||||
}
|
||||
@ -22,8 +22,8 @@ var body = "body";
|
||||
* set popup maximum height function.
|
||||
*/
|
||||
function setPopupMaxHeight() {
|
||||
$(modalPopupContent).css('max-height', ($(body).height() - ($(body).height()/100 * 30)));
|
||||
$(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height()/2)));
|
||||
$(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30)));
|
||||
$(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -42,90 +42,74 @@ function hidePopup() {
|
||||
$(modalPopup).hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Following click function would execute
|
||||
* when a user clicks on "Invite" link
|
||||
* on User Management page in WSO2 MDM Console.
|
||||
*/
|
||||
$("a.invite-user-link").click(function () {
|
||||
var username = $(this).data("username");
|
||||
var inviteUserAPI = "/iotserver/api/users/" + username + "/invite";
|
||||
|
||||
$(modalPopupContent).html($('#invite-user-modal-content').html());
|
||||
showPopup();
|
||||
|
||||
$("a#invite-user-yes-link").click(function () {
|
||||
invokerUtil.get(
|
||||
inviteUserAPI,
|
||||
function () {
|
||||
$(modalPopupContent).html($('#invite-user-success-content').html());
|
||||
$("a#invite-user-success-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
},
|
||||
function () {
|
||||
$(modalPopupContent).html($('#invite-user-error-content').html());
|
||||
$("a#invite-user-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$("a#invite-user-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
$(document).ready(function () {
|
||||
formatDates();
|
||||
});
|
||||
|
||||
function formatDates() {
|
||||
$(".formatDate").each(function () {
|
||||
var timeStamp = $(this).html();
|
||||
$(this).html(new Date(parseFloat(timeStamp)).toUTCString());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Following click function would execute
|
||||
* when a user clicks on "Remove" link
|
||||
* on User Management page in WSO2 MDM Console.
|
||||
*/
|
||||
$("a.remove-user-link").click(function () {
|
||||
var username = $(this).data("username");
|
||||
var removeUserAPI = "/iotserver/api/users/" + username + "/remove";
|
||||
$("a.remove-policy-link").click(function () {
|
||||
var deviceType = $(this).data("devicetype");
|
||||
var policyName = $(this).data("policyname");
|
||||
var policyUUID = $(this).data("policyuuid");
|
||||
///{context}/api/policies/{deviceType}/{policyName}/remove
|
||||
var removePolicyAPI = "/iotserver/api/policies/" + deviceType + "/" + policyName + "/remove";
|
||||
|
||||
$(modalPopupContent).html($('#remove-user-modal-content').html());
|
||||
$(modalPopupContent).html($('#remove-policy-modal-content').html());
|
||||
showPopup();
|
||||
|
||||
$("a#remove-user-yes-link").click(function () {
|
||||
$("a#remove-policy-yes-link").click(function () {
|
||||
invokerUtil.get(
|
||||
removeUserAPI,
|
||||
removePolicyAPI,
|
||||
function (data) {
|
||||
if (data == 200) {
|
||||
$("#" + username).addClass("hide");
|
||||
$(modalPopupContent).html($('#remove-user-200-content').html());
|
||||
$("a#remove-user-200-link").click(function () {
|
||||
if (data == 200 || data == "true") {
|
||||
$(modalPopupContent).html($('#remove-policy-200-content').html());
|
||||
$('#' + policyUUID).remove();
|
||||
$("a#remove-policy-200-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (data == 400) {
|
||||
$(modalPopupContent).html($('#remove-user-400-content').html());
|
||||
$("a#remove-user-400-link").click(function () {
|
||||
$(modalPopupContent).html($('#remove-policy-400-content').html());
|
||||
$("a#remove-policy-400-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (data == 403) {
|
||||
$(modalPopupContent).html($('#remove-user-403-content').html());
|
||||
$("a#remove-user-403-link").click(function () {
|
||||
$(modalPopupContent).html($('#remove-policy-403-content').html());
|
||||
$("a#remove-policy-403-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (data == 409) {
|
||||
$(modalPopupContent).html($('#remove-user-409-content').html());
|
||||
$("a#remove-user-409-link").click(function () {
|
||||
} else if (data == 409 || data == "false") {
|
||||
$(modalPopupContent).html($('#remove-policy-409-content').html());
|
||||
$("a#remove-policy-409-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
} else if (data == 500) {
|
||||
$(modalPopupContent).html($('#remove-policy-unexpected-content').html());
|
||||
$("a#remove-policy-unexpected-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
},
|
||||
function () {
|
||||
$(modalPopupContent).html($('#remove-user-unexpected-error-content').html());
|
||||
$("a#remove-user-unexpected-error-link").click(function () {
|
||||
$(modalPopupContent).html($('#remove-policy-unexpected-error-content').html());
|
||||
$("a#remove-policy-unexpected-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$("a#remove-user-cancel-link").click(function () {
|
||||
$("a#remove-policy-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
});
|
||||
@ -8,8 +8,6 @@
|
||||
<p class="margin-bottom-double light-grey ">Connect your Raspberry Pi device
|
||||
to the WSO2 Device Cloud. </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row margin-bottom-double">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top">
|
||||
<img src="{{self.publicURL}}/images/raspberrypi.png" class="img-responsive">
|
||||
</div>
|
||||
@ -20,7 +18,7 @@
|
||||
<br><br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Raspberry Pi<br><br>
|
||||
<form method="POST" class="form-login-box"
|
||||
action="{{sketchPath}}">
|
||||
|
||||
@ -8,8 +8,6 @@
|
||||
<p class="margin-bottom-double light-grey ">Connect your Sensebot
|
||||
to the WSO2 device cloud. </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row margin-bottom-double">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top">
|
||||
<img src="{{self.publicURL}}/images/sensebot.png" class="img-responsive">
|
||||
</div>
|
||||
@ -20,11 +18,11 @@
|
||||
<br><br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Arduino Uno<br><br>
|
||||
<span class="fw-stack fw-lg margin-right">
|
||||
<i class="fw fw-ring fw-stack-2x"> </i>
|
||||
<i class="fw fw-right-arrow-2 fw-stack-1x"></i>
|
||||
<i class="fw fw-right-arrow fw-stack-1x"></i>
|
||||
</span>Arduino Ethernet / WiFi Shield
|
||||
<br /><br />
|
||||
<form method="POST" class="float-left margin-right"
|
||||
|
||||
@ -2,43 +2,20 @@
|
||||
|
||||
<!-- anonymous landing page -->
|
||||
<div class="container wr-content-alt">
|
||||
<!--<div class="row wr-wizard">-->
|
||||
<!--<div class="col-md-4 col-xs-4">-->
|
||||
<!--<div class="itm-wiz">-->
|
||||
<!--<div class="wiz-no"><img src="{{self.publicURL}}/images/step-01.png"></div>-->
|
||||
<!--<div class="wiz-lbl hidden-xs"><span>Select your Device</span></div>-->
|
||||
<!--</div>-->
|
||||
<!--<br class="c-both"/>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="col-md-4 col-xs-4">-->
|
||||
<!--<div class="itm-wiz">-->
|
||||
<!--<div class="wiz-no"><img src="{{self.publicURL}}/images/step-02.png"></div>-->
|
||||
<!--<div class="wiz-lbl hidden-xs"><span>Enroll your Device</span></div>-->
|
||||
<!--</div>-->
|
||||
<!--<br class="c-both"/>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="col-md-4 col-xs-4">-->
|
||||
<!--<div class="itm-wiz">-->
|
||||
<!--<div class="wiz-no"><img src="{{self.publicURL}}/images/step-03.png"></div>-->
|
||||
<!--<div class="wiz-lbl hidden-xs"><span>Manage your Device</span></div>-->
|
||||
<!--</div>-->
|
||||
<!--<br class="c-both"/>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="row wr-wizard">
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-xs-4 col-md-offset-1">
|
||||
<div class="itm-wiz"><div class="wiz-no col-md-offset-2"><img src="{{self.publicURL}}/images/step-01.png" style="width:85px" ></div><div class="wiz-lbl hidden-xs"><span>Select your Device</span></div></div>
|
||||
<div class="itm-wiz"><div class="col-md-offset-2"><img src="{{self.publicURL}}/images/step-01.png" style="width:85px" ></div><div class="wiz-lbl hidden-xs"><span>Select your Device</span></div></div>
|
||||
<br class="c-both" />
|
||||
</div>
|
||||
<div class="col-md-1 col-xs-1"><i class="fw fw-right-arrow" style="font-size:28px; font-weight:100; margin-top:28px; color:#11375B"></i></div>
|
||||
<div class="col-md-1 col-xs-1 wr-showcase" style="padding-top: 50px"><i class="fw fw-right" style="font-size:28px; font-weight:100; margin-top:28px; color:#11375B"></i></div>
|
||||
<div class="col-md-3 col-xs-4">
|
||||
<div class="itm-wiz"><div class="wiz-no col-md-offset-2"><img src="{{self.publicURL}}/images/step-02.png" style="width:85px"></div><div class="wiz-lbl hidden-xs"><span>Enroll your Device</span></div></div>
|
||||
<div class="itm-wiz"><div class="col-md-offset-2"><img src="{{self.publicURL}}/images/step-02.png" style="width:85px"></div><div class="wiz-lbl hidden-xs"><span>Enroll your Device</span></div></div>
|
||||
<br class="c-both" />
|
||||
</div>
|
||||
<div class="col-md-1 col-xs-1"><i class="fw fw-right-arrow" style="font-size:28px; font-weight:100; margin-top:28px; color:#11375B"></i></div>
|
||||
<div class="col-md-1 col-xs-1 wr-showcase" style="padding-top: 50px"><i class="fw fw-right" style="font-size:28px; font-weight:100; margin-top:28px; color:#11375B"></i></div>
|
||||
<div class="col-md-3 col-xs-4 ">
|
||||
<div class="itm-wiz"><div class="wiz-no col-md-offset-2"><img src="{{self.publicURL}}/images/step-03.png" style="width:85px"></div><div class="wiz-lbl hidden-xs"><span>Manage your Device</span></div></div>
|
||||
<div class="itm-wiz"><div class="col-md-offset-2"><img src="{{self.publicURL}}/images/step-03.png" style="width:85px"></div><div class="wiz-lbl hidden-xs"><span>Manage your Device</span></div></div>
|
||||
<br class="c-both" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user