Fixing iot operation bar not listing operations

revert-70aa11f8
Rasika Perera 8 years ago
parent 6d4ddf7b54
commit b2f31be1d6

@ -38,42 +38,42 @@ var operationModule = function () {
} }
privateMethods.getOperationsFromFeatures = function (deviceType, operationType) { privateMethods.getOperationsFromFeatures = function (deviceType, operationType) {
var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/features/" + deviceType; var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/device-types/" + deviceType + "/features";
var featuresList = serviceInvokers.XMLHttp.get(url, function (responsePayload) { var featuresList = serviceInvokers.XMLHttp.get(url, function (responsePayload) {
var features = responsePayload; var features = JSON.parse(responsePayload.responseText);
var featureList = []; var featureList = [];
var feature; var feature;
for (var i = 0; i < features.length; i++) { for (var i = 0; i < features.length; i++) {
feature = {}; feature = {};
var analyticStreams = utility.getDeviceTypeConfig(deviceType)["analyticStreams"]; var analyticStreams = utility.getDeviceTypeConfig(deviceType)["analyticStreams"];
if (analyticStreams) { if (analyticStreams) {
for (var stream in analyticStreams) { for (var stream in analyticStreams) {
if (analyticStreams[stream].name == features[i].name) { if (analyticStreams[stream].name == features[i].name) {
feature.ui_unit = analyticStreams[stream].ui_unit; feature.ui_unit = analyticStreams[stream].ui_unit;
break; break;
} }
} }
} }
feature["operation"] = features[i].code; feature["operation"] = features[i].code;
feature["name"] = features[i].name; feature["name"] = features[i].name;
feature["description"] = features[i].description; feature["description"] = features[i].description;
feature["deviceType"] = deviceType; feature["deviceType"] = deviceType;
feature["params"] = []; feature["params"] = [];
var metaData = features[i].metadataEntries; var metaData = features[i].metadataEntries;
if (metaData) { if (metaData) {
for (var j = 0; j < metaData.length; j++) { for (var j = 0; j < metaData.length; j++) {
feature["params"].push(metaData[j].value); feature["params"].push(metaData[j].value);
} }
featureList.push(feature); featureList.push(feature);
} }
} }
return featureList; return featureList;
}, function (responsePayload) { }, function (responsePayload) {
var response = {}; var response = {};
response["status"] = "error"; response["status"] = "error";
return response; return response;
} }
); );
return featuresList; return featuresList;
}; };

Loading…
Cancel
Save