diff --git a/client/cat3/src/partials/sections/dashboard/analytics/controller/discoveryResourcesCtrl.js b/client/cat3/src/partials/sections/dashboard/analytics/controller/discoveryResourcesCtrl.js index c44f1b07c..032d19fa5 100644 --- a/client/cat3/src/partials/sections/dashboard/analytics/controller/discoveryResourcesCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/analytics/controller/discoveryResourcesCtrl.js @@ -3,6 +3,9 @@ angular.module('dashboard.analytics') .controller('discoveryResourcesCtrl', ['$scope', '$rootScope', '$state','analyticsServices', 'genericServices','$timeout','toastr','$modal', function ($scope,$rootScope,$state,analyticsServices,genSevs,$timeout,toastr,$modal){ var disResrc=this; + $scope.gridApi=null; + disResrc.filterValue=''; + $scope.colArray=[]; $scope.instanceType=null; $scope.selectInstanceRow=[]; $scope.TagName={ @@ -71,6 +74,8 @@ paginationPageSize:25, columnDefs: [], onRegisterApi: function (gridApi) { + gridApi.grid.registerRowsProcessor( $scope.singleFilter, 200 ); + $scope.gridApi=gridApi; gridApi.edit.on.afterCellEdit($scope, function (rowEntity, colDefa, newValue, oldValue) { console.log( colDefa.name,'---',colDefa.name.substring(0, colDefa.name.length-3)); var tagna=colDefa.name.substring(0, colDefa.name.length-3); @@ -109,10 +114,11 @@ }; disResrc.gridOptionInstances.data = []; if($rootScope.organNewEnt.instanceType === 'Managed') { + $scope.colArray=['platformId','privateIpAddress','os','state']; disResrc.gridOptionInstances.columnDefs=[ {name: 'InstanceId', field: 'platformId',enableCellEditOnFocus: false, enableCellEdit: false,enableFiltering: true}, - {name: 'os', enableFiltering: true,displayName: 'OS', enableCellEdit: false, type: 'number',enableCellEditOnFocus: false}, + {name: 'os', enableFiltering: true,displayName: 'OS', enableCellEdit: false,enableCellEditOnFocus: false}, {name: 'privateIpAddress',enableFiltering: true, displayName: 'IP Address',enableCellEditOnFocus: false, enableCellEdit: false}, {name: 'state',enableFiltering: true, displayName: 'Status',enableCellEditOnFocus: false, @@ -147,7 +153,7 @@ ]; $scope.instanceType= 'managedInstances'; } else if($rootScope.organNewEnt.instanceType === 'Assigned'){ - disResrc.gridOptionInstances.enableFiltering=true; + $scope.colArray=['platformId','privateIpAddress','os','state']; disResrc.gridOptionInstances.columnDefs=[ {name: 'InstanceId', field: 'platformId',enableCellEditOnFocus: false, enableCellEdit: false,enableFiltering: true}, @@ -186,7 +192,7 @@ ]; $scope.instanceType= 'unmanagedInstances'; } else if($rootScope.organNewEnt.instanceType === 'Unassigned'){ - disResrc.gridOptionInstances.enableFiltering=false; + $scope.colArray=['platformId','privateIpAddress','os','state']; disResrc.gridOptionInstances.columnDefs= [ {name: 'InstanceId', field: 'platformId',enableCellEditOnFocus: false, enableCellEdit: false}, @@ -244,6 +250,7 @@ editDropdownValueLabel: 'id' } ]; + $scope.instanceType= 'unassigned-instances'; } var param = { @@ -307,6 +314,24 @@ analyticsServices.applyFilter(true,null); disResrc.init(); }; + $scope.filterInst = function() { + $scope.gridApi.grid.refresh(); + }; + $scope.singleFilter = function( renderableRows ){ + var matcher = new RegExp(disResrc.filterValue); + renderableRows.forEach( function( row ) { + var match = false; + angular.forEach($scope.colArray,function( field ){ + if ( row.entity[field] && row.entity[field].match(matcher) ){ + match = true; + } + }); + if ( !match ){ + row.visible = false; + } + }); + return renderableRows; + }; disResrc.init(); }]).controller('instanceManageCtrl',['$scope','$rootScope','items','$modalInstance','genericServices',function ($scope,$rootScope,items,$modalInstance,genericServices) { diff --git a/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryResources.html b/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryResources.html index 4fedf8987..e4118ea44 100644 --- a/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryResources.html +++ b/client/cat3/src/partials/sections/dashboard/analytics/view/discoveryResources.html @@ -11,8 +11,10 @@ -
-
No Data Found!
+ + +
+
No Data Found!