[ACS-5743] Cleanup Content tests (Demo Shell) (#8799)

* remove unused demo shell api

* remove recent files and cleanup unused api

* cleanup upload dialog page

* [ci:force] dummy commit

* [ci:force] cleanup the toolbar and tooltips

* [ci:force] remove dead code

* [ci:force] remove logger and custom action

* [ci:force] remove custom permission e2e test as already tested by unit

* [ci:force] remove "Start process" from the Content demo as not related to document list

* [ci:force] remove useless divs for selection

* [ci:force] dummy change to trigger CI/CD

* Revert "[ci:force] remove useless divs for selection"

This reverts commit fb3ae0b439.

* [ci:force] remove e2e for artificial scenario

* [ci:force] cleanup unused navigation bar protractor api

* [ci:force] cleanup unused datatable protractor api

* [ci:force] cleanup unused login protractor api

* [ci:force] fix process cloud demo page selector
This commit is contained in:
Denys Vuika
2023-08-01 18:48:19 +01:00
committed by GitHub
parent 3f3e83057d
commit 9497abcb43
18 changed files with 42 additions and 814 deletions

View File

@@ -1,33 +1,4 @@
<div class="app-container">
<mat-accordion *ngIf="showRecentFiles" class="app-container-recent">
<mat-expansion-panel hideToggle="true">
<mat-expansion-panel-header>
<mat-panel-title>
{{ 'DOCUMENT_LIST.RECENT.TITLE' | translate }}
<mat-icon>history</mat-icon>
</mat-panel-title>
</mat-expansion-panel-header>
<adf-document-list
[currentFolderId]="'-recent-'"
locationFormat="/files"
[display]="'gallery'"
[preselectNodes]="selectedNodes"
[showHeader]="noHeaderMode"
[maxItems]="5"
(preview)="showFile($event)"
selectionMode="null">
<adf-custom-empty-content-template>
<div class="app-empty-list__block">
<mat-icon>history</mat-icon>
<p class="app-empty-list__title">{{ 'DOCUMENT_LIST.RECENT.EMPTY_STATE.TITLE' | translate}}</p>
</div>
</adf-custom-empty-content-template>
</adf-document-list>
</mat-expansion-panel>
</mat-accordion>
<div *ngIf="showSitePicker" class="app-site-container-style" id="site-container">
<adf-sites-dropdown (change)="onSiteChange($event)" [hideMyFiles]="false" [relations]="'members'">
</adf-sites-dropdown>
@@ -51,7 +22,7 @@
</button>
<span class="app-error-message--text">{{errorMessage}}</span>
</div>
<adf-toolbar *ngIf="!disableDragArea" [color]="toolbarColor" class="app-files-toolbar">
<adf-toolbar *ngIf="!disableDragArea" class="app-files-toolbar">
<adf-toolbar-title>
<adf-breadcrumb
class="app-files-breadcrumb"
@@ -70,14 +41,9 @@
<button
mat-icon-button
data-automation-id="document-list-grid-view"
title="{{ 'DOCUMENT_LIST.TOOLBAR.CARDVIEW' | translate }}"
title="{{ 'DOCUMENT_LIST.TOOLBAR.TOGGLE_DISPLAY_MODE' | translate }}"
(click)="toggleGalleryView()">
<mat-icon *ngIf="displayMode === 'list'"
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.CARDVIEW' | translate }}">view_comfy
</mat-icon>
<mat-icon *ngIf="displayMode === 'gallery'"
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.LISTVIEW' | translate }}">list
</mat-icon>
<mat-icon>list</mat-icon>
</button>
<button
data-automation-id="create-new-folder"
@@ -86,13 +52,12 @@
title="{{ 'DOCUMENT_LIST.TOOLBAR.NEW_FOLDER' | translate }}"
(error)="openSnackMessageError($event)"
(success)="documentList.reload()"
[adf-create-folder]="currentFolderId"
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.NEW_FOLDER' | translate }}">
[adf-create-folder]="currentFolderId">
<mat-icon>create_new_folder</mat-icon>
</button>
<button
mat-icon-button
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.CREATE_LIBRARY' | translate }}"
title="{{ 'DOCUMENT_LIST.TOOLBAR.CREATE_LIBRARY' | translate }}"
data-automation-id="create-new-library"
(click)="createLibrary()">
<mat-icon>library_add</mat-icon>
@@ -104,15 +69,13 @@
title="{{ 'DOCUMENT_LIST.TOOLBAR.EDIT_FOLDER' | translate }}"
(error)="openSnackMessageError($event)"
[adf-edit-folder]="documentList.selection[0]?.entry"
(success)="documentList.reload()"
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.EDIT_FOLDER' | translate }}">
(success)="documentList.reload()">
<mat-icon>create</mat-icon>
</button>
<button mat-icon-button
[disabled]="!hasSelection(documentList.selection)"
title="{{ 'DOCUMENT_LIST.TOOLBAR.DOWNLOAD' | translate }}"
[adfNodeDownload]="documentList.selection"
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.DOWNLOAD' | translate }}">
[adfNodeDownload]="documentList.selection">
<mat-icon>get_app</mat-icon>
</button>
<button mat-icon-button
@@ -122,8 +85,7 @@
[adf-nodes]="documentList.selection"
title="{{ 'DOCUMENT_LIST.TOOLBAR.DELETE' | translate }}"
(delete)="onDeleteActionSuccess($event)"
[adf-delete]="documentList.selection"
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.DELETE' | translate }}">
[adf-delete]="documentList.selection">
<mat-icon>delete</mat-icon>
</button>
<button
@@ -132,17 +94,15 @@
[disabled]="!documentList.selection.length"
#favorite="adfFavorite"
[adf-node-favorite]="documentList.selection"
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.FAVORITES' | translate }}">
<mat-icon>
{{ favorite.hasFavorites() ? 'star' :'star_border' }}
</mat-icon>
title="{{ 'DOCUMENT_LIST.TOOLBAR.FAVORITES' | translate }}">
<mat-icon>{{ favorite.hasFavorites() ? 'star' :'star_border' }}</mat-icon>
</button>
<button mat-icon-button
[disabled]="documentList.selection.length && !shareRef.isFile"
[baseShareUrl]="baseShareUrl"
#shareRef="adfShare"
[adf-share]="documentList.selection[0]"
[matTooltip]="(shareRef.isShared
[title]="(shareRef.isShared
? 'DOCUMENT_LIST.TOOLBAR.SHARE_EDIT'
: 'DOCUMENT_LIST.TOOLBAR.SHARE') | translate">
<mat-icon>
@@ -151,25 +111,9 @@
</button>
</div>
<button mat-icon-button [matMenuTriggerFor]="themePicker"
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.THEME' | translate }}">
<mat-icon>format_color_fill</mat-icon>
</button>
<mat-menu #themePicker="matMenu">
<button mat-menu-item (click)="toolbarColor = null">Default</button>
<button mat-menu-item (click)="toolbarColor = 'primary'">Primary</button>
<button mat-menu-item (click)="toolbarColor = 'accent'">Accent</button>
<button mat-menu-item (click)="toolbarColor = 'warn'">Warn</button>
</mat-menu>
<button mat-icon-button (click)="showVersions = !showVersions" class="app-show-versions-button">
<mat-icon *ngIf="!showVersions" matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.SHOW_VERSION' | translate }}">
chevron_left
</mat-icon>
<mat-icon *ngIf="showVersions" matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.HIDE_VERSION' | translate }}">
chevron_right
</mat-icon>
<button mat-icon-button (click)="showVersions = !showVersions" class="app-show-versions-button"
title="{{ 'DOCUMENT_LIST.TOOLBAR.TOGGLE_METADATA' | translate }}">
<mat-icon>{{ showVersions ? 'chevron_right' : 'chevron_left' }}</mat-icon>
</button>
<adf-toolbar-divider class="app-toolbar-divider-before-more-menu"></adf-toolbar-divider>
@@ -178,8 +122,7 @@
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item
(click)="toggleGalleryView()">
<button mat-menu-item (click)="toggleGalleryView()">
<mat-icon *ngIf="displayMode === 'list'">view_comfy</mat-icon>
<mat-icon *ngIf="displayMode === 'gallery'">list</mat-icon>
<span>{{ 'DOCUMENT_LIST.TOOLBAR.CARDVIEW' | translate }}</span>
@@ -243,9 +186,6 @@
(name-click)="documentList.onNodeDblClick($any($event).detail?.node)"
(filterSelection)="onFilterSelected($event)">
<adf-custom-no-permission-template *ngIf="enableCustomPermissionMessage">
<h1>You don't have permissions</h1>
</adf-custom-no-permission-template>
<adf-custom-empty-content-template *ngIf="disableDragArea">
<div class="app-empty_template">
<div class="app-no-result-message">{{ 'SEARCH.NO_RESULT' | translate }}</div>
@@ -278,15 +218,6 @@
[formatTooltip]="getNodeNameTooltip"
class="app-ellipsis-cell adf-expand-cell-5">
</data-column>
<!-- Location column demo -->
<!--
<data-column
key="path"
type="location"
format="/files"
title="Location">
</data-column>
-->
<data-column
key="content.sizeInBytes"
title="{{'DOCUMENT_LIST.COLUMNS.SIZE' | translate}}"
@@ -304,17 +235,7 @@
</div>
</ng-template>
</data-column>
<!-- Notes: has performance overhead due to multiple files/folders causing separate HTTP calls to get tags -->
<!--
<data-column
title="{{'DOCUMENT_LIST.COLUMNS.TAG' | translate}}"
key="id"
class="app-full-width adf-ellipsis-cell">
<ng-template let-entry="$implicit">
<alfresco-tag-node-list [nodeId]="entry.data.getValue(entry.row, entry.col)"></alfresco-tag-node-list>
</ng-template>
</data-column>
-->
<data-column
class="app-full-width adf-ellipsis-cell adf-desktop-only"
title="{{'DOCUMENT_LIST.COLUMNS.NODE_ID' | translate}}"
@@ -353,26 +274,6 @@
</data-columns>
<content-actions>
<!-- Conditional actions demo -->
<content-action
target="all"
title="Action for 'custom' node"
[disabled]="isCustomActionDisabled"
(execute)="runCustomAction($event)">
</content-action>
<content-action
icon="get_app"
title="Download this file now!"
handler="download"
[visible]="canDownloadNode">
</content-action>
<content-action
icon="get_app"
title="Never see this action again"
handler="download"
[visible]="false">
</content-action>
<!-- common actions -->
<content-action
icon="get_app"
title="DOCUMENT_LIST.ACTIONS.DOWNLOAD"
@@ -424,13 +325,6 @@
title="DOCUMENT_LIST.ACTIONS.VERSIONS"
(execute)="onManageVersions($event)">
</content-action>
<content-action
target="document"
*ngIf="authenticationService.isBpmLoggedIn()"
icon="play_arrow"
title="DOCUMENT_LIST.ACTIONS.DOCUMENT.PROCESS_ACTION"
(execute)="startProcessAction($event)">
</content-action>
<content-action
target="document"
icon="lock"
@@ -504,15 +398,6 @@
</div>
</div>
<div *ngIf="processId">
<adf-start-process
[values]="formValues"
[appId]="processId"
(start)="closeStartProcess()"
(cancel)="closeStartProcess()">
</adf-start-process>
</div>
<div *ngIf="showSettingsPanel" class="app-content-service-settings">
<p>Current folder ID: {{ documentList.currentFolderId }}</p>
@@ -546,7 +431,7 @@
</section>
<section>
<mat-slide-toggle id="adf-multiple-upload-switch" [color]="'primary'" (change)="onMultipleFilesUpload()" [(ngModel)]="multipleFileUpload" >
<mat-slide-toggle id="adf-multiple-upload-switch" [color]="'primary'" [(ngModel)]="multipleFileUpload" >
{{'DOCUMENT_LIST.MULTIPLE_FILE_UPLOAD' | translate}}
</mat-slide-toggle>
</section>
@@ -613,12 +498,6 @@
</mat-slide-toggle>
</section>
<section>
<mat-slide-toggle color="primary" [(ngModel)]="enableCustomPermissionMessage">
{{'APP.CUSTOM-PERMISSION-MESSAGE' | translate}}
</mat-slide-toggle>
</section>
<section>
<mat-slide-toggle color="primary" [(ngModel)]="enableMediumTimeFormat" id="enableMediumTimeFormat">
{{'APP.MEDIUM-TIME-FORMAT' | translate}}
@@ -639,21 +518,6 @@
</mat-slide-toggle>
</section>
<section>
<mat-slide-toggle
color="primary" [(ngModel)]="preselectNodes" id="preselectNodes">
Preselect Nodes
</mat-slide-toggle>
</section>
<form class="example-form">
<mat-form-field *ngIf="preselectNodes" class="adf-preselect-nodes-input">
<input matInput
(input)="setPreselectNodes($any($event).target?.value)"
placeholder="NodeEntry[] => [{ entry: { isFile: true, id: 'node-id' }}, { entry: { isFile: true, id: 'node-id' }} ]">
</mat-form-field>
</form>
<section>
<mat-slide-toggle
color="primary" [(ngModel)]="enableDownloadPrompt" id="enableDownloadPrompt" (change)="onEnableDownloadPrompt()">

View File

@@ -103,22 +103,3 @@
line-height: 1.33;
letter-spacing: -1px;
}
.app-container-recent {
mat-icon {
margin-left: 20px;
}
.app-empty-list__block {
height: 100%;
padding: 0;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
}
}
.adf-preselect-nodes-input {
width: 100%;
}

View File

@@ -37,20 +37,15 @@ import {
Pagination,
MinimalNodeEntryEntity,
SiteEntry,
SearchEntry,
NodeEntry
SearchEntry
} from '@alfresco/js-api';
import {
AlfrescoApiService,
AuthenticationService,
AppConfigService,
AppConfigValues,
LogService,
NotificationService,
DataRow,
UserPreferencesService,
PaginationComponent,
FormValues,
DisplayMode,
ShowHeaderMode,
InfinitePaginationComponent,
@@ -73,15 +68,12 @@ import {
NodesApiService,
SharedLinksApiService
} from '@alfresco/adf-content-services';
import { SelectAppsDialogComponent, ProcessFormRenderingService } from '@alfresco/adf-process-services';
import { ProcessFormRenderingService } from '@alfresco/adf-process-services';
import { VersionManagerDialogAdapterComponent } from './version-manager-dialog-adapter.component';
import { MetadataDialogAdapterComponent } from './metadata-dialog-adapter.component';
import { Subject } from 'rxjs';
import { PreviewService } from '../../services/preview.service';
import { takeUntil, debounceTime, scan } from 'rxjs/operators';
import { ThemePalette } from '@angular/material/core';
const DEFAULT_FOLDER_TO_SHOW = '-my-';
@@ -110,8 +102,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
this.appConfig.get<string>(AppConfigValues.BASESHAREURL) ||
this.appConfig.get<string>(AppConfigValues.ECMHOST)) + '/preview/s/';
toolbarColor: ThemePalette;
selectionModes = [
{value: 'none', viewValue: 'None'},
{value: 'single', viewValue: 'Single'},
@@ -122,10 +112,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
@Input()
currentFolderId: string = DEFAULT_FOLDER_TO_SHOW;
formValues: FormValues = {};
processId;
@Input()
sorting = ['name', 'ASC'];
@@ -240,18 +226,13 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
permissionsStyle: PermissionStyleModel[] = [];
infiniteScrolling: boolean;
stickyHeader: boolean;
preselectNodes: boolean;
warnOnMultipleUploads = false;
thumbnails = false;
noHeaderMode = ShowHeaderMode.Never;
enableCustomPermissionMessage = false;
enableMediumTimeFormat = false;
displayEmptyMetadata = false;
hyperlinkNavigation = false;
selectedNodes = [];
enableDownloadPrompt: boolean = this.appConfig.get('viewer.enableDownloadPrompt', false);
enableDownloadPrompt = this.appConfig.get<boolean>('viewer.enableDownloadPrompt', false);
enableDownloadPromptReminder: boolean = this.appConfig.get('viewer.enableDownloadPromptReminders', false);
downloadPromptDelay = this.appConfig.get('viewer.downloadPromptDelay', 50);
downloadPromptReminderDelay = this.appConfig.get('viewer.downloadPromptReminderDelay', 30);
@@ -264,13 +245,10 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
private dialog: MatDialog,
private location: Location,
private router: Router,
private logService: LogService,
private appConfig: AppConfigService,
private preference: UserPreferencesService,
private preview: PreviewService,
@Optional() private route: ActivatedRoute,
public authenticationService: AuthenticationService,
public alfrescoApiService: AlfrescoApiService,
private contentMetadataService: ContentMetadataService,
private sharedLinksApiService: SharedLinksApiService,
private dialogAspectListService: DialogAspectListService,
@@ -284,12 +262,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}
}
toggleFolder() {
this.multipleFileUpload = false;
this.folderUpload = !this.folderUpload;
return this.folderUpload;
}
toggleThumbnails() {
this.thumbnails = !this.thumbnails;
this.documentList.reload();
@@ -327,19 +299,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
takeUntil(this.onDestroy$)
)
.subscribe((value: any[]) => {
let selectedNodes: NodeEntry[] = [];
if (this.preselectNodes) {
if (value && value.length > 0) {
if (this.selectionMode === 'single') {
selectedNodes = [...[value[value.length - 1]].map((uploadedFile) => uploadedFile.data)];
} else {
selectedNodes = [...value.map((uploadedFile) => uploadedFile.data)];
}
this.selectedNodes = [...selectedNodes];
}
}
this.onFileUploadEvent(value[0]);
});
@@ -421,15 +380,12 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}
onFolderCreated(event: FolderCreatedEvent) {
this.logService.log('FOLDER CREATED');
this.logService.log(event);
if (event && event.parentId === this.documentList.currentFolderId) {
this.documentList.reload();
}
}
onFolderAction(node) {
this.logService.log(node);
if (node && node.parentId === this.documentList.currentFolderId) {
this.documentList.reload();
}
@@ -459,10 +415,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
this.documentListReady.emit(event);
}
pageIsEmpty(node: NodePaging) {
return node && node.list && node.list.entries.length === 0;
}
onContentActionError(errors: any) {
const errorStatusCode = JSON.parse(errors.message).error.statusCode;
let message: string;
@@ -582,24 +534,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
return false;
}
startProcessAction($event: any) {
this.formValues['file'] = $event.value.entry;
const dialogRef = this.dialog.open(SelectAppsDialogComponent, {
width: '630px',
panelClass: 'adf-version-manager-dialog'
});
dialogRef.afterClosed().subscribe((selectedProcess) => {
this.processId = selectedProcess.id;
});
}
closeStartProcess() {
this.processId = null;
}
onChangePageSize(event: Pagination): void {
this.preference.paginationSize = event.maxItems;
this.pagination.maxItems = event.maxItems;
@@ -619,12 +553,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
this.turnedNextPage.emit(event);
}
loadNextBatch(event: Pagination): void {
this.pagination.maxItems = event.maxItems;
this.pagination.skipCount = event.skipCount;
this.loadNext.emit(event);
}
onPrevPage(event: Pagination): void {
this.pagination.maxItems = event.maxItems;
this.pagination.skipCount = event.skipCount;
@@ -646,10 +574,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
this.infinitePaginationComponent.reset();
}
canDownloadNode(node: MinimalNodeEntity): boolean {
return node && node.entry && node.entry.name === 'custom';
}
onBeginUpload(event: UploadFilesEvent) {
if (this.warnOnMultipleUploads && event) {
const files = event.files || [];
@@ -673,14 +597,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}
}
isCustomActionDisabled(node: MinimalNodeEntity): boolean {
return !(node && node.entry && node.entry.name === 'custom');
}
runCustomAction(event: any) {
this.logService.log(event);
}
onUploadNewVersion(ev) {
const contentEntry = ev.detail.data.node.entry;
const showComments = this.showVersionComments;
@@ -758,32 +674,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
this.documentList.reload();
}
setPreselectNodes(nodes: string) {
this.selectedNodes = this.getArrayFromString(nodes);
this.documentList.reload();
}
isStringArray(str: string): boolean {
try {
const result = JSON.parse(str);
return Array.isArray(result);
} catch (e) {
return false;
}
}
private getArrayFromString<T = any>(value: string): T[] {
if (this.isStringArray(value)) {
return JSON.parse(value);
} else {
return [];
}
}
onMultipleFilesUpload() {
this.selectedNodes = [];
}
onEnableDownloadPrompt() {
const previewConfig = this.appConfig?.config['viewer'];
previewConfig['enableDownloadPrompt'] = this.enableDownloadPrompt;
@@ -813,5 +703,4 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
const previewConfig = this.appConfig?.config['viewer'];
previewConfig['fileAutoDownloadSizeThresholdInMB'] = this.fileAutoDownloadSizeThresholdInMB;
}
}