mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
fix title viewer issues of priority between name display and real name
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
<mat-icon>navigate_before</mat-icon>
|
<mat-icon>navigate_before</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<img class="adf-viewer__mimeicon" [src]="mimeType | adfMimeTypeIcon" data-automation-id="adf-file-thumbnail">
|
<img class="adf-viewer__mimeicon" [src]="mimeType | adfMimeTypeIcon" data-automation-id="adf-file-thumbnail">
|
||||||
<span class="adf-viewer__display-name" id="adf-viewer-display-name">{{ displayName }}</span>
|
<span class="adf-viewer__display-name" id="adf-viewer-display-name">{{ fileTitle }}</span>
|
||||||
<button
|
<button
|
||||||
*ngIf="allowNavigate && canNavigateNext"
|
*ngIf="allowNavigate && canNavigateNext"
|
||||||
data-automation-id="adf-toolbar-next-file"
|
data-automation-id="adf-toolbar-next-file"
|
||||||
|
@@ -175,14 +175,14 @@ describe('ViewerComponent', () => {
|
|||||||
tick();
|
tick();
|
||||||
|
|
||||||
expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id1', {include: [ 'allowableOperations' ]});
|
expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id1', {include: [ 'allowableOperations' ]});
|
||||||
expect(component.displayName).toBe('file1');
|
expect(component.fileTitle).toBe('file1');
|
||||||
|
|
||||||
component.fileNodeId = 'id2';
|
component.fileNodeId = 'id2';
|
||||||
component.ngOnChanges({});
|
component.ngOnChanges({});
|
||||||
tick();
|
tick();
|
||||||
|
|
||||||
expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id2', {include: [ 'allowableOperations' ]});
|
expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id2', {include: [ 'allowableOperations' ]});
|
||||||
expect(component.displayName).toBe('file2');
|
expect(component.fileTitle).toBe('file2');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('Viewer Example Component Rendering', () => {
|
describe('Viewer Example Component Rendering', () => {
|
||||||
|
@@ -219,6 +219,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
otherMenu: any;
|
otherMenu: any;
|
||||||
extension: string;
|
extension: string;
|
||||||
sidebarTemplateContext: { node: MinimalNodeEntryEntity } = { node: null };
|
sidebarTemplateContext: { node: MinimalNodeEntryEntity } = { node: null };
|
||||||
|
fileTitle: string;
|
||||||
|
|
||||||
private cacheBusterNumber;
|
private cacheBusterNumber;
|
||||||
|
|
||||||
@@ -312,7 +313,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setUpBlobData() {
|
private setUpBlobData() {
|
||||||
this.displayName = this.getDisplayName('Unknown');
|
this.fileTitle = this.getDisplayName('Unknown');
|
||||||
this.mimeType = this.blobFile.type;
|
this.mimeType = this.blobFile.type;
|
||||||
this.viewerType = this.getViewerTypeByMimeType(this.mimeType);
|
this.viewerType = this.getViewerTypeByMimeType(this.mimeType);
|
||||||
|
|
||||||
@@ -325,7 +326,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
|
|
||||||
private setUpUrlFile() {
|
private setUpUrlFile() {
|
||||||
let filenameFromUrl = this.getFilenameFromUrl(this.urlFile);
|
let filenameFromUrl = this.getFilenameFromUrl(this.urlFile);
|
||||||
this.displayName = this.getDisplayName(filenameFromUrl);
|
this.fileTitle = this.getDisplayName(filenameFromUrl);
|
||||||
this.extension = this.getFileExtension(filenameFromUrl);
|
this.extension = this.getFileExtension(filenameFromUrl);
|
||||||
this.urlFileContent = this.urlFile;
|
this.urlFileContent = this.urlFile;
|
||||||
|
|
||||||
@@ -348,7 +349,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
this.mimeType = data.content.mimeType;
|
this.mimeType = data.content.mimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.displayName = this.getDisplayName(data.name);
|
this.fileTitle = this.getDisplayName(data.name);
|
||||||
|
|
||||||
this.urlFileContent = this.apiService.contentApi.getContentUrl(data.id);
|
this.urlFileContent = this.apiService.contentApi.getContentUrl(data.id);
|
||||||
this.urlFileContent = this.cacheBusterNumber ? this.urlFileContent + '&' + this.cacheBusterNumber : this.urlFileContent;
|
this.urlFileContent = this.cacheBusterNumber ? this.urlFileContent + '&' + this.cacheBusterNumber : this.urlFileContent;
|
||||||
@@ -376,7 +377,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
|
|
||||||
private setUpSharedLinkFile(details: any) {
|
private setUpSharedLinkFile(details: any) {
|
||||||
this.mimeType = details.entry.content.mimeType;
|
this.mimeType = details.entry.content.mimeType;
|
||||||
this.displayName = this.getDisplayName(details.entry.name);
|
this.fileTitle = this.getDisplayName(details.entry.name);
|
||||||
this.extension = this.getFileExtension(details.entry.name);
|
this.extension = this.getFileExtension(details.entry.name);
|
||||||
this.fileName = details.entry.name;
|
this.fileName = details.entry.name;
|
||||||
|
|
||||||
@@ -406,7 +407,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getDisplayName(name) {
|
private getDisplayName(name) {
|
||||||
return name || this.displayName ;
|
return this.displayName || name ;
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollTop() {
|
scrollTop() {
|
||||||
|
Reference in New Issue
Block a user