mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2921] New Icon for Smart Folders (#3747)
* [ADF-2921] New Icon for Smart Folders * [ADF-2921] Smart folder icon now matches current theme * [ADF-2921] Unit tests added and fixed * [ADF-2921] Improved logic on Share Datatable Adapter
This commit is contained in:
committed by
Eugenio Romano
parent
0569065684
commit
a6e61ac3a4
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { DataColumn, DataRow, DataSorting, ContentService } from '@alfresco/adf-core';
|
import { DataColumn, DataRow, DataSorting, ContentService } from '@alfresco/adf-core';
|
||||||
import { FileNode, FolderNode } from './../../mock';
|
import { FileNode, FolderNode, SmartFolderNode } from './../../mock';
|
||||||
import { DocumentListService } from './../services/document-list.service';
|
import { DocumentListService } from './../services/document-list.service';
|
||||||
import { ShareDataRow } from './share-data-row.model';
|
import { ShareDataRow } from './share-data-row.model';
|
||||||
import { ShareDataTableAdapter } from './share-datatable-adapter';
|
import { ShareDataTableAdapter } from './share-datatable-adapter';
|
||||||
@@ -209,6 +209,19 @@ describe('ShareDataTableAdapter', () => {
|
|||||||
expect(value).toContain(`svg`);
|
expect(value).toContain(`svg`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should resolve smart folder icon', () => {
|
||||||
|
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_smart_folder.svg`);
|
||||||
|
|
||||||
|
let adapter = new ShareDataTableAdapter(documentListService, null, null);
|
||||||
|
|
||||||
|
let row = new ShareDataRow(new SmartFolderNode(), documentListService, null);
|
||||||
|
let col = <DataColumn> { type: 'folder', key: '$thumbnail' };
|
||||||
|
|
||||||
|
let value = adapter.getValue(row, col);
|
||||||
|
expect(value).toContain(`assets/images/ft_ic_smart_folder`);
|
||||||
|
expect(value).toContain(`svg`);
|
||||||
|
});
|
||||||
|
|
||||||
it('should resolve file thumbnail', () => {
|
it('should resolve file thumbnail', () => {
|
||||||
let imageUrl = 'http://<addresss>';
|
let imageUrl = 'http://<addresss>';
|
||||||
let adapter = new ShareDataTableAdapter(documentListService, null, null);
|
let adapter = new ShareDataTableAdapter(documentListService, null, null);
|
||||||
|
@@ -104,7 +104,11 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
const node = (<ShareDataRow> row).node;
|
const node = (<ShareDataRow> row).node;
|
||||||
|
|
||||||
if (node.entry.isFolder) {
|
if (node.entry.isFolder) {
|
||||||
return this.documentListService.getMimeTypeIcon('folder');
|
if (this.isSmartFolder(node)) {
|
||||||
|
return this.documentListService.getMimeTypeIcon('smartFolder');
|
||||||
|
} else {
|
||||||
|
return this.documentListService.getMimeTypeIcon('folder');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.entry.isFile) {
|
if (node.entry.isFile) {
|
||||||
@@ -163,6 +167,11 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
this.imageResolver = resolver;
|
this.imageResolver = resolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isSmartFolder(node: any) {
|
||||||
|
return node.entry.aspectNames.indexOf('smf:customConfigSmartFolder') > -1 ||
|
||||||
|
(node.entry.aspectNames.indexOf('smf:systemConfigSmartFolder') > -1);
|
||||||
|
}
|
||||||
|
|
||||||
private sortRows(rows: DataRow[], sorting: DataSorting) {
|
private sortRows(rows: DataRow[], sorting: DataSorting) {
|
||||||
if (this.sortingMode === 'server') {
|
if (this.sortingMode === 'server') {
|
||||||
return;
|
return;
|
||||||
|
@@ -54,6 +54,7 @@ export class NodeMinimal implements MinimalNodeEntryEntity {
|
|||||||
content: ContentInfo;
|
content: ContentInfo;
|
||||||
path: PathInfoEntity;
|
path: PathInfoEntity;
|
||||||
properties: NodeProperties = {};
|
properties: NodeProperties = {};
|
||||||
|
aspectNames: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UserInfo {
|
export class UserInfo {
|
||||||
|
@@ -55,5 +55,19 @@ export class FolderNode extends NodeMinimalEntry {
|
|||||||
this.entry.isFolder = true;
|
this.entry.isFolder = true;
|
||||||
this.entry.name = name;
|
this.entry.name = name;
|
||||||
this.entry.path = new PathInfoEntity();
|
this.entry.path = new PathInfoEntity();
|
||||||
|
this.entry.aspectNames = ['cm:folder'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SmartFolderNode extends NodeMinimalEntry {
|
||||||
|
constructor(name?: string) {
|
||||||
|
super();
|
||||||
|
this.entry = new NodeMinimal();
|
||||||
|
this.entry.id = 'smart-folder-id';
|
||||||
|
this.entry.isFile = false;
|
||||||
|
this.entry.isFolder = true;
|
||||||
|
this.entry.name = name;
|
||||||
|
this.entry.path = new PathInfoEntity();
|
||||||
|
this.entry.aspectNames = ['smf:systemConfigSmartFolder'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
lib/core/assets/images/ft_ic_smart_folder.svg
Normal file
16
lib/core/assets/images/ft_ic_smart_folder.svg
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->
|
||||||
|
<title>filetype/folder</title>
|
||||||
|
<desc>Created with Sketch.</desc>
|
||||||
|
<defs></defs>
|
||||||
|
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<g id="filetype/folder">
|
||||||
|
<polygon id="Fill-1" points="0 24 24 24 24 0 0 0"></polygon>
|
||||||
|
<path d="M10,4 L4,4 C2.895,4 2.01,4.895 2.01,6 L2,18 C2,19.105 2.895,20 4,20 L20,20 C21.105,20 22,19.105 22,18 L22,8 C22,6.895 21.105,6 20,6 L12,6 L10,4 Z" id="Fill-2" fill="#D9E021"></path>
|
||||||
|
<g id="cog" transform="translate(10.000000, 8.000000)" fill-rule="nonzero" fill="#FFFFFF">
|
||||||
|
<path d="M8.97602103,5.70765953 L9.87354689,6.20360587 C9.97604967,6.2602388 10.0236259,6.37735544 9.98851764,6.48556081 C9.7553749,7.20414773 9.3573263,7.85333966 8.83672508,8.39253187 C8.75648164,8.47568691 8.62677806,8.49455592 8.52435171,8.4379753 L7.6274998,7.9421096 C7.25015532,8.25161622 6.81633302,8.49173291 6.34786835,8.65037397 L6.34786835,9.64194408 C6.34787008,9.75522045 6.26583319,9.85335946 6.15038149,9.87819349 C5.41418114,10.0364592 4.62349658,10.0446447 3.85014503,9.87833462 C3.73452139,9.85347581 3.65211059,9.7554317 3.65211059,9.6419844 L3.65211059,8.65037397 C3.18364144,8.49174219 2.74981745,8.25162456 2.37247914,7.9421096 L1.47562723,8.4379753 C1.37320088,8.49455592 1.24349729,8.47568691 1.16325386,8.39253187 C0.642673695,7.85333966 0.244604043,7.20414773 0.011461297,6.48556081 C-0.02364701,6.3773756 0.023929274,6.26025896 0.126432051,6.20360587 L1.02397897,5.70765953 C0.933828729,5.23983992 0.933828729,4.76018024 1.02397897,4.29236063 L0.126453112,3.79641429 C0.0239503348,3.73978137 -0.0236259492,3.62266472 0.0114823578,3.51445935 C0.244625104,2.79587243 0.642673695,2.1466805 1.16327492,1.60748829 C1.24351836,1.52433325 1.37322194,1.50546424 1.47564829,1.56204486 L2.3725002,2.05791056 C2.74984468,1.74840395 3.18366698,1.50828725 3.65213165,1.34964619 L3.65213165,0.358055922 C3.65212992,0.244779553 3.73416681,0.146640538 3.84961851,0.12180651 C4.58581886,-0.0364592244 5.37650342,-0.0446446879 6.14985497,0.121665382 C6.26547861,0.146524191 6.34788941,0.244568301 6.34788941,0.358015599 L6.34788941,1.34962603 C6.81635856,1.50825781 7.25018255,1.74837544 7.62752086,2.0578904 L8.52437277,1.5620247 C8.62679912,1.50544408 8.75650271,1.52431309 8.83674614,1.60746813 C9.3573263,2.14666034 9.75539596,2.79585227 9.9885387,3.51443919 C10.023647,3.6226244 9.97607073,3.73974104 9.87356795,3.79639413 L8.97602103,4.29234047 C9.06617149,4.76016684 9.06617149,5.23983316 8.97602103,5.70765953 Z M6.68486176,5 C6.68486176,4.11064738 5.92903278,3.38710079 5,3.38710079 C4.07096722,3.38710079 3.31513824,4.11064738 3.31513824,5 C3.31513824,5.88935262 4.07096722,6.61289921 5,6.61289921 C5.92903278,6.61289921 6.68486176,5.88935262 6.68486176,5 Z" id="Shape"></path>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.0 KiB |
@@ -145,6 +145,7 @@ export class ThumbnailService {
|
|||||||
'application/wordperfect': './assets/images/ft_ic_document.svg',
|
'application/wordperfect': './assets/images/ft_ic_document.svg',
|
||||||
'application/x-cpio': './assets/images/ft_ic_document.svg',
|
'application/x-cpio': './assets/images/ft_ic_document.svg',
|
||||||
'folder': './assets/images/ft_ic_folder.svg',
|
'folder': './assets/images/ft_ic_folder.svg',
|
||||||
|
'smartFolder': './assets/images/ft_ic_smart_folder.svg',
|
||||||
'disable/folder': './assets/images/ft_ic_folder_disable.svg',
|
'disable/folder': './assets/images/ft_ic_folder_disable.svg',
|
||||||
'selected': './assets/images/ft_ic_selected.svg'
|
'selected': './assets/images/ft_ic_selected.svg'
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user