mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
added functionality to view a previous version (#5913)
This commit is contained in:
@@ -19,7 +19,7 @@ import { Directive, Input, HostListener } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { DownloadZipDialogComponent } from '../dialogs/download-zip/download-zip.dialog';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { NodeEntry, VersionEntry } from '@alfresco/js-api';
|
||||
import { DownloadService } from '../services/download.service';
|
||||
|
||||
/**
|
||||
@@ -35,6 +35,10 @@ export class NodeDownloadDirective {
|
||||
@Input('adfNodeDownload')
|
||||
nodes: NodeEntry | NodeEntry[];
|
||||
|
||||
/** Node's version to download. */
|
||||
@Input()
|
||||
version: VersionEntry;
|
||||
|
||||
@HostListener('click')
|
||||
onClick() {
|
||||
this.downloadNodes(this.nodes);
|
||||
@@ -101,8 +105,14 @@ export class NodeDownloadDirective {
|
||||
// nodeId for Shared node
|
||||
const id = (<any> node.entry).nodeId || node.entry.id;
|
||||
|
||||
const url = contentApi.getContentUrl(id, true);
|
||||
const fileName = node.entry.name;
|
||||
let url, fileName;
|
||||
if (this.version) {
|
||||
url = contentApi.getVersionContentUrl(id, this.version.entry.id, true);
|
||||
fileName = this.version.entry.name;
|
||||
} else {
|
||||
url = contentApi.getContentUrl(id, true);
|
||||
fileName = node.entry.name;
|
||||
}
|
||||
|
||||
this.downloadService.downloadUrl(url, fileName);
|
||||
}
|
||||
|
Reference in New Issue
Block a user