Commit 280546c5 authored by MAGHOUZ's avatar MAGHOUZ
Browse files

Unlock monitored items - 1st try

parent 4b6d9859
......@@ -103,7 +103,6 @@ export class Monitored_itemsService {
});
}
getMonitoredItemData(monitored_item_id) {
this.apollo
.query({
......@@ -137,4 +136,22 @@ export class Monitored_itemsService {
})
;
}
unlockMonitoredItems(monitoredItemIdList: string[]){
const UNLOCK_MONITORED_ITEMS = gql`
mutation unlock($monitoredItemIdList: [String!]) {
unlock (monitoredItemIdList: $monitoredItemIdList)
{
unlockedFilesSuccess,
unlockedFilesFailure
}
}
`;
return this.apollo.mutate({
mutation: UNLOCK_MONITORED_ITEMS,
variables: {
monitoredItemIdList: monitoredItemIdList
}
});
}
}
......@@ -8,6 +8,7 @@
class="btn btn-primary"
matTooltip="Unlock selected files"
[style.visibility]="visibility_unlock_button"
(click)="unlock_Selected_Files()"
>
<span class="material-icons">
lock_open
......
......@@ -30,8 +30,6 @@ export class Monitored_items_listComponent implements OnInit {
public page_size : number = 20;
private pageIndex : number = 0;
selectedRows: string[];
visibility_unlock_button = "hidden";
dataSource: MonitoredItemsDataSource;
......@@ -153,7 +151,10 @@ export class Monitored_items_listComponent implements OnInit {
const dialogRef = this.dialog.open(addTicketsDialog,dialogConfig);
dialogRef.afterClosed().subscribe(result => {
this.addTickets(row.id, result)
if(result){
this.addTickets(row.id, result);
this.dataSource.loadMonitoredItems(this.sort_gql,this.page_size);
}
});
}
......@@ -166,7 +167,10 @@ export class Monitored_items_listComponent implements OnInit {
const dialogRef = this.dialog.open(deleteTicketsDialog,dialogConfig);
dialogRef.afterClosed().subscribe(result => {
result?.length > 0 ? this.removeTickets(row.id, result) : null;
if(result?.length > 0){
this.removeTickets(row.id, result)
this.dataSource.loadMonitoredItems(this.sort_gql,this.page_size);
}
});
}
......@@ -185,4 +189,27 @@ export class Monitored_items_listComponent implements OnInit {
this.dataSource.loadMonitoredItems(this.sort_gql,this.paginator.pageSize);
});
}
unlock_Selected_Files() {
let monitoredItemsList : string[] = []
this.selection.selected.forEach((mi)=>{
monitoredItemsList.push(mi.id)
})
console.log(monitoredItemsList)
this.monitoreditemsService.unlockMonitoredItems(monitoredItemsList)
.subscribe((data)=>{
// console.log("result data:\n",data)
this.dataSource.loadMonitoredItems(this.sort_gql,this.page_size)
this.selection.clear()
});
// const dialogConfig = new MatDialogConfig();
//
// dialogConfig.autoFocus = true;
//
// const dialogRef = this.dialog.open(`<div>"ici un component pour le message de succes ou erreur"</div>`,dialogConfig);
}
}
......@@ -375,7 +375,7 @@
@include transition (0.33s, cubic-bezier(0.685, 0.0473, 0.346, 1));
.main-content{
margin-top: 70px;
//margin-top: 70px;
padding: 30px 15px;
min-height: calc(100vh - 123px);
}
......
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