mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-08-07 17:48:27 +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/>.
|
* 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 {
|
import {
|
||||||
ActivatedRoute,
|
ActivatedRoute,
|
||||||
Router,
|
Router,
|
||||||
@@ -49,7 +49,8 @@ import { ContentActionRef, ViewerExtensionRef } from '@alfresco/adf-extensions';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'app-preview' }
|
host: { class: 'app-preview' }
|
||||||
})
|
})
|
||||||
export class PreviewComponent extends PageComponent implements OnInit {
|
export class PreviewComponent extends PageComponent
|
||||||
|
implements OnInit, OnDestroy {
|
||||||
previewLocation: string = null;
|
previewLocation: string = null;
|
||||||
routesSkipNavigation = ['shared', 'recent-files', 'favorites'];
|
routesSkipNavigation = ['shared', 'recent-files', 'favorites'];
|
||||||
navigateSource: string = null;
|
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.openWith = this.extensions.openWithActions;
|
||||||
this.contentExtensions = this.extensions.viewerContentExtensions;
|
this.contentExtensions = this.extensions.viewerContentExtensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
super.ngOnDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the particular node into the Viewer
|
* Loads the particular node into the Viewer
|
||||||
* @param id Unique identifier for the Node to display
|
* @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.
|
* @param isVisible Indicator whether Viewer is visible or hidden.
|
||||||
*/
|
*/
|
||||||
onVisibilityChanged(isVisible: boolean): void {
|
onVisibilityChanged(isVisible: boolean): void {
|
||||||
|
const shouldNavigate = !isVisible;
|
||||||
|
this.navigateToFileLocation(shouldNavigate);
|
||||||
|
}
|
||||||
|
|
||||||
|
navigateToFileLocation(shouldNavigate: boolean) {
|
||||||
const shouldSkipNavigation = this.routesSkipNavigation.includes(
|
const shouldSkipNavigation = this.routesSkipNavigation.includes(
|
||||||
this.previewLocation
|
this.previewLocation
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!isVisible) {
|
if (shouldNavigate) {
|
||||||
const route = this.getNavigationCommands(this.previewLocation);
|
const route = this.getNavigationCommands(this.previewLocation);
|
||||||
|
|
||||||
if (!shouldSkipNavigation && this.folderId) {
|
if (!shouldSkipNavigation && this.folderId) {
|
||||||
|
Reference in New Issue
Block a user