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');
|
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', () => {
|
it('should resolve fallback file icon for unknown node', () => {
|
||||||
node.isFolder = false;
|
node.isFolder = false;
|
||||||
node.isFile = false;
|
node.isFile = false;
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ export class ContentService {
|
|||||||
return this.getFolderIcon(node);
|
return this.getFolderIcon(node);
|
||||||
}
|
}
|
||||||
if (node?.isFile) {
|
if (node?.isFile) {
|
||||||
|
if (node?.nodeType === 'app:filelink') {
|
||||||
|
return this.thumbnailService.getMimeTypeIcon('fileLink');
|
||||||
|
}
|
||||||
return this.thumbnailService.getMimeTypeIcon(node?.content?.mimeType);
|
return this.thumbnailService.getMimeTypeIcon(node?.content?.mimeType);
|
||||||
}
|
}
|
||||||
return this.thumbnailService.getDefaultMimeTypeIcon();
|
return this.thumbnailService.getDefaultMimeTypeIcon();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { DataColumn, DataRow, DataSorting, NoopAuthModule, ThumbnailService } from '@alfresco/adf-core';
|
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_OBJECT_NOT_FOUND, ShareDataRow } from './share-data-row.model';
|
||||||
import { ERR_COL_NOT_FOUND, ERR_ROW_NOT_FOUND, ShareDataTableAdapter } from './share-datatable-adapter';
|
import { ERR_COL_NOT_FOUND, ERR_ROW_NOT_FOUND, ShareDataTableAdapter } from './share-datatable-adapter';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
@@ -237,6 +237,19 @@ describe('ShareDataTableAdapter', () => {
|
|||||||
expect(value).toContain(`svg`);
|
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', () => {
|
it('should resolve rule folder icon', () => {
|
||||||
spyOn(thumbnailService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder_rule.svg`);
|
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.isFile) {
|
||||||
|
if (node.entry.nodeType === 'app:filelink') {
|
||||||
|
return this.thumbnailService.getMimeTypeIcon('fileLink');
|
||||||
|
}
|
||||||
|
|
||||||
if (this.thumbnails) {
|
if (this.thumbnails) {
|
||||||
return this.getDocumentThumbnailUrl(node);
|
return this.getDocumentThumbnailUrl(node);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ export const NodeAction = {
|
|||||||
CHOOSE: 'CHOOSE',
|
CHOOSE: 'CHOOSE',
|
||||||
COPY: 'COPY',
|
COPY: 'COPY',
|
||||||
MOVE: 'MOVE',
|
MOVE: 'MOVE',
|
||||||
NEXT: 'NEXT'
|
NEXT: 'NEXT',
|
||||||
|
LINK: 'LINK'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type NodeAction = (typeof NodeAction)[keyof typeof NodeAction];
|
export type NodeAction = (typeof NodeAction)[keyof typeof NodeAction];
|
||||||
|
|||||||
@@ -102,6 +102,7 @@
|
|||||||
"ATTACH": "Attach",
|
"ATTACH": "Attach",
|
||||||
"CHOOSE_ITEM": "Select content to attach from '{{ name }}'",
|
"CHOOSE_ITEM": "Select content to attach from '{{ name }}'",
|
||||||
"COPY": "Copy",
|
"COPY": "Copy",
|
||||||
|
"LINK": "Create Link",
|
||||||
"COPY_ITEM": "Copy '{{ name }}' to...",
|
"COPY_ITEM": "Copy '{{ name }}' to...",
|
||||||
"LOCATION": "Location",
|
"LOCATION": "Location",
|
||||||
"MOVE": "Move",
|
"MOVE": "Move",
|
||||||
|
|||||||
@@ -87,3 +87,17 @@ export class LinkFolderNode extends NodeEntry {
|
|||||||
this.entry.properties = {};
|
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';
|
import { ThumbnailService } from './thumbnail.service';
|
||||||
|
|
||||||
describe('ThumbnailService', () => {
|
describe('ThumbnailService', () => {
|
||||||
|
|
||||||
let service: ThumbnailService;
|
let service: ThumbnailService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -53,4 +52,8 @@ describe('ThumbnailService', () => {
|
|||||||
it('should return the correct icon for a mht file', () => {
|
it('should return the correct icon for a mht file', () => {
|
||||||
expect(service.getMimeTypeIcon('multipart/related')).toContain('ft_ic_website.svg');
|
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-as': './assets/images/save-as.svg',
|
||||||
save: './assets/images/save.svg',
|
save: './assets/images/save.svg',
|
||||||
task: './assets/images/task.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() {
|
constructor() {
|
||||||
|
|||||||
Reference in New Issue
Block a user