mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1806] Viewer - navigate on node delete event (#775)
* navigate onode delete event * remove console
This commit is contained in:
committed by
Denys Vuika
parent
ae382f8b39
commit
44a9ade552
@@ -23,7 +23,7 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
|
||||
import {
|
||||
ActivatedRoute,
|
||||
Router,
|
||||
@@ -49,7 +49,8 @@ import { ContentActionRef, ViewerExtensionRef } from '@alfresco/adf-extensions';
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
host: { class: 'app-preview' }
|
||||
})
|
||||
export class PreviewComponent extends PageComponent implements OnInit {
|
||||
export class PreviewComponent extends PageComponent
|
||||
implements OnInit, OnDestroy {
|
||||
previewLocation: string = null;
|
||||
routesSkipNavigation = ['shared', 'recent-files', 'favorites'];
|
||||
navigateSource: string = null;
|
||||
@@ -108,10 +109,20 @@ export class PreviewComponent extends PageComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
|
||||
this.subscriptions = this.subscriptions.concat([
|
||||
this.content.nodesDeleted.subscribe(() =>
|
||||
this.navigateToFileLocation(true)
|
||||
)
|
||||
]);
|
||||
|
||||
this.openWith = this.extensions.openWithActions;
|
||||
this.contentExtensions = this.extensions.viewerContentExtensions;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
super.ngOnDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the particular node into the Viewer
|
||||
* @param id Unique identifier for the Node to display
|
||||
@@ -147,11 +158,16 @@ export class PreviewComponent extends PageComponent implements OnInit {
|
||||
* @param isVisible Indicator whether Viewer is visible or hidden.
|
||||
*/
|
||||
onVisibilityChanged(isVisible: boolean): void {
|
||||
const shouldNavigate = !isVisible;
|
||||
this.navigateToFileLocation(shouldNavigate);
|
||||
}
|
||||
|
||||
navigateToFileLocation(shouldNavigate: boolean) {
|
||||
const shouldSkipNavigation = this.routesSkipNavigation.includes(
|
||||
this.previewLocation
|
||||
);
|
||||
|
||||
if (!isVisible) {
|
||||
if (shouldNavigate) {
|
||||
const route = this.getNavigationCommands(this.previewLocation);
|
||||
|
||||
if (!shouldSkipNavigation && this.folderId) {
|
||||
|
Reference in New Issue
Block a user