Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -244,6 +250,7 @@
editDropdownValueLabel: 'id'
}
];

$scope.instanceType= 'unassigned-instances';
}
var param = {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
</button>
</span>
<loading size="large" name="instLoader" type="block"></loading>
<div ng-if="!instLoader && disResrc.gridOptionInstances.data.length > 0" ui-grid="disResrc.gridOptionInstances" ui-grid-pagination ui-grid-selection ui-grid-edit ui-grid-cellNav class="grid"></div>
<div ng-if="!instLoader && disResrc.gridOptionInstances.data.length === 0" class="alert alert-info text-center"> No Data Found!</div>

<input ng-if="!instLoader && disResrc.gridOptionInstances.data.length > 0" ng-model='disResrc.filterValue' class="form-control with250" ng-change="filterInst()" placeholder="Search" />
<div ng-if="!instLoader && disResrc.gridOptionInstances.data.length > 0" ui-grid="disResrc.gridOptionInstances" ui-grid-pagination ui-grid-selection ui-grid-edit ui-grid-cellNav class="grid margintop15"></div>
<div ng-if="!instLoader && disResrc.gridOptionInstances.data.length === 0" class="alert alert-info text-center margintop15"> No Data Found!</div>
</accordion-group>


Expand Down