mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-9249] Add number of files to Folder Information (#4626)
* [ACS-9249] Add number of files to Folder Information * [ACS-9249] cr fix * [ACS-9249] fix e2e's
This commit is contained in:
committed by
GitHub
parent
e110b73613
commit
29212b3cb3
@@ -126,6 +126,7 @@ test.describe('Actions - Folder Information', () => {
|
|||||||
async function checkFolderInformation(
|
async function checkFolderInformation(
|
||||||
page: PersonalFilesPage | MyLibrariesPage | SearchPage,
|
page: PersonalFilesPage | MyLibrariesPage | SearchPage,
|
||||||
folderName: string,
|
folderName: string,
|
||||||
|
expectedNumber: string,
|
||||||
expectedSize: string,
|
expectedSize: string,
|
||||||
location: string,
|
location: string,
|
||||||
isEmptyFolder?: 'isEmpty'
|
isEmptyFolder?: 'isEmpty'
|
||||||
@@ -134,6 +135,7 @@ test.describe('Actions - Folder Information', () => {
|
|||||||
await page.acaHeader.clickMoreActions();
|
await page.acaHeader.clickMoreActions();
|
||||||
await page.matMenu.clickMenuItem('Folder Information');
|
await page.matMenu.clickMenuItem('Folder Information');
|
||||||
await expect(async () => {
|
await expect(async () => {
|
||||||
|
expect(await page.folderInformationDialog.folderNumberOfFiles.textContent()).toContain(expectedNumber);
|
||||||
expect(await page.folderInformationDialog.folderSize.textContent()).toContain(expectedSize);
|
expect(await page.folderInformationDialog.folderSize.textContent()).toContain(expectedSize);
|
||||||
}).toPass({
|
}).toPass({
|
||||||
intervals: [1_000],
|
intervals: [1_000],
|
||||||
@@ -151,34 +153,46 @@ test.describe('Actions - Folder Information', () => {
|
|||||||
|
|
||||||
test('[XAT-17722] Folder information Empty folder size and number of documents as 0', async ({ personalFiles }) => {
|
test('[XAT-17722] Folder information Empty folder size and number of documents as 0', async ({ personalFiles }) => {
|
||||||
await personalFiles.navigate();
|
await personalFiles.navigate();
|
||||||
await checkFolderInformation(personalFiles, emptyFolder, '0 bytes for 0 files', `/Company Home/User Homes/${username}`, 'isEmpty');
|
await checkFolderInformation(personalFiles, emptyFolder, '0', '0 bytes', `/Company Home/User Homes/${username}`, 'isEmpty');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('[XAT-17715] Folder information correct folder size and number of documents - single file', async ({ personalFiles }) => {
|
test('[XAT-17715] Folder information correct folder size and number of documents - single file', async ({ personalFiles }) => {
|
||||||
await personalFiles.navigate();
|
await personalFiles.navigate();
|
||||||
await checkFolderInformation(personalFiles, folder1File, 'for 1 files', `/Company Home/User Homes/${username}`);
|
await checkFolderInformation(personalFiles, folder1File, '1', '13,877 bytes (13.88 KB on disk)', `/Company Home/User Homes/${username}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('[XAT-17752] Folder information correct folder size and number of documents - multiple files', async ({ personalFiles }) => {
|
test('[XAT-17752] Folder information correct folder size and number of documents - multiple files', async ({ personalFiles }) => {
|
||||||
await personalFiles.navigate();
|
await personalFiles.navigate();
|
||||||
await checkFolderInformation(personalFiles, folderXFiles, 'for 3 files', `/Company Home/User Homes/${username}`);
|
await checkFolderInformation(personalFiles, folderXFiles, '3', '41,631 bytes (41.63 KB on disk)', `/Company Home/User Homes/${username}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('[XAT-17753] Folder information correct folder size and number of documents - folder and files', async ({ personalFiles }) => {
|
test('[XAT-17753] Folder information correct folder size and number of documents - folder and files', async ({ personalFiles }) => {
|
||||||
await personalFiles.navigate();
|
await personalFiles.navigate();
|
||||||
await checkFolderInformation(personalFiles, folderXFilesAndFolders, 'for 5 files', `/Company Home/User Homes/${username}`);
|
await checkFolderInformation(
|
||||||
|
personalFiles,
|
||||||
|
folderXFilesAndFolders,
|
||||||
|
'5',
|
||||||
|
'69,385 bytes (69.39 KB on disk)',
|
||||||
|
`/Company Home/User Homes/${username}`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('[XAT-17758] Folder information correct folder size and number of documents - from libraries', async ({ myLibrariesPage }) => {
|
test('[XAT-17758] Folder information correct folder size and number of documents - from libraries', async ({ myLibrariesPage }) => {
|
||||||
await myLibrariesPage.navigate();
|
await myLibrariesPage.navigate();
|
||||||
await myLibrariesPage.dataTable.getRowByName(libraryForFolder).dblclick();
|
await myLibrariesPage.dataTable.getRowByName(libraryForFolder).dblclick();
|
||||||
await checkFolderInformation(myLibrariesPage, folderInLibrary, 'for 1 files', `/Company Home/Sites/${libraryForFolder}/documentLibrary`);
|
await checkFolderInformation(
|
||||||
|
myLibrariesPage,
|
||||||
|
folderInLibrary,
|
||||||
|
'1',
|
||||||
|
'13,877 bytes (13.88 KB on disk)',
|
||||||
|
`/Company Home/Sites/${libraryForFolder}/documentLibrary`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('[XAT-17759] Folder information correct folder size and number of documents - from search', async ({ personalFiles, searchPage }) => {
|
test('[XAT-17759] Folder information correct folder size and number of documents - from search', async ({ personalFiles, searchPage }) => {
|
||||||
await personalFiles.navigate();
|
await personalFiles.navigate();
|
||||||
await searchPage.searchWithin(folderForSearch, 'folders');
|
await searchPage.searchWithin(folderForSearch, 'folders');
|
||||||
await checkFolderInformation(searchPage, folderForSearch, 'for 2 files', `/Company Home/User Homes/${username}`);
|
await checkFolderInformation(searchPage, folderForSearch, '2', '27,754 bytes (27.75 KB on disk)', `/Company Home/User Homes/${username}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('[XAT-17766] Folder information correct folder size and number of documents - nested folders', async ({ personalFiles }) => {
|
test('[XAT-17766] Folder information correct folder size and number of documents - nested folders', async ({ personalFiles }) => {
|
||||||
@@ -188,7 +202,8 @@ test.describe('Actions - Folder Information', () => {
|
|||||||
await checkFolderInformation(
|
await checkFolderInformation(
|
||||||
personalFiles,
|
personalFiles,
|
||||||
folderNested3,
|
folderNested3,
|
||||||
'for 1 files',
|
'1',
|
||||||
|
'13,877 bytes (13.88 KB on disk)',
|
||||||
`/Company Home/User Homes/${username}/${folderNested1}/${folderNested2}`
|
`/Company Home/User Homes/${username}/${folderNested1}/${folderNested2}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -467,9 +467,10 @@
|
|||||||
"ICON": "Folder Icon",
|
"ICON": "Folder Icon",
|
||||||
"TITLE": "Folder Information",
|
"TITLE": "Folder Information",
|
||||||
"SIZE" : "Size",
|
"SIZE" : "Size",
|
||||||
|
"NUMBER_OF_FILES": "Number of files",
|
||||||
"CALCULATING": "Calculating...",
|
"CALCULATING": "Calculating...",
|
||||||
"CALCULATED_SIZE_LARGE": "{{sizeInBytes}} bytes ({{sizeInLargeUnit}} {{unit}} on disk) for {{count}} files",
|
"CALCULATED_SIZE_LARGE": "{{sizeInBytes}} bytes ({{sizeInLargeUnit}} {{unit}} on disk)",
|
||||||
"CALCULATED_SIZE_NORMAL": "{{sizeInBytes}} bytes for {{count}} files",
|
"CALCULATED_SIZE_NORMAL": "{{sizeInBytes}} bytes",
|
||||||
"LOCATION": "Location",
|
"LOCATION": "Location",
|
||||||
"CREATED": "Created",
|
"CREATED": "Created",
|
||||||
"MODIFIED": "Modified",
|
"MODIFIED": "Modified",
|
||||||
|
@@ -4,6 +4,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<mat-divider/>
|
<mat-divider/>
|
||||||
<div class="aca-folder-info-body">
|
<div class="aca-folder-info-body">
|
||||||
|
<div class="aca-folder-info-item">
|
||||||
|
<div class="aca-folder-info-item-label">{{ 'APP.FOLDER_INFO.NUMBER_OF_FILES' | translate }}</div>
|
||||||
|
<div class="aca-folder-info-item-value"
|
||||||
|
data-automation-id="folder-info-number-of-files">{{ folderDetails.numberOfFiles }}</div>
|
||||||
|
</div>
|
||||||
|
<mat-divider/>
|
||||||
<div class="aca-folder-info-item">
|
<div class="aca-folder-info-item">
|
||||||
<div class="aca-folder-info-item-label">{{ 'APP.FOLDER_INFO.SIZE' | translate }}</div>
|
<div class="aca-folder-info-item-label">{{ 'APP.FOLDER_INFO.SIZE' | translate }}</div>
|
||||||
<div class="aca-folder-info-item-value"
|
<div class="aca-folder-info-item-value"
|
||||||
|
@@ -37,6 +37,8 @@ describe('FolderInformationComponent', () => {
|
|||||||
let initiateFolderSizeCalculationSpy: jasmine.Spy<(nodeId: string) => Observable<JobIdBodyEntry>>;
|
let initiateFolderSizeCalculationSpy: jasmine.Spy<(nodeId: string) => Observable<JobIdBodyEntry>>;
|
||||||
let getFolderSizeInfoSpy: jasmine.Spy<(nodeId: string, jobId: string) => Observable<SizeDetailsEntry>>;
|
let getFolderSizeInfoSpy: jasmine.Spy<(nodeId: string, jobId: string) => Observable<SizeDetailsEntry>>;
|
||||||
|
|
||||||
|
const getNumberOfFiles = (): string => unitTestingUtils.getInnerTextByDataAutomationId('folder-info-number-of-files');
|
||||||
|
|
||||||
const mockSub = new Subject<JobIdBodyEntry>();
|
const mockSub = new Subject<JobIdBodyEntry>();
|
||||||
const dialogData = {
|
const dialogData = {
|
||||||
name: 'mock-folder',
|
name: 'mock-folder',
|
||||||
@@ -77,6 +79,7 @@ describe('FolderInformationComponent', () => {
|
|||||||
it('should render all information in init', () => {
|
it('should render all information in init', () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(unitTestingUtils.getInnerTextByDataAutomationId('folder-info-name')).toBe('mock-folder');
|
expect(unitTestingUtils.getInnerTextByDataAutomationId('folder-info-name')).toBe('mock-folder');
|
||||||
|
expect(getNumberOfFiles()).toBe('APP.FOLDER_INFO.CALCULATING');
|
||||||
expect(unitTestingUtils.getInnerTextByDataAutomationId('folder-info-size')).toBe('APP.FOLDER_INFO.CALCULATING');
|
expect(unitTestingUtils.getInnerTextByDataAutomationId('folder-info-size')).toBe('APP.FOLDER_INFO.CALCULATING');
|
||||||
expect(unitTestingUtils.getInnerTextByDataAutomationId('folder-info-location')).toBe('mock-folder-path');
|
expect(unitTestingUtils.getInnerTextByDataAutomationId('folder-info-location')).toBe('mock-folder-path');
|
||||||
expect(unitTestingUtils.getInnerTextByDataAutomationId('folder-info-creation-date')).toBe('01/02/2024 11:11');
|
expect(unitTestingUtils.getInnerTextByDataAutomationId('folder-info-creation-date')).toBe('01/02/2024 11:11');
|
||||||
@@ -115,6 +118,7 @@ describe('FolderInformationComponent', () => {
|
|||||||
expect(getFolderSizeInfoSpy).toHaveBeenCalledTimes(4);
|
expect(getFolderSizeInfoSpy).toHaveBeenCalledTimes(4);
|
||||||
tick(5000);
|
tick(5000);
|
||||||
expect(getFolderSizeInfoSpy).not.toHaveBeenCalledTimes(5);
|
expect(getFolderSizeInfoSpy).not.toHaveBeenCalledTimes(5);
|
||||||
|
expect(fixture.componentInstance.folderDetails.numberOfFiles).toBe(1);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should not make new API request, and display error message if response returned from API is neither COMPLETE, nor IN_PROGRESS', fakeAsync(() => {
|
it('should not make new API request, and display error message if response returned from API is neither COMPLETE, nor IN_PROGRESS', fakeAsync(() => {
|
||||||
@@ -125,6 +129,8 @@ describe('FolderInformationComponent', () => {
|
|||||||
tick(1000);
|
tick(1000);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(getFolderSizeInfoSpy).toHaveBeenCalledTimes(1);
|
expect(getFolderSizeInfoSpy).toHaveBeenCalledTimes(1);
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(getNumberOfFiles()).toBe('APP.FOLDER_INFO.ERROR');
|
||||||
expect(unitTestingUtils.getInnerTextByDataAutomationId('folder-info-size')).toBe('APP.FOLDER_INFO.ERROR');
|
expect(unitTestingUtils.getInnerTextByDataAutomationId('folder-info-size')).toBe('APP.FOLDER_INFO.ERROR');
|
||||||
tick(5000);
|
tick(5000);
|
||||||
expect(getFolderSizeInfoSpy).not.toHaveBeenCalledTimes(2);
|
expect(getFolderSizeInfoSpy).not.toHaveBeenCalledTimes(2);
|
||||||
|
@@ -42,6 +42,7 @@ class FolderDetails {
|
|||||||
created: Date;
|
created: Date;
|
||||||
modified: Date;
|
modified: Date;
|
||||||
icon: string;
|
icon: string;
|
||||||
|
numberOfFiles: string | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -70,6 +71,7 @@ export class FolderInformationComponent implements OnInit {
|
|||||||
this.folderDetails.modified = this.data.modifiedAt;
|
this.folderDetails.modified = this.data.modifiedAt;
|
||||||
this.folderDetails.icon = this.contentService.getNodeIcon(this.data);
|
this.folderDetails.icon = this.contentService.getNodeIcon(this.data);
|
||||||
this.folderDetails.size = this.translateService.instant('APP.FOLDER_INFO.CALCULATING');
|
this.folderDetails.size = this.translateService.instant('APP.FOLDER_INFO.CALCULATING');
|
||||||
|
this.folderDetails.numberOfFiles = this.translateService.instant('APP.FOLDER_INFO.CALCULATING');
|
||||||
|
|
||||||
this.nodesService
|
this.nodesService
|
||||||
.initiateFolderSizeCalculation(this.data.id)
|
.initiateFolderSizeCalculation(this.data.id)
|
||||||
@@ -91,6 +93,7 @@ export class FolderInformationComponent implements OnInit {
|
|||||||
}),
|
}),
|
||||||
takeUntilDestroyed(this.destroyRef),
|
takeUntilDestroyed(this.destroyRef),
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
|
this.folderDetails.numberOfFiles = this.translateService.instant('APP.FOLDER_INFO.ERROR');
|
||||||
this.folderDetails.size = this.translateService.instant('APP.FOLDER_INFO.ERROR');
|
this.folderDetails.size = this.translateService.instant('APP.FOLDER_INFO.ERROR');
|
||||||
return of(null);
|
return of(null);
|
||||||
})
|
})
|
||||||
@@ -108,15 +111,16 @@ export class FolderInformationComponent implements OnInit {
|
|||||||
const params = {
|
const params = {
|
||||||
sizeInBytes: parseFloat(folderInfo.entry.sizeInBytes).toLocaleString('en'),
|
sizeInBytes: parseFloat(folderInfo.entry.sizeInBytes).toLocaleString('en'),
|
||||||
sizeInLargeUnit: size.toFixed(2),
|
sizeInLargeUnit: size.toFixed(2),
|
||||||
unit: MEMORY_UNIT_LIST[unitIndex],
|
unit: MEMORY_UNIT_LIST[unitIndex]
|
||||||
count: folderInfo.entry.numberOfFiles
|
|
||||||
};
|
};
|
||||||
this.folderDetails.size = this.translateService.instant(
|
this.folderDetails.size = this.translateService.instant(
|
||||||
isMoreThanBytes ? 'APP.FOLDER_INFO.CALCULATED_SIZE_LARGE' : 'APP.FOLDER_INFO.CALCULATED_SIZE_NORMAL',
|
isMoreThanBytes ? 'APP.FOLDER_INFO.CALCULATED_SIZE_LARGE' : 'APP.FOLDER_INFO.CALCULATED_SIZE_NORMAL',
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
|
this.folderDetails.numberOfFiles = folderInfo.entry.numberOfFiles;
|
||||||
} else if (folderInfo?.entry?.status !== SizeDetails.StatusEnum.IN_PROGRESS) {
|
} else if (folderInfo?.entry?.status !== SizeDetails.StatusEnum.IN_PROGRESS) {
|
||||||
this.folderDetails.size = this.translateService.instant('APP.FOLDER_INFO.ERROR');
|
this.folderDetails.size = this.translateService.instant('APP.FOLDER_INFO.ERROR');
|
||||||
|
this.folderDetails.numberOfFiles = this.translateService.instant('APP.FOLDER_INFO.ERROR');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ export class FolderInformationDialogComponent extends BaseComponent {
|
|||||||
|
|
||||||
folderName = this.getChild('.aca-folder-info-header');
|
folderName = this.getChild('.aca-folder-info-header');
|
||||||
doneButton = this.getChild('[data-automation-id="adf-dialog-actions-confirm"]');
|
doneButton = this.getChild('[data-automation-id="adf-dialog-actions-confirm"]');
|
||||||
|
folderNumberOfFiles = this.getChild('[data-automation-id="folder-info-number-of-files"]');
|
||||||
folderSize = this.getChild('[data-automation-id="folder-info-size"]');
|
folderSize = this.getChild('[data-automation-id="folder-info-size"]');
|
||||||
folderLocation = this.getChild('[data-automation-id="folder-info-location"]');
|
folderLocation = this.getChild('[data-automation-id="folder-info-location"]');
|
||||||
folderCreationDate = this.getChild('[data-automation-id="folder-info-creation-date"]');
|
folderCreationDate = this.getChild('[data-automation-id="folder-info-creation-date"]');
|
||||||
|
Reference in New Issue
Block a user