Fixing platform filtering not working correctly

Resolves https://github.com/wso2/product-iots/issues/1689
revert-70aa11f8
Rasika Perera 7 years ago
parent 8e3a298bb0
commit 49f97f02e8

@ -61,14 +61,15 @@ if (uriMatcher.match("/{context}/api/data-tables/invoker/filters")) {
if (deviceTypesRes.status === "success") {
var deviceTypes = deviceTypesRes["content"]["deviceTypes"];
for (i = 0; i < deviceTypes.length; i++) {
var deviceTypeLabel = deviceTypes[i];
var deviceTypeName = deviceTypes[i];
var deviceTypeLabel = deviceTypeName;
var configs = utility.getDeviceTypeConfig(deviceTypeLabel);
if (configs) {
if (configs[DTYPE_CONF_DEVICE_TYPE_KEY][DTYPE_CONF_DEVICE_TYPE_LABEL_KEY]) {
deviceTypeLabel = configs[DTYPE_CONF_DEVICE_TYPE_KEY][DTYPE_CONF_DEVICE_TYPE_LABEL_KEY];
}
}
result.deviceTypes.push(deviceTypeLabel);
result.deviceTypes.push({"name": deviceTypeLabel, "value": deviceTypeName});
}
}
//Adding policy compliance

@ -440,7 +440,7 @@ function loadDevices(searchType, searchParam) {
break;
case 4:
$(this).attr('data-grid-label', "Type");
$(this).attr('data-search', getDeviceTypeLabel(deviceType));
$(this).attr('data-search', deviceType);
$(this).attr('data-display', getDeviceTypeLabel(deviceType));
break;
case 5:

@ -121,7 +121,13 @@ $.fn.datatables_extended = function (settings) {
} else if (filterColumn.eq(column.index()).hasClass('data-platform')) {
for(i = 0; i < cachedFilterRes.deviceTypes.length; i++){
var deviceTypes = cachedFilterRes.deviceTypes[i];
select.append('<option value="' + deviceTypes + '">' + deviceTypes + '</option>')
var name = deviceTypes;
var value = deviceTypes;
if (deviceTypes.name && deviceTypes.value) {
name = deviceTypes.name;
value = deviceTypes.value;
}
select.append('<option value="' + value + '">' + name + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-compliance')) {
for(i = 0; i < cachedFilterRes.deviceTypes.length; i++){

@ -147,10 +147,6 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
} else {
$("#operation-guide").addClass("hidden");
$("#operation-bar").removeClass("hidden");
//noinspection JSUnresolvedFunction
if (deviceType && ownership) {
loadOperationBar(deviceType, ownership, operationBarModeConstants.BULK);
}
}
}
@ -162,10 +158,6 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
} else {
$("#operation-guide").addClass("hidden");
$("#operation-bar").removeClass("hidden");
//noinspection JSUnresolvedFunction
if (deviceType && ownership) {
loadOperationBar(deviceType, ownership, operationBarModeConstants.BULK);
}
}
}
});
@ -197,7 +189,13 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
} else if (filterColumn.eq(column.index()).hasClass('data-platform')) {
for(i = 0; i < cachedFilterRes.deviceTypes.length; i++){
var deviceTypes = cachedFilterRes.deviceTypes[i];
select.append('<option value="' + deviceTypes + '">' + deviceTypes + '</option>')
var name = deviceTypes;
var value = deviceTypes;
if (deviceTypes.name && deviceTypes.value) {
name = deviceTypes.name;
value = deviceTypes.value;
}
select.append('<option value="' + value + '">' + name + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-compliance')) {
for(i = 0; i < cachedFilterRes.deviceTypes.length; i++){

Loading…
Cancel
Save