Fixing android-sense to support auto-generated operations

revert-dabc3590
Rasika Perera 9 years ago
parent 506a48569b
commit 0a060d9a73

@ -14,7 +14,7 @@
Operations Operations
</div> </div>
<div class="add-margin-top-4x"> <div class="add-margin-top-4x">
{{unit "iot.unit.device.operation-bar" device=device}} {{unit "iot.unit.device.operation-bar" device=device backendApiUri=backendApiUri}}
</div> </div>
{{/zone}} {{/zone}}

@ -20,13 +20,14 @@ function onRequest(context) {
var log = new Log("device-view.js"); var log = new Log("device-view.js");
var deviceType = context.uriParams.deviceType; var deviceType = context.uriParams.deviceType;
var deviceId = request.getParameter("id"); var deviceId = request.getParameter("id");
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
if (deviceType && deviceId) { if (deviceType && deviceId) {
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/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") {
return {"device": device}; return {"device": device, "backendApiUri" : devicemgtProps["httpsURL"] + "/android_sense/"};
} 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!");
exit(); exit();

Loading…
Cancel
Save