Commit 9cdafd4c authored by MAGHOUZ's avatar MAGHOUZ
Browse files

only monitored items with "processrunner" type and "ERROR" status are selectable to be unlocked.

parent dcaf452d
......@@ -2,6 +2,18 @@
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="slide-button">
<button
mat-raised-button
class="btn btn-primary"
matTooltip="Unlock selected files"
[style.visibility]="visibility_unlock_button"
>
<span class="material-icons">
lock_open
</span>
</button>
</div>
<ag-grid-angular
#agGrid
class="ag-theme-material"
......@@ -18,8 +30,9 @@
(firstDataRendered)="onFirstDataRendered($event)"
(gridReady)="onGridReady($event)"
[frameworkComponents]="frameworkComponents"
[getRowNodeId]="getRowNodeId"
(cellClicked)="onCellClicked($event)"
[gridOptions]="gridOptions"
[isRowSelectable]="isRowSelectable"
></ag-grid-angular>
</div>
......
......@@ -47,7 +47,6 @@ export class Monitored_items_listComponent implements OnInit {
columnDefs = [
{
field: 'id',
headerName: '',
sortable: false,
filter: false,
......@@ -133,13 +132,27 @@ export class Monitored_items_listComponent implements OnInit {
messageType = '1';
selectedRows: string[];
getRowNodeId = function(data) {
return data.id;
};
gridOptions = {
onSelectionChanged: (event) => this.onSelectionChanged(event),
getRowNodeId : function(data) {
return data.id;
}
}
selectAllSubscription: Subscription;
updateOneSubscription: Subscription;
deleteTicketsSubscription: Subscription;
visibility_unlock_button = "hidden";
isRowSelectable = function (rowNode) {
if(rowNode.data){
if(rowNode.data.type == "processrunner" && rowNode.data.statusFk == "ERROR")
return true
}
return false;
};
constructor(private router: Router, public monitoreditemsService: Monitored_itemsService,public dialog: MatDialog) {
......@@ -201,7 +214,7 @@ export class Monitored_items_listComponent implements OnInit {
displaySelectedRows(): void {
this.updateSelectedRows();
alert(`Selected nodes: ${this.selectedRows.join(', ')}`);
console.log(`Selected nodes: ${this.selectedRows.join(',\n')}`);
}
autoSizeAll(skipHeader) {
......@@ -224,4 +237,18 @@ export class Monitored_items_listComponent implements OnInit {
onCellClicked($event: any) {
//this.router.navigate(['cops/monitored_item', $event.data.id]);
}
updateUnlockButtonVisibility(): void {
if(this.selectedRows.length > 0){
this.visibility_unlock_button = "visible"
}
else{
this.visibility_unlock_button = "hidden"
}
}
onSelectionChanged($event: any){
this.displaySelectedRows();
this.updateUnlockButtonVisibility()
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment