[ACS-5842] - viewer button not working in file details view (#3389)

* [ACS-5842] - viewer details disappear on button click

* Change e2e and unit tests

* Change e2e and unit tests

* Change e2e and unit tests

* Change e2e and unit tests

* Change e2e and unit tests
This commit is contained in:
DominikIwanek
2023-08-29 14:10:31 +02:00
committed by GitHub
parent ad36ed891b
commit cc484d792e
3 changed files with 43 additions and 12 deletions

View File

@@ -25,7 +25,7 @@
import { Component, ViewEncapsulation, Input } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppStore, ViewNodeAction, getAppSelection } from '@alfresco/aca-shared/store';
import { Router } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { take } from 'rxjs/operators';
import { SharedLinkEntry } from '@alfresco/js-api';
import { AcaFileAutoDownloadService } from '@alfresco/aca-shared';
@@ -62,7 +62,12 @@ import { MatDialogModule } from '@angular/material/dialog';
export class ViewNodeComponent {
@Input() data: { title?: string; menuButton?: boolean; iconButton?: boolean };
constructor(private store: Store<AppStore>, private router: Router, private fileAutoDownloadService: AcaFileAutoDownloadService) {}
constructor(
private store: Store<AppStore>,
private router: Router,
private fileAutoDownloadService: AcaFileAutoDownloadService,
private activatedRoute: ActivatedRoute
) {}
onClick() {
this.store
@@ -79,9 +84,15 @@ export class ViewNodeComponent {
} else {
id = (selection.file as SharedLinkEntry).entry.nodeId || (selection.file as any).entry.guid || selection.file.entry.id;
}
this.store.dispatch(new ViewNodeAction(id, { location: this.router.url }));
this.navigateToViewer(id);
}
});
}
private navigateToViewer(id: string): void {
this.activatedRoute.queryParams.pipe(take(1)).subscribe((params) => {
const location = params.location || this.router.url;
this.store.dispatch(new ViewNodeAction(id, { location }));
});
}
}