mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' into 'master'
Add new UI method to retrieve device info details of a device See merge request entgra/carbon-device-mgt!417
This commit is contained in:
commit
0e216a1c8b
@ -435,5 +435,33 @@ deviceModule = function () {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve device info details of a device
|
||||||
|
* @param deviceType - Type of the device i.e ios, android
|
||||||
|
* @param deviceId - Device ID of te device
|
||||||
|
*/
|
||||||
|
publicMethods.getDeviceInfo = function (deviceType, deviceId) {
|
||||||
|
try {
|
||||||
|
var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"]
|
||||||
|
+ "/devices/" + deviceType + "/" + deviceId + "/info";
|
||||||
|
var response = {};
|
||||||
|
return serviceInvokers.XMLHttp.get(
|
||||||
|
url,
|
||||||
|
function (backendResponse) {
|
||||||
|
if (backendResponse.status === 200 && backendResponse.responseText) {
|
||||||
|
response["status"] = "success";
|
||||||
|
response["content"] = parse(backendResponse.responseText);
|
||||||
|
} else {
|
||||||
|
log.error("Error occurred while retrieving device info via " + url + ". Error code: "
|
||||||
|
+ backendResponse.status + ". Reason: " + backendResponse.responseText);
|
||||||
|
response["status"] = "error";
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
log.error("Error occurred while retrieving device info via " + url, e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return publicMethods;
|
return publicMethods;
|
||||||
}();
|
}();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user