Files and search component fix with routing support (#2191)

This commit is contained in:
Popovics András
2017-08-09 18:32:23 +01:00
committed by Mario Romano
parent 5ad4fe171a
commit e6ae21a0bc
7 changed files with 42 additions and 12 deletions

View File

@@ -88,6 +88,7 @@
(error)="onNavigationError($event)"
(success)="resetError()"
(preview)="showFile($event)"
(folderChange)="onFolderChange($event)"
(permissionError)="handlePermissionError($event)">
<data-columns>
<data-column

View File

@@ -17,7 +17,7 @@
import { ChangeDetectorRef, Component, Input, OnInit, Optional, ViewChild } from '@angular/core';
import { MdDialog } from '@angular/material';
import { ActivatedRoute, Params } from '@angular/router';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { MinimalNodeEntity } from 'alfresco-js-api';
import {
AlfrescoApiService, AlfrescoContentService, AlfrescoTranslationService, FileUploadCompleteEvent,
@@ -90,6 +90,7 @@ export class FilesComponent implements OnInit {
private contentService: AlfrescoContentService,
private dialog: MdDialog,
private translateService: AlfrescoTranslationService,
private router: Router,
@Optional() private route: ActivatedRoute) {
}
@@ -102,6 +103,10 @@ export class FilesComponent implements OnInit {
}
}
onFolderChange($event) {
this.router.navigate(['/files', $event.value.id]);
}
toggleFolder() {
this.multipleFileUpload = false;
this.folderUpload = !this.folderUpload;

View File

@@ -1,6 +1,8 @@
<div class="search-results-container">
<h1>Search results</h1>
<alfresco-search (preview)="showFile($event)"></alfresco-search>
<alfresco-search
[navigate]="false"
(nodeDbClick)="nodeDbClick($event)"></alfresco-search>
</div>
<div *ngIf="fileShowed">

View File

@@ -52,9 +52,17 @@ export class SearchComponent {
constructor(public router: Router) {
}
showFile(event) {
if (event.value.entry.isFile) {
this.fileNodeId = event.value.entry.id;
nodeDbClick($event: any) {
if ($event.value.entry.isFolder) {
this.router.navigate(['/files', $event.value.entry.id]);
} else {
this.showFile($event);
}
}
showFile($event) {
if ($event.value.entry.isFile) {
this.fileNodeId = $event.value.entry.id;
this.fileShowed = true;
} else {
this.fileShowed = false;