mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge pull request #239 from charithag/master
Fixed https://wso2.org/jira/browse/IOTS-104
This commit is contained in:
commit
da1a60615c
@ -80,18 +80,13 @@ utility = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
publicMethods.getDeviceTypeConfig = function (deviceType) {
|
publicMethods.getDeviceTypeConfig = function (deviceType) {
|
||||||
var JFile = Packages.java.io.File;
|
var unitName = publicMethods.getTenantedDeviceUnitName(deviceType, "type-view");
|
||||||
var sep = JFile.separator;
|
|
||||||
|
|
||||||
var systemProcess = require('process');
|
|
||||||
var parent = 'file:///' + (systemProcess.getProperty('jaggery.home') || systemProcess.getProperty('carbon.home')).replace(/[\\]/g, '/').replace(/^[\/]/g, '');
|
|
||||||
|
|
||||||
if (deviceType in deviceTypeConfigMap) {
|
if (deviceType in deviceTypeConfigMap) {
|
||||||
return deviceTypeConfigMap[deviceType];
|
return deviceTypeConfigMap[deviceType];
|
||||||
}
|
}
|
||||||
var deviceTypeConfig;
|
var deviceTypeConfig;
|
||||||
var deviceTypeConfigFile = new File(parent + sep + "repository" + sep + "conf" + sep
|
var deviceTypeConfigFile = new File("/app/units/" + unitName + "/private/config.json");
|
||||||
+ "device-types" + sep + deviceType + ".json");
|
|
||||||
if (deviceTypeConfigFile.isExists()) {
|
if (deviceTypeConfigFile.isExists()) {
|
||||||
try {
|
try {
|
||||||
deviceTypeConfigFile.open("r");
|
deviceTypeConfigFile.open("r");
|
||||||
|
|||||||
@ -54,12 +54,16 @@ function onRequest(context) {
|
|||||||
var deviceTypes = [];
|
var deviceTypes = [];
|
||||||
if (data) {
|
if (data) {
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
var deviceType = utility.getDeviceTypeConfig(data[i].name).deviceType;
|
var config = utility.getDeviceTypeConfig(data[i].name);
|
||||||
|
if (!config){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var deviceType = config.deviceType;
|
||||||
deviceTypes.push({
|
deviceTypes.push({
|
||||||
"type": data[i].name,
|
"type": data[i].name,
|
||||||
"category": deviceType.category,
|
"category": deviceType.category,
|
||||||
"label": deviceType.label,
|
"label": deviceType.label,
|
||||||
"thumb": utility.getDeviceThumb(data[i].name)
|
"thumb": utility.getDeviceThumb(data[i].name)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user