mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3223] Restore message directive files fix (#3499)
* fix restore notification * improve path specification property * fix lint and document issues * fix test * remove unused import
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<button
|
||||
mat-icon-button
|
||||
(selection-node-restored)="refresh()"
|
||||
(restore)="documentList.reload()"
|
||||
(restore)="onRestore($event)"
|
||||
[adf-restore]="documentList.selection"
|
||||
*ngIf="documentList.selection.length"
|
||||
title="{{ 'TRASHCAN.ACTIONS.RESTORE' | translate }}">
|
||||
|
@@ -25,34 +25,57 @@
|
||||
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
import { UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
||||
import { UserPreferencesService, UserPreferenceValues, RestoreMessageModel, NotificationService } from '@alfresco/adf-core';
|
||||
import { Router } from '@angular/router';
|
||||
import { PathInfoEntity } from 'alfresco-js-api';
|
||||
|
||||
@Component({
|
||||
templateUrl: './trashcan.component.html',
|
||||
styleUrls: ['trashcan.component.scss']
|
||||
})
|
||||
export class TrashcanComponent {
|
||||
|
||||
@ViewChild('documentList')
|
||||
documentList: DocumentListComponent;
|
||||
|
||||
supportedPages = [];
|
||||
currentLocale;
|
||||
|
||||
constructor(private preference: UserPreferencesService) {
|
||||
this.preference.select(UserPreferenceValues.SupportedPageSizes)
|
||||
.subscribe((pages) => {
|
||||
this.supportedPages = pages;
|
||||
});
|
||||
constructor(
|
||||
private preference: UserPreferencesService,
|
||||
private router: Router,
|
||||
private notificationService: NotificationService
|
||||
) {
|
||||
this.preference
|
||||
.select(UserPreferenceValues.SupportedPageSizes)
|
||||
.subscribe(pages => {
|
||||
this.supportedPages = pages;
|
||||
});
|
||||
|
||||
this.preference.select(UserPreferenceValues.Locale).subscribe((locale) => {
|
||||
this.currentLocale = locale;
|
||||
});
|
||||
this.preference
|
||||
.select(UserPreferenceValues.Locale)
|
||||
.subscribe(locale => {
|
||||
this.currentLocale = locale;
|
||||
});
|
||||
}
|
||||
|
||||
onRestore(restoreMessage: RestoreMessageModel) {
|
||||
this.notificationService
|
||||
.openSnackMessageAction(
|
||||
restoreMessage.message,
|
||||
restoreMessage.action
|
||||
)
|
||||
.onAction()
|
||||
.subscribe(() => this.navigateLocation(restoreMessage.path));
|
||||
this.documentList.reload();
|
||||
}
|
||||
|
||||
private navigateLocation(path: PathInfoEntity) {
|
||||
const parent = path.elements[path.elements.length - 1];
|
||||
this.router.navigate(['files/', parent.id]);
|
||||
}
|
||||
|
||||
refresh() {
|
||||
this.documentList.reload();
|
||||
this.documentList.resetSelection();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user