Skip to content
Snippets Groups Projects
Verified Commit b1679c59 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #9105 add unlock action route

parent b808e541
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ export class ActionsListComponent implements OnInit { ...@@ -27,6 +27,7 @@ export class ActionsListComponent implements OnInit {
basketInfo: any = {}; basketInfo: any = {};
contextResId = 0; contextResId = 0;
currentLock: any = null; currentLock: any = null;
arrRes: any[] = [];
actionsList: any[] = []; actionsList: any[] = [];
...@@ -57,21 +58,21 @@ export class ActionsListComponent implements OnInit { ...@@ -57,21 +58,21 @@ export class ActionsListComponent implements OnInit {
} }
launchEvent(action: any) { launchEvent(action: any) {
let arrRes: any[] = []; this.arrRes = [];
this.currentAction = action; this.currentAction = action;
if (this.contextMode && this.selectedRes.length == 0) { if (this.contextMode && this.selectedRes.length == 0) {
arrRes = [this.contextResId]; this.arrRes = [this.contextResId];
} else { } else {
arrRes = this.selectedRes; this.arrRes = this.selectedRes;
} }
this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/lock', { resources: arrRes }) this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/lock', { resources: this.arrRes })
.subscribe((data: any) => { .subscribe((data: any) => {
try { try {
if (data.lockedResources > 0) { if (data.lockedResources > 0) {
alert(data.lockedResources + ' ' + this.lang.warnLockRes + '.'); alert(data.lockedResources + ' ' + this.lang.warnLockRes + '.');
} }
this.lock(arrRes); this.lock();
this[action.component](); this[action.component]();
} }
catch (error) { catch (error) {
...@@ -111,7 +112,8 @@ export class ActionsListComponent implements OnInit { ...@@ -111,7 +112,8 @@ export class ActionsListComponent implements OnInit {
contextMode: this.contextMode, contextMode: this.contextMode,
contextChrono: this.contextMenuTitle, contextChrono: this.contextMenuTitle,
selectedRes: this.selectedRes, selectedRes: this.selectedRes,
action: this.currentAction action: this.currentAction,
currentBasketInfo: this.currentBasketInfo
} }
}); });
} }
...@@ -146,9 +148,9 @@ export class ActionsListComponent implements OnInit { ...@@ -146,9 +148,9 @@ export class ActionsListComponent implements OnInit {
} }
} }
lock(arrRes: any) { lock() {
this.currentLock = setInterval(() => { this.currentLock = setInterval(() => {
this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/lock', { resources: arrRes }) this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/lock', { resources: this.arrRes })
.subscribe((data: any) => { }, (err: any) => { }); .subscribe((data: any) => { }, (err: any) => { });
}, 50000); }, 50000);
} }
...@@ -156,5 +158,7 @@ export class ActionsListComponent implements OnInit { ...@@ -156,5 +158,7 @@ export class ActionsListComponent implements OnInit {
unlock() { unlock() {
console.log('unlock documents'); console.log('unlock documents');
clearInterval(this.currentLock); clearInterval(this.currentLock);
this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/unlock', { resources: this.arrRes })
.subscribe((data: any) => { }, (err: any) => { });
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment