diff --git a/src/frontend/app/actions/actions-list.component.ts b/src/frontend/app/actions/actions-list.component.ts index a3e4276600c88fd91687d6f8273f6ac7ce871dab..7100b1fbb73bbb4ad53b224ba84dd9ed42b85eea 100644 --- a/src/frontend/app/actions/actions-list.component.ts +++ b/src/frontend/app/actions/actions-list.component.ts @@ -11,8 +11,7 @@ import { Subscription } from 'rxjs'; @Component({ selector: 'app-actions-list', templateUrl: "actions-list.component.html", - styleUrls: ['actions-list.component.scss'], - providers: [NotificationService, ActionsService], + styleUrls: ['actions-list.component.scss'] }) export class ActionsListComponent implements OnInit { @@ -25,7 +24,6 @@ export class ActionsListComponent implements OnInit { contextMenuPosition = { x: '0px', y: '0px' }; contextMenuTitle = ''; currentAction: any = {}; - currentResource: any = null; basketInfo: any = {}; contextResId = 0; currentLock: any = null; @@ -38,6 +36,7 @@ export class ActionsListComponent implements OnInit { @Input('totalRes') totalRes: number; @Input('contextMode') contextMode: boolean; @Input('currentBasketInfo') currentBasketInfo: any; + @Input('currentResource') currentResource: any = {}; @Output('refreshEvent') refreshEvent = new EventEmitter<string>(); @Output('refreshEventAfterAction') refreshEventAfterAction = new EventEmitter<string>(); @@ -52,15 +51,8 @@ export class ActionsListComponent implements OnInit { ) { } dialogRef: MatDialogRef<any>; - subscription: Subscription; - - ngOnInit(): void { - // Event after process action - this.subscription = this.actionService.catchAction().subscribe(message => { - this.refreshEventAfterAction.emit(); - this.refreshPanelFolders.emit(); - }); - } + + ngOnInit(): void { } open(x: number, y: number, row: any) { @@ -135,9 +127,4 @@ export class ActionsListComponent implements OnInit { refreshFolders() { this.refreshPanelFolders.emit(); } - - ngOnDestroy() { - // unsubscribe to ensure no memory leaks - this.subscription.unsubscribe(); - } } diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index 3d768058c1926cf33b8c4accd8805c2e3ccf54ef..27b0ce02ee9aedd627570faad6324198fbdedfe1 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -75,6 +75,7 @@ import { MailResumeComponent } from './mail/mail-resume/m import { AddPrivateIndexingModelModalComponent } from './indexation/private-indexing-model/add-private-indexing-model-modal.component'; import { FoldersService } from './folder/folders.service'; import { PrivilegeService } from '../service/privileges.service'; +import { ActionsService } from './actions/actions.service'; @NgModule({ @@ -170,7 +171,7 @@ import { PrivilegeService } from '../service/privileges.service'; AddPrivateIndexingModelModalComponent, AttachmentShowModalComponent ], - providers: [ FiltersListService, FoldersService, NotificationService, PrivilegeService ], + providers: [ FiltersListService, FoldersService, ActionsService, NotificationService, PrivilegeService ], bootstrap: [ AppComponent ] }) export class AppModule { } diff --git a/src/frontend/app/list/basket-list.component.html b/src/frontend/app/list/basket-list.component.html index 1bd8bed62e76ab84a405590784c4af420164138a..5081422123d11658a6bfcfe7b19f0bf217ba8b93 100644 --- a/src/frontend/app/list/basket-list.component.html +++ b/src/frontend/app/list/basket-list.component.html @@ -49,7 +49,7 @@ <span> <app-actions-list #actionsList (refreshEvent)="refreshDao()" [contextMode]="false" [totalRes]="allResInBasket.length" [selectedRes]="selectedRes" - [currentBasketInfo]="currentBasketInfo" (refreshPanelFolders)="panelFolder.refreshFoldersTree()"></app-actions-list> + [currentBasketInfo]="currentBasketInfo" [currentResource]="currentResource" (refreshPanelFolders)="panelFolder.refreshFoldersTree()"></app-actions-list> </span> <span> <app-tools-list #actionsList [selectedRes]="selectedRes" diff --git a/src/frontend/app/list/basket-list.component.ts b/src/frontend/app/list/basket-list.component.ts index 602626915581d6fe1cc0b89cc5255e2158e4ce6b..7b520adcd5668e283242060d398c12436cc42db5 100755 --- a/src/frontend/app/list/basket-list.component.ts +++ b/src/frontend/app/list/basket-list.component.ts @@ -22,6 +22,7 @@ import { PanelListComponent } from './panel/panel-list.component'; import { AppService } from '../../service/app.service'; import { PanelFolderComponent } from '../folder/panel/panel-folder.component'; import { FoldersService } from '../folder/folders.service'; +import { ActionsService } from '../actions/actions.service'; declare function $j(selector: any): any; @@ -91,6 +92,7 @@ export class BasketListComponent implements OnInit { private destroy$ = new Subject<boolean>(); subscription: Subscription; + subscription2: Subscription; @ViewChild('actionsListContext', { static: true }) actionsList: ActionsListComponent; @ViewChild('filtersTool', { static: true }) filtersTool: FiltersToolComponent; @@ -116,7 +118,8 @@ export class BasketListComponent implements OnInit { public overlay: Overlay, public viewContainerRef: ViewContainerRef, public appService: AppService, - private foldersService: FoldersService) { + private foldersService: FoldersService, + private actionService: ActionsService) { _activatedRoute.queryParams.subscribe( params => this.specificChrono = params.chrono ); @@ -127,6 +130,10 @@ export class BasketListComponent implements OnInit { this[result.content](); } }); + this.subscription2 = this.actionService.catchAction().subscribe((message: any) => { + this.refreshDaoAfterAction(); + this.panelFolder.refreshFoldersTree(); + }); $j("link[href='merged_css.php']").remove(); } @@ -171,6 +178,7 @@ export class BasketListComponent implements OnInit { ngOnDestroy() { this.destroy$.next(true); this.subscription.unsubscribe(); + this.subscription2.unsubscribe(); } initResultList() { @@ -393,6 +401,7 @@ export class BasketListComponent implements OnInit { toggleRes(e: any, row: any) { if (e.checked) { if (this.selectedRes.indexOf(row.resId) === -1) { + this.currentResource = row; this.selectedRes.push(row.resId); row.checked = true; }