diff --git a/e2e/configs.ts b/e2e/configs.ts index 73db16569..4a3173209 100755 --- a/e2e/configs.ts +++ b/e2e/configs.ts @@ -98,5 +98,6 @@ export const EXTENSIBILITY_CONFIGS = { INFO_DRAWER_EMPTY: 'info-drawer-no-tabs-ext.json', VIEWER: 'viewer-ext.json', HEADER: 'header-ext.json', - METADATA_PRESETS: 'metadata-ext.json' + METADATA_PRESETS: 'metadata-ext.json', + DOCUMENT_LIST_PRESETS: 'document-presets-ext.json' }; diff --git a/e2e/resources/extensibility-configs/document-presets-ext.json b/e2e/resources/extensibility-configs/document-presets-ext.json new file mode 100644 index 000000000..64dd83784 --- /dev/null +++ b/e2e/resources/extensibility-configs/document-presets-ext.json @@ -0,0 +1,1159 @@ +{ + "$schema": "../../extension.schema.json", + "$name": "app", + "$version": "1.0.0", + "$references": [ + "plugin1.json", + "dev.tools.json", + "app.header.json", + "app.create.json", + "metadata-plugin.json" + ], + + "rules": [ + { + "id": "app.toolbar.favorite.canToggle", + "comment": "workaround for recent files and search api issue", + "type": "core.every", + "parameters": [ + { + "type": "rule", + "value": "core.some", + "parameters": [ + { + "type": "rule", + "value": "app.selection.canAddFavorite" + }, + { + "type": "rule", + "value": "app.selection.canRemoveFavorite" + } + ] + }, + { + "type": "rule", + "value": "core.some", + "parameters": [ + { + "type": "rule", + "value": "app.navigation.isRecentFiles" + }, + { + "type": "rule", + "value": "app.navigation.isSharedFiles" + }, + { + "type": "rule", + "value": "app.navigation.isSearchResults" + }, + { + "type": "rule", + "value": "app.navigation.isFavorites" + } + ] + } + ] + }, + { + "id": "app.toolbar.favorite.canAdd", + "type": "core.every", + "parameters": [ + { "type": "rule", "value": "app.selection.canAddFavorite" }, + { "type": "rule", "value": "app.navigation.isNotRecentFiles" }, + { "type": "rule", "value": "app.navigation.isNotSharedFiles" }, + { + "type": "rule", + "value": "app.navigation.isNotSearchResults" + }, + { "type": "rule", "value": "app.navigation.isNotFavorites" } + ] + }, + { + "id": "app.toolbar.favorite.canRemove", + "type": "core.every", + "parameters": [ + { "type": "rule", "value": "app.selection.canRemoveFavorite" }, + { "type": "rule", "value": "app.navigation.isNotRecentFiles" }, + { "type": "rule", "value": "app.navigation.isNotSharedFiles" }, + { + "type": "rule", + "value": "app.navigation.isNotSearchResults" + }, + { "type": "rule", "value": "app.navigation.isNotFavorites" } + ] + }, + { + "id": "app.toolbar.info", + "type": "core.every", + "parameters": [ + { "type": "rule", "value": "app.selection.notEmpty" }, + { "type": "rule", "value": "app.navigation.isNotLibraries" }, + { "type": "rule", "value": "app.navigation.isNotTrashcan" } + ] + }, + { + "id": "app.toolbar.canCopyNode", + "type": "core.every", + "parameters": [ + { "type": "rule", "value": "app.selection.notEmpty" }, + { "type": "rule", "value": "app.navigation.isNotTrashcan" }, + { "type": "rule", "value": "app.navigation.isNotLibraries" } + ] + }, + { + "id": "app.toolbar.permissions", + "type": "core.every", + "parameters": [ + { "type": "rule", "value": "app.selection.first.canUpdate" }, + { "type": "rule", "value": "app.navigation.isNotTrashcan" } + ] + }, + { + "id": "app.toolbar.versions", + "type": "core.every", + "parameters": [ + { "type": "rule", "value": "app.selection.file" }, + { "type": "rule", "value": "app.navigation.isNotTrashcan" } + ] + }, + { + "id": "app.trashcan.hasSelection", + "type": "core.every", + "parameters": [ + { "type": "rule", "value": "app.selection.notEmpty" }, + { "type": "rule", "value": "app.navigation.isTrashcan" } + ] + }, + { + "id": "app.toolbar.canEditFolder", + "type": "core.every", + "parameters": [ + { "type": "rule", "value": "app.selection.folder" }, + { "type": "rule", "value": "app.selection.folder.canUpdate" }, + { "type": "rule", "value": "app.navigation.isNotTrashcan" } + ] + }, + { + "id": "app.toolbar.canViewFile", + "type": "core.every", + "parameters": [ + { + "type": "rule", + "value": "app.selection.file" + }, + { + "type": "rule", + "value": "core.not", + "parameters": [ + { "type": "rule", "value": "app.navigation.isTrashcan" } + ] + } + ] + }, + { + "id": "app.toolbar.canDownload", + "type": "core.every", + "parameters": [ + { "type": "rule", "value": "app.selection.canDownload" }, + { "type": "rule", "value": "app.navigation.isNotTrashcan" } + ] + } + ], + + "features": { + "create": [ + { + "id": "app.create.uploadFile", + "order": 100, + "icon": "file_upload", + "title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FILE", + "description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES", + "description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FILES_NOT_ALLOWED", + "actions": { + "click": "UPLOAD_FILES" + }, + "rules": { + "enabled": "app.navigation.folder.canUpload" + } + }, + { + "id": "app.create.uploadFolder", + "order": 200, + "icon": "file_upload", + "title": "APP.NEW_MENU.MENU_ITEMS.UPLOAD_FOLDER", + "description": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS", + "description-disabled": "APP.NEW_MENU.TOOLTIPS.UPLOAD_FOLDERS_NOT_ALLOWED", + "actions": { + "click": "UPLOAD_FOLDER" + }, + "rules": { + "enabled": "app.navigation.folder.canUpload" + } + }, + { + "id": "app.create.separator.1", + "type": "separator", + "order": 300 + }, + { + "id": "app.create.folder", + "order": 400, + "icon": "create_new_folder", + "title": "APP.NEW_MENU.MENU_ITEMS.CREATE_FOLDER", + "description": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER", + "description-disabled": "APP.NEW_MENU.TOOLTIPS.CREATE_FOLDER_NOT_ALLOWED", + "actions": { + "click": "CREATE_FOLDER" + }, + "rules": { + "enabled": "app.navigation.folder.canCreate" + } + }, + { + "id": "app.create.library", + "order": 600, + "title": "APP.NEW_MENU.MENU_ITEMS.CREATE_LIBRARY", + "description": "APP.NEW_MENU.TOOLTIPS.CREATE_LIBRARY", + "icon": "create_new_folder", + "actions": { + "click": "CREATE_LIBRARY" + } + } + ], + "navbar": [ + { + "id": "app.navbar.primary", + "items": [ + { + "id": "app.navbar.personalFiles", + "order": 100, + "icon": "folder", + "title": "APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL", + "description": "APP.BROWSE.PERSONAL.SIDENAV_LINK.TOOLTIP", + "route": "personal-files" + }, + { + "id": "app.navbar.libraries", + "order": 200, + "icon": "group_work", + "title": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL", + "description": "APP.BROWSE.LIBRARIES.SIDENAV_LINK.TOOLTIP", + "route": "libraries" + } + ] + }, + { + "id": "app.navbar.secondary", + "items": [ + { + "id": "app.navbar.shared", + "order": 100, + "icon": "people", + "title": "APP.BROWSE.SHARED.SIDENAV_LINK.LABEL", + "description": "APP.BROWSE.SHARED.SIDENAV_LINK.TOOLTIP", + "route": "shared", + "rules": { + "visible": "repository.isQuickShareEnabled" + } + }, + { + "id": "app.navbar.recentFiles", + "order": 200, + "icon": "schedule", + "title": "APP.BROWSE.RECENT.SIDENAV_LINK.LABEL", + "description": "APP.BROWSE.RECENT.SIDENAV_LINK.TOOLTIP", + "route": "recent-files" + }, + { + "id": "app.navbar.favorites", + "order": 300, + "icon": "star", + "title": "APP.BROWSE.FAVORITES.SIDENAV_LINK.LABEL", + "description": "APP.BROWSE.FAVORITES.SIDENAV_LINK.TOOLTIP", + "route": "favorites" + }, + { + "id": "app.navbar.trashcan", + "order": 400, + "icon": "delete", + "title": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.LABEL", + "description": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.TOOLTIP", + "route": "trashcan" + } + ] + } + ], + "toolbar": [ + { + "id": "app.toolbar.preview", + "order": 100, + "title": "APP.ACTIONS.VIEW", + "icon": "open_in_browser", + "actions": { + "click": "VIEW_FILE" + }, + "rules": { + "visible": "app.toolbar.canViewFile" + } + }, + { + "id": "app.toolbar.download", + "order": 200, + "title": "APP.ACTIONS.DOWNLOAD", + "icon": "get_app", + "actions": { + "click": "DOWNLOAD_NODES" + }, + "rules": { + "visible": "app.toolbar.canDownload" + } + }, + { + "id": "app.toolbar.editFolder", + "order": 300, + "title": "APP.ACTIONS.EDIT", + "icon": "create", + "actions": { + "click": "EDIT_FOLDER" + }, + "rules": { + "visible": "app.toolbar.canEditFolder" + } + }, + { + "id": "app.toolbar.purgeDeletedNodes", + "order": 400, + "title": "APP.ACTIONS.DELETE_PERMANENT", + "icon": "delete_forever", + "actions": { + "click": "PURGE_DELETED_NODES" + }, + "rules": { + "visible": "app.trashcan.hasSelection" + } + }, + { + "id": "app.toolbar.restoreDeletedNodes", + "order": 500, + "title": "APP.ACTIONS.RESTORE", + "icon": "restore", + "actions": { + "click": "RESTORE_DELETED_NODES" + }, + "rules": { + "visible": "app.trashcan.hasSelection" + } + }, + { + "id": "app.toolbar.info", + "type": "custom", + "order": 700, + "component": "app.toolbar.toggleInfoDrawer", + "rules": { + "visible": "app.toolbar.info" + } + }, + { + "id": "app.toolbar.more", + "type": "menu", + "order": 10000, + "icon": "more_vert", + "title": "APP.ACTIONS.MORE", + "children": [ + { + "id": "app.toolbar.favorite", + "comment": "workaround for Recent Files and Search API issue", + "type": "custom", + "order": 100, + "component": "app.toolbar.toggleFavorite", + "rules": { + "visible": "app.toolbar.favorite.canToggle" + } + }, + { + "id": "app.toolbar.favorite.add", + "order": 200, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star_border", + "actions": { + "click": "ADD_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canAdd" + } + }, + { + "id": "app.toolbar.favorite.remove", + "order": 300, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star", + "actions": { + "click": "REMOVE_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canRemove" + } + }, + { + "id": "app.toolbar.copy", + "order": 400, + "title": "APP.ACTIONS.COPY", + "icon": "content_copy", + "actions": { + "click": "COPY_NODES" + }, + "rules": { + "visible": "app.toolbar.canCopyNode" + } + }, + { + "id": "app.toolbar.move", + "order": 500, + "title": "APP.ACTIONS.MOVE", + "icon": "library_books", + "actions": { + "click": "MOVE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.toolbar.share", + "type": "custom", + "order": 600, + "component": "app.shared-link.toggleSharedLink", + "rules": { + "visible": "app.selection.file.canShare" + } + }, + { + "id": "app.toolbar.delete", + "order": 800, + "title": "APP.ACTIONS.DELETE", + "icon": "delete", + "actions": { + "click": "DELETE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.toolbar.deleteLibrary", + "order": 900, + "title": "APP.ACTIONS.DELETE", + "icon": "delete", + "actions": { + "click": "DELETE_LIBRARY" + }, + "rules": { + "visible": "app.selection.library" + } + }, + { + "id": "app.toolbar.versions", + "order": 1000, + "title": "APP.ACTIONS.VERSIONS", + "icon": "history", + "actions": { + "click": "MANAGE_VERSIONS" + }, + "rules": { + "visible": "app.toolbar.versions" + } + }, + { + "id": "app.toolbar.permissions", + "order": 1100, + "title": "APP.ACTIONS.PERMISSIONS", + "icon": "settings_input_component", + "actions": { + "click": "MANAGE_PERMISSIONS" + }, + "rules": { + "visible": "app.toolbar.permissions" + } + } + ] + } + ], + "contextMenu": [ + { + "id": "app.context.menu.download", + "order": 100, + "title": "APP.ACTIONS.DOWNLOAD", + "icon": "get_app", + "actions": { + "click": "DOWNLOAD_NODES" + }, + "rules": { + "visible": "app.toolbar.canDownload" + } + }, + { + "id": "app.context.menu.preview", + "order": 200, + "title": "APP.ACTIONS.VIEW", + "icon": "open_in_browser", + "actions": { + "click": "VIEW_FILE" + }, + "rules": { + "visible": "app.toolbar.canViewFile" + } + }, + { + "id": "app.context.menu.editFolder", + "order": 300, + "title": "APP.ACTIONS.EDIT", + "icon": "create", + "actions": { + "click": "EDIT_FOLDER" + }, + "rules": { + "visible": "app.toolbar.canEditFolder" + } + }, + { + "id": "app.context.menu.share", + "type": "custom", + "order": 400, + "component": "app.shared-link.toggleSharedLink", + "rules": { + "visible": "app.selection.file.canShare" + } + }, + { + "id": "app.context.menu.favorite.add", + "title": "APP.ACTIONS.FAVORITE", + "order": 500, + "icon": "star_border", + "actions": { + "click": "ADD_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canAdd" + } + }, + { + "id": "app.context.menu.favorite.remove", + "title": "APP.ACTIONS.FAVORITE", + "order": 600, + "icon": "star", + "actions": { + "click": "REMOVE_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canRemove" + } + }, + { + "id": "app.context.menu.favorite", + "comment": "workaround for Recent Files and Search API issue", + "type": "custom", + "order": 501, + "component": "app.toolbar.toggleFavorite", + "rules": { + "visible": "app.toolbar.favorite.canToggle" + } + }, + { + "id": "app.context.menu.copy", + "title": "APP.ACTIONS.COPY", + "order": 700, + "icon": "content_copy", + "actions": { + "click": "COPY_NODES" + }, + "rules": { + "visible": "app.toolbar.canCopyNode" + } + }, + { + "id": "app.context.menu.move", + "title": "APP.ACTIONS.MOVE", + "order": 800, + "icon": "library_books", + "actions": { + "click": "MOVE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.context.menu.delete", + "title": "APP.ACTIONS.DELETE", + "order": 900, + "icon": "delete", + "actions": { + "click": "DELETE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.context.menu.versions", + "title": "APP.ACTIONS.VERSIONS", + "order": 1000, + "icon": "history", + "actions": { + "click": "MANAGE_VERSIONS" + }, + "rules": { + "visible": "app.toolbar.versions" + } + }, + { + "id": "app.context.menu.permissions", + "title": "APP.ACTIONS.PERMISSIONS", + "icon": "settings_input_component", + "order": 1100, + "actions": { + "click": "MANAGE_PERMISSIONS" + }, + "rules": { + "visible": "app.toolbar.permissions" + } + }, + { + "id": "app.context.menu.purgeDeletedNodes", + "order": 1200, + "title": "APP.ACTIONS.DELETE_PERMANENT", + "icon": "delete_forever", + "actions": { + "click": "PURGE_DELETED_NODES" + }, + "rules": { + "visible": "app.trashcan.hasSelection" + } + }, + { + "id": "app.context.menu.restoreDeletedNodes", + "order": 1300, + "title": "APP.ACTIONS.RESTORE", + "icon": "restore", + "actions": { + "click": "RESTORE_DELETED_NODES" + }, + "rules": { + "visible": "app.trashcan.hasSelection" + } + } + ], + "viewer": { + "toolbarActions": [ + { + "id": "app.toolbar.download", + "order": 100, + "title": "APP.ACTIONS.DOWNLOAD", + "icon": "get_app", + "actions": { + "click": "DOWNLOAD_NODES" + }, + "rules": { + "visible": "app.toolbar.canDownload" + } + }, + { + "id": "app.viewer.print", + "order": 200, + "title": "APP.ACTIONS.PRINT", + "icon": "print", + "actions": { + "click": "PRINT_FILE" + }, + "rules": { + "visible": "app.toolbar.canViewFile" + } + }, + { + "id": "app.viewer.share", + "order": 300, + "title": "APP.ACTIONS.SHARE", + "icon": "share", + "actions": { + "click": "SHARE_NODE" + }, + "rules": { + "visible": "app.selection.file.canShare" + } + }, + { + "id": "app.viewer.fullscreen", + "order": 400, + "title": "APP.ACTIONS.FULLSCREEN", + "icon": "fullscreen", + "actions": { + "click": "FULLSCREEN_VIEWER" + }, + "rules": { + "visible": "app.toolbar.canViewFile" + } + } + ], + "toolbarMoreMenu": [ + { + "id": "app.viewer.favorite.add", + "order": 100, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star_border", + "actions": { + "click": "ADD_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canAdd" + } + }, + { + "id": "app.viewer.favorite.remove", + "order": 200, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star", + "actions": { + "click": "REMOVE_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canRemove" + } + }, + { + "id": "app.viewer.favorite", + "comment": "workaround for Recent Files and Search API issue", + "type": "custom", + "order": 101, + "component": "app.toolbar.toggleFavorite", + "rules": { + "visible": "app.toolbar.favorite.canToggle" + } + }, + { + "id": "app.viewer.share", + "type": "custom", + "order": 300, + "component": "app.shared-link.toggleSharedLink", + "rules": { + "visible": "app.selection.file.canShare" + } + }, + { + "id": "app.viewer.copy", + "order": 400, + "title": "APP.ACTIONS.COPY", + "icon": "content_copy", + "actions": { + "click": "COPY_NODES" + }, + "rules": { + "visible": "app.toolbar.canCopyNode" + } + }, + { + "id": "app.viewer.move", + "order": 500, + "title": "APP.ACTIONS.MOVE", + "icon": "library_books", + "actions": { + "click": "MOVE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.delete", + "order": 600, + "title": "APP.ACTIONS.DELETE", + "icon": "delete", + "actions": { + "click": "DELETE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.versions", + "order": 700, + "title": "APP.ACTIONS.VERSIONS", + "icon": "history", + "actions": { + "click": "MANAGE_VERSIONS" + }, + "rules": { + "visible": "app.toolbar.versions" + } + }, + { + "id": "app.viewer.permissions", + "order": 800, + "title": "APP.ACTIONS.PERMISSIONS", + "icon": "settings_input_component", + "actions": { + "click": "MANAGE_PERMISSIONS" + }, + "rules": { + "visible": "app.toolbar.permissions" + } + } + ], + "content": [ + { + "id": "app.viewer.pdf", + "disabled": true, + "fileExtension": "pdf", + "component": "app.components.tabs.metadata" + }, + { + "id": "app.viewer.docx", + "disabled": true, + "fileExtension": "docx", + "component": "app.components.tabs.comments" + } + ] + }, + "sidebar": [ + { + "id": "app.sidebar.properties", + "order": 100, + "title": "APP.INFO_DRAWER.TABS.PROPERTIES", + "component": "app.components.tabs.metadata" + }, + { + "id": "app.sidebar.comments", + "order": 200, + "title": "APP.INFO_DRAWER.TABS.COMMENTS", + "component": "app.components.tabs.comments" + }, + { + "id": "app.sidebar.versions", + "order": 300, + "disabled": true, + "title": "APP.INFO_DRAWER.TABS.VERSIONS", + "component": "app.components.tabs.versions" + } + ], + "content-metadata-presets": [ + { + "id": "app.content.metadata.custom", + "custom": [ + { + "id": "app.content.metadata.customGroup", + "title": "APP.CONTENT_METADATA.EXIF_GROUP_TITLE", + "items": [ + { + "id": "app.content.metadata.exifAspect", + "aspect": "exif:exif", + "properties": [ + "exif:pixelXDimension", + "exif:pixelYDimension", + "exif:dateTimeOriginal", + "exif:exposureTime", + "exif:fNumber", + "exif:flash", + "exif:focalLength", + "exif:isoSpeedRatings", + "exif:orientation", + "exif:manufacturer", + "exif:model", + "exif:software" + ] + } + ] + } + ] + } + ], + "documentList": { + "files": [ + { + "id": "app.files.name", + "key": "name", + "title": "APP.DOCUMENT_LIST.COLUMNS.NAME", + "type": "text", + "class": "adf-data-table-cell--ellipsis__name", + "sortable": true, + "template": "app.columns.name", + "desktopOnly": false + }, + { + "id": "app.files.thumbnail", + "key": "$thumbnail", + "type": "image", + "class": "image-table-cell", + "sortable": false, + "desktopOnly": false + }, + { + "id": "app.files.size", + "key": "content.sizeInBytes", + "title": "APP.DOCUMENT_LIST.COLUMNS.SIZE", + "type": "fileSize", + "sortable": true, + "desktopOnly": true, + "disabled": true + }, + { + "id": "app.files.modifiedBy", + "key": "modifiedByUser.displayName", + "title": "Test header", + "type": "text", + "class": "adf-data-table-cell--ellipsis", + "sortable": true, + "desktopOnly": true + }, + { + "id": "some.id.createdBy", + "key": "createdByUser.displayName", + "title": "New column", + "type": "text", + "class": "adf-data-table-cell--ellipsis", + "sortable": true, + "desktopOnly": true + } + ], + "libraries": [ + { + "id": "app.libraries.thumbnail", + "key": "$thumbnail", + "type": "image", + "class": "image-table-cell", + "sortable": false, + "desktopOnly": false + }, + { + "id": "app.libraries.name", + "key": "title", + "title": "APP.DOCUMENT_LIST.COLUMNS.TITLE", + "type": "text", + "class": "adf-data-table-cell--ellipsis__name", + "sortable": true, + "template": "app.columns.libraryName", + "desktopOnly": false + }, + { + "id": "app.libraries.visibility", + "key": "visibility", + "title": "APP.DOCUMENT_LIST.COLUMNS.STATUS", + "type": "text", + "sortable": true, + "template": "app.columns.libraryStatus", + "desktopOnly": true + } + ], + "shared": [ + { + "id": "app.shared.thumbnail", + "key": "$thumbnail", + "type": "image", + "class": "image-table-cell", + "sortable": false, + "desktopOnly": false + }, + { + "id": "app.shared.name", + "key": "name", + "title": "APP.DOCUMENT_LIST.COLUMNS.NAME", + "type": "text", + "class": "adf-data-table-cell--ellipsis__name", + "sortable": true, + "template": "app.columns.name", + "desktopOnly": false + }, + { + "id": "app.shared.location", + "key": "path.name", + "title": "APP.DOCUMENT_LIST.COLUMNS.LOCATION", + "type": "text", + "sortable": true, + "template": "app.columns.location", + "desktopOnly": true + }, + { + "id": "app.shared.size", + "key": "content.sizeInBytes", + "title": "APP.DOCUMENT_LIST.COLUMNS.SIZE", + "type": "fileSize", + "sortable": true, + "desktopOnly": true + }, + { + "id": "app.shared.modifiedOn", + "key": "modifiedAt", + "title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_ON", + "type": "date", + "format": "timeAgo", + "sortable": true, + "desktopOnly": true + }, + { + "id": "app.shared.modifiedBy", + "key": "modifiedByUser.displayName", + "title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY", + "type": "text", + "class": "adf-data-table-cell--ellipsis", + "sortable": true, + "desktopOnly": true + }, + { + "id": "app.shared.sharedBy", + "key": "sharedByUser.displayName", + "title": "APP.DOCUMENT_LIST.COLUMNS.SHARED_BY", + "type": "text", + "class": "adf-data-table-cell--ellipsis", + "sortable": true, + "desktopOnly": true + } + ], + "recent": [ + { + "id": "app.recent.thumbnail", + "key": "$thumbnail", + "type": "image", + "class": "image-table-cell", + "sortable": false, + "desktopOnly": false + }, + { + "id": "app.recent.name", + "key": "name", + "title": "APP.DOCUMENT_LIST.COLUMNS.NAME", + "type": "text", + "class": "adf-data-table-cell--ellipsis__name", + "sortable": true, + "template": "app.columns.name", + "desktopOnly": false + }, + { + "id": "app.recent.location", + "key": "path.name", + "title": "APP.DOCUMENT_LIST.COLUMNS.LOCATION", + "type": "text", + "sortable": true, + "template": "app.columns.location", + "desktopOnly": true + }, + { + "id": "app.recent.size", + "key": "content.sizeInBytes", + "title": "APP.DOCUMENT_LIST.COLUMNS.SIZE", + "type": "fileSize", + "sortable": true, + "desktopOnly": true + }, + { + "id": "app.recent.modifiedOn", + "key": "modifiedAt", + "title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_ON", + "type": "date", + "format": "timeAgo", + "sortable": true, + "desktopOnly": true + } + ], + "favorites": [ + { + "id": "app.favorites.thumbnail", + "key": "$thumbnail", + "type": "image", + "class": "image-table-cell", + "sortable": false, + "desktopOnly": false + }, + { + "id": "app.favorites.name", + "key": "name", + "title": "APP.DOCUMENT_LIST.COLUMNS.NAME", + "type": "text", + "class": "adf-data-table-cell--ellipsis__name", + "sortable": true, + "template": "app.columns.name", + "desktopOnly": false + }, + { + "id": "app.favorites.location", + "key": "path.name", + "title": "APP.DOCUMENT_LIST.COLUMNS.LOCATION", + "type": "text", + "sortable": true, + "template": "app.columns.location", + "desktopOnly": true + }, + { + "id": "app.favorites.size", + "key": "sizeInBytes", + "title": "APP.DOCUMENT_LIST.COLUMNS.SIZE", + "type": "fileSize", + "sortable": true, + "desktopOnly": true + }, + { + "id": "app.favorites.modifiedOn", + "key": "modifiedAt", + "title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_ON", + "type": "date", + "format": "timeAgo", + "sortable": true, + "desktopOnly": true + }, + { + "id": "app.favorites.modifiedBy", + "key": "modifiedByUser.displayName", + "title": "APP.DOCUMENT_LIST.COLUMNS.MODIFIED_BY", + "type": "text", + "class": "adf-data-table-cell--ellipsis", + "sortable": true, + "desktopOnly": true + } + ], + "trashcan": [ + { + "id": "app.trashcan.thumbnail", + "key": "$thumbnail", + "type": "image", + "class": "image-table-cell", + "sortable": false, + "desktopOnly": false + }, + { + "id": "app.trashcan.name", + "key": "name", + "title": "APP.DOCUMENT_LIST.COLUMNS.NAME", + "type": "text", + "class": "adf-data-table-cell--ellipsis__name", + "sortable": true, + "template": "app.columns.trashcanName", + "desktopOnly": false + }, + { + "id": "app.trashcan.location", + "key": "path.name", + "title": "APP.DOCUMENT_LIST.COLUMNS.LOCATION", + "type": "text", + "sortable": true, + "template": "app.columns.location", + "desktopOnly": true + }, + { + "id": "app.trashcan.size", + "key": "content.sizeInBytes", + "title": "APP.DOCUMENT_LIST.COLUMNS.SIZE", + "type": "fileSize", + "sortable": true, + "desktopOnly": true + }, + { + "id": "app.trashcan.deletedOn", + "key": "archivedAt", + "title": "APP.DOCUMENT_LIST.COLUMNS.DELETED_ON", + "type": "date", + "format": "timeAgo", + "sortable": true, + "desktopOnly": true + } + ] + } + } +} diff --git a/e2e/suites/extensions/ext-document-list.test.ts b/e2e/suites/extensions/ext-document-list.test.ts new file mode 100644 index 000000000..adab8815a --- /dev/null +++ b/e2e/suites/extensions/ext-document-list.test.ts @@ -0,0 +1,113 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { BrowsingPage, LoginPage, LogoutPage } from '../../pages/pages'; +import { RepoClient } from '../../utilities/repo-client/repo-client'; +import { EXTENSIBILITY_CONFIGS, SIDEBAR_LABELS } from '../../configs'; +import { Utils } from '../../utilities/utils'; + +describe('Extensions - DocumentList presets', () => { + const username = `user-${Utils.random()}`; + const file = `file-${Utils.random()}.txt`; + let fileId; + + const testData = [ + { + id: 'app.files.name', + fixtureLabel: 'Name' + }, + { + id: 'app.files.thumbnail', + fixtureLabel: 'Thumbnail' + }, + { + id: 'app.files.size', + fixtureLabel: 'Size', + disabled: true + }, + { + id: 'app.files.modifiedBy', + fixtureLabel: 'Test header' + }, + { + id: 'some.id.createdBy', + fixtureLabel: 'New column' + } + ]; + + const apis = { + admin: new RepoClient(), + user: new RepoClient(username, username) + }; + + const loginPage = new LoginPage(); + const logoutPage = new LogoutPage(); + const personalFilesPage = new BrowsingPage(); + const { dataTable } = personalFilesPage; + + beforeAll(async (done) => { + await apis.admin.people.createUser({ username }); + fileId = (await apis.user.nodes.createFile(file)).entry.id; + + await loginPage.load(); + await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.DOCUMENT_LIST_PRESETS); + await loginPage.loginWith(username); + + done(); + }); + + beforeEach(async done => { + await personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES); + await dataTable.waitForHeader(); + + done(); + }); + + afterAll(async (done) => { + await apis.user.nodes.deleteNodeById(fileId); + await logoutPage.load(); + done(); + }); + + it('Sets the columns to display - [C286700]', async () => { + const labels = testData + .filter(item => !item.disabled) + .map(data => data.fixtureLabel); + const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label)); + + expect(await dataTable.getColumnHeaders().count()).toBe(labels.length, 'Incorrect number of columns'); + + await elements.forEach(async (element, index) => { + expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`); + }); + }); + + it('Disabled items are not shown - [C286699]', async () => { + const noColumnLabel = testData.find(item => item.disabled).fixtureLabel; + const element = dataTable.getColumnHeaderByLabel(noColumnLabel); + + expect(await element.isPresent()).toBe(false, `"${noColumnLabel}" is displayed`); + }); +});