Adding Geo Dashboard link to device view page

revert-dabc3590
dunithd 8 years ago
parent 0c7f1adcba
commit 7dc5a2000d

@ -73,4 +73,20 @@
</div> </div>
</div> </div>
</div> </div>
<div class="panel panel-default tab-pane"
id="geo_dashboard" role="tabpanel" aria-labelledby="geo_dashboard">
<div class="panel-heading">Map</div>
<div id="chartWrapper">
</div>
<a class="padding-left"
href="{{portalUrl}}/portal/dashboards/geo-dashboard/?GLOBAL-STATE={{anchor}}">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-statistics fw-stack-1x"></i>
</span> View Device Location
</a>
</div>
{{/zone}} {{/zone}}

@ -28,10 +28,13 @@ function onRequest(context) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var device = deviceModule.viewDevice(deviceType, deviceId); var device = deviceModule.viewDevice(deviceType, deviceId);
if (device && device.status != "error") { if (device && device.status != "error") {
var anchor = { "device" : { "id" : device.content.deviceIdentifier, "type" : device.content.type}};
return { return {
"device": device.content, "device": device.content,
"autoCompleteParams": autoCompleteParams, "autoCompleteParams": autoCompleteParams,
"encodedFeaturePayloads": "" "encodedFeaturePayloads": "",
"portalUrl" : devicemgtProps['portalURL'],
"anchor" : JSON.stringify(anchor)
}; };
} else { } else {
response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!");

Loading…
Cancel
Save