Show group or device name in analytics

application-manager-new
charithag 9 years ago
parent 7481505342
commit ec9e54a3b3

@ -1,13 +1,18 @@
function onRequest(context){ function onRequest(context){
context.sketchPath = "api/device/sketch";
var groupId = request.getParameter("groupId"); var groupId = request.getParameter("groupId");
var title;
if (groupId){ if (groupId){
context.groupId = groupId; context.groupId = groupId;
context.title = "Group Analytics"; title = request.getParameter("name");
}else{ }else{
context.groupId = 0; context.groupId = 0;
context.title = "Device Analytics"; 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; return context;
} }

@ -69,7 +69,7 @@
<div id="collapseFour" class="panel-collapse collapse" role="tabpanel" <div id="collapseFour" class="panel-collapse collapse" role="tabpanel"
aria-labelledby="headingFour"> aria-labelledby="headingFour">
<div class="panel-body"> <div class="panel-body">
<a href="/iotserver/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> Show Statistics</a>
</div> </div>
</div> </div>

@ -42,7 +42,7 @@
</span> </span>
<span class="lbl-action">Devices</span> <span class="lbl-action">Devices</span>
</a> </a>
<a href="/iotserver/analytics?groupId={{id}}"> <a href="/iotserver/analytics?groupId={{id}}&name={{name}}">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-sequence fw-stack-1x"></i> <i class="fw fw-sequence fw-stack-1x"></i>

Loading…
Cancel
Save