mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[MNT-25522] Add support for fileLink icon (#11903)
* [MNT-25522] Add support for fileLink icon * [MNT-25522] cr fixes
This commit is contained in:
@@ -210,6 +210,13 @@ describe('ContentService', () => {
|
||||
expect(contentService.getNodeIcon(node)).toContain('assets/images/ft_ic_ms_word.svg');
|
||||
});
|
||||
|
||||
it('should resolve file link icon for app:filelink node', () => {
|
||||
node.isFolder = false;
|
||||
node.isFile = true;
|
||||
node.nodeType = 'app:filelink';
|
||||
expect(contentService.getNodeIcon(node)).toContain('assets/images/ft_ic_file_link.svg');
|
||||
});
|
||||
|
||||
it('should resolve fallback file icon for unknown node', () => {
|
||||
node.isFolder = false;
|
||||
node.isFile = false;
|
||||
|
||||
@@ -151,6 +151,9 @@ export class ContentService {
|
||||
return this.getFolderIcon(node);
|
||||
}
|
||||
if (node?.isFile) {
|
||||
if (node?.nodeType === 'app:filelink') {
|
||||
return this.thumbnailService.getMimeTypeIcon('fileLink');
|
||||
}
|
||||
return this.thumbnailService.getMimeTypeIcon(node?.content?.mimeType);
|
||||
}
|
||||
return this.thumbnailService.getDefaultMimeTypeIcon();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { DataColumn, DataRow, DataSorting, NoopAuthModule, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { FileNode, FolderNode, SmartFolderNode, RuleFolderNode, LinkFolderNode } from './../../mock';
|
||||
import { FileNode, FileLinkNode, FolderNode, SmartFolderNode, RuleFolderNode, LinkFolderNode } from './../../mock';
|
||||
import { ERR_OBJECT_NOT_FOUND, ShareDataRow } from './share-data-row.model';
|
||||
import { ERR_COL_NOT_FOUND, ERR_ROW_NOT_FOUND, ShareDataTableAdapter } from './share-datatable-adapter';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
@@ -237,6 +237,19 @@ describe('ShareDataTableAdapter', () => {
|
||||
expect(value).toContain(`svg`);
|
||||
});
|
||||
|
||||
it('should resolve file link icon for app:filelink node', () => {
|
||||
spyOn(thumbnailService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_file_link.svg`);
|
||||
|
||||
const adapter = new ShareDataTableAdapter(thumbnailService, contentService, null);
|
||||
|
||||
const row = new ShareDataRow(new FileLinkNode(), contentService, null);
|
||||
const col = { type: 'image', key: '$thumbnail' } as DataColumn;
|
||||
|
||||
const value = adapter.getValue(row, col);
|
||||
expect(thumbnailService.getMimeTypeIcon).toHaveBeenCalledWith('fileLink');
|
||||
expect(value).toContain('ft_ic_file_link');
|
||||
});
|
||||
|
||||
it('should resolve rule folder icon', () => {
|
||||
spyOn(thumbnailService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder_rule.svg`);
|
||||
|
||||
|
||||
@@ -116,6 +116,10 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
||||
}
|
||||
|
||||
if (node.entry.isFile) {
|
||||
if (node.entry.nodeType === 'app:filelink') {
|
||||
return this.thumbnailService.getMimeTypeIcon('fileLink');
|
||||
}
|
||||
|
||||
if (this.thumbnails) {
|
||||
return this.getDocumentThumbnailUrl(node);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ export const NodeAction = {
|
||||
CHOOSE: 'CHOOSE',
|
||||
COPY: 'COPY',
|
||||
MOVE: 'MOVE',
|
||||
NEXT: 'NEXT'
|
||||
NEXT: 'NEXT',
|
||||
LINK: 'LINK'
|
||||
} as const;
|
||||
|
||||
export type NodeAction = (typeof NodeAction)[keyof typeof NodeAction];
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
"ATTACH": "Attach",
|
||||
"CHOOSE_ITEM": "Select content to attach from '{{ name }}'",
|
||||
"COPY": "Copy",
|
||||
"LINK": "Create Link",
|
||||
"COPY_ITEM": "Copy '{{ name }}' to...",
|
||||
"LOCATION": "Location",
|
||||
"MOVE": "Move",
|
||||
|
||||
@@ -87,3 +87,17 @@ export class LinkFolderNode extends NodeEntry {
|
||||
this.entry.properties = {};
|
||||
}
|
||||
}
|
||||
|
||||
export class FileLinkNode extends NodeEntry {
|
||||
constructor(name?: string) {
|
||||
super();
|
||||
this.entry = new Node();
|
||||
this.entry.id = 'file-link-id';
|
||||
this.entry.isFile = true;
|
||||
this.entry.isFolder = false;
|
||||
this.entry.nodeType = 'app:filelink';
|
||||
this.entry.name = name;
|
||||
this.entry.path = new PathInfo();
|
||||
this.entry.properties = {};
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.0 KiB |
@@ -19,7 +19,6 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { ThumbnailService } from './thumbnail.service';
|
||||
|
||||
describe('ThumbnailService', () => {
|
||||
|
||||
let service: ThumbnailService;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -53,4 +52,8 @@ describe('ThumbnailService', () => {
|
||||
it('should return the correct icon for a mht file', () => {
|
||||
expect(service.getMimeTypeIcon('multipart/related')).toContain('ft_ic_website.svg');
|
||||
});
|
||||
|
||||
it('should return the correct icon for a file link', () => {
|
||||
expect(service.getMimeTypeIcon('fileLink')).toContain('ft_ic_file_link.svg');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -158,7 +158,8 @@ export class ThumbnailService {
|
||||
'save-as': './assets/images/save-as.svg',
|
||||
save: './assets/images/save.svg',
|
||||
task: './assets/images/task.svg',
|
||||
'multipart/related': './assets/images/ft_ic_website.svg'
|
||||
'multipart/related': './assets/images/ft_ic_website.svg',
|
||||
fileLink: './assets/images/ft_ic_file_link.svg'
|
||||
};
|
||||
|
||||
constructor() {
|
||||
|
||||
Reference in New Issue
Block a user