mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[MNT-22418] - disabling action for physical records (#7057)
This commit is contained in:
@@ -26,21 +26,21 @@
|
||||
[src]="file.content ? getIcon(file.content.mimeType) : getIcon(file.mimeType)" [alt]="mimeTypeIcon"
|
||||
role="button" tabindex="0" />
|
||||
<span matLine id="{{'file-'+file?.id}}" role="button" tabindex="0" class="adf-file" (click)="onRowClicked(file)">{{file.name}}</span>
|
||||
<button id="{{'file-'+file?.id+'-option-menu'}}" mat-icon-button [matMenuTriggerFor]="fileActionMenu">
|
||||
<button id="{{'file-'+file?.id+'-option-menu'}}" mat-icon-button [matMenuTriggerFor]="fileActionMenu" *ngIf="!!file.content?.mimeType">
|
||||
<mat-icon>more_vert</mat-icon>
|
||||
</button>
|
||||
<mat-menu #fileActionMenu="matMenu" xPosition="before">
|
||||
<button *ngIf="displayMenuOption('show')" id="{{'file-'+file?.id+'-show-file'}}"
|
||||
<button *ngIf="displayMenuOption('show') && !!file.content?.mimeType" id="{{'file-'+file?.id+'-show-file'}}"
|
||||
mat-menu-item (click)="onAttachFileClicked(file)">
|
||||
<mat-icon>visibility</mat-icon>
|
||||
<span>{{ 'FORM.FIELD.VIEW_FILE' | translate }}</span>
|
||||
</button>
|
||||
<button *ngIf="displayMenuOption('download')" id="{{'file-'+file?.id+'-download-file'}}"
|
||||
<button *ngIf="displayMenuOption('download') && !!file.content?.mimeType" id="{{'file-'+file?.id+'-download-file'}}"
|
||||
mat-menu-item (click)="downloadContent(file)">
|
||||
<mat-icon>file_download</mat-icon>
|
||||
<span>{{ 'FORM.FIELD.DOWNLOAD_FILE' | translate }}</span>
|
||||
</button>
|
||||
<button *ngIf="displayMenuOption('retrieveMetadata')" id="{{'file-'+file?.id+'-retrieve-file-metadata'}}"
|
||||
<button *ngIf="displayMenuOption('retrieveMetadata') && !!file.content?.mimeType" id="{{'file-'+file?.id+'-retrieve-file-metadata'}}"
|
||||
mat-menu-item (click)="contentModelFormFileHandler(file)">
|
||||
<mat-icon class="mat-24">low_priority</mat-icon>
|
||||
<span>{{ 'ADF_CLOUD_FORM_COMPONENT.RETRIEVE_METADATA' | translate }}</span>
|
||||
|
@@ -59,7 +59,8 @@ import {
|
||||
processVariables,
|
||||
mockAllFileSourceWithRenamedFolderVariablePathType,
|
||||
allSourceParamsWithWrongRelativePath,
|
||||
allSourceParamsWithRelativePath
|
||||
allSourceParamsWithRelativePath,
|
||||
fakeLocalPhysicalRecordResponse
|
||||
} from '../../../mocks/attach-file-cloud-widget.mock';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
@@ -510,6 +511,14 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
|
||||
expect(fixture.debugElement.query(By.css('#file-1155-remove'))).toBeNull();
|
||||
}));
|
||||
|
||||
it('should not show any action when the attached file is a physical record', async(() => {
|
||||
createUploadWidgetField(new FormModel(), 'fill-test', [fakeLocalPhysicalRecordResponse], onlyLocalParams, null, null, true);
|
||||
fixture.detectChanges();
|
||||
const menuButton = fixture.debugElement.query(By.css('#file-1155-option-menu'));
|
||||
|
||||
expect(menuButton).toBeNull();
|
||||
}));
|
||||
});
|
||||
|
||||
describe('when a file is uploaded', () => {
|
||||
|
@@ -33,6 +33,33 @@ export const fakeLocalPngResponse = {
|
||||
contentAvailable: true,
|
||||
link: false,
|
||||
mimeType: 'image/png',
|
||||
content: {
|
||||
mimeType: 'image/png'
|
||||
},
|
||||
simpleType: 'image',
|
||||
previewStatus: 'queued',
|
||||
thumbnailStatus: 'queued',
|
||||
properties: {
|
||||
'pfx:property_one': 'testValue',
|
||||
'pfx:property_two': true
|
||||
}
|
||||
};
|
||||
|
||||
export const fakeLocalPhysicalRecordResponse = {
|
||||
id: 1155,
|
||||
nodeId: 1155,
|
||||
name: 'a_png_file.png',
|
||||
created: '2017-07-25T17:17:37.099Z',
|
||||
createdBy: {
|
||||
id: 1001,
|
||||
firstName: 'Admin',
|
||||
lastName: 'admin',
|
||||
email: 'admin'
|
||||
},
|
||||
relatedContent: false,
|
||||
contentAvailable: true,
|
||||
link: false,
|
||||
mimeType: null,
|
||||
simpleType: 'image',
|
||||
previewStatus: 'queued',
|
||||
thumbnailStatus: 'queued',
|
||||
|
@@ -76,13 +76,13 @@
|
||||
</button>
|
||||
<mat-menu #fileActionMenu="matMenu" xPosition="before">
|
||||
<button id="{{'file-'+file.id+'-show-file'}}"
|
||||
[disabled]="file.isExternal || !file.contentAvailable"
|
||||
[disabled]="file.isExternal || !file.contentAvailable || !file.mimeType"
|
||||
mat-menu-item (click)="onAttachFileClicked(file)">
|
||||
<mat-icon>visibility</mat-icon>
|
||||
<span>{{ 'FORM.FIELD.VIEW_FILE' | translate }}</span>
|
||||
</button>
|
||||
<button id="{{'file-'+file.id+'-download-file'}}"
|
||||
[disabled]="file.isExternal"
|
||||
[disabled]="file.isExternal || !file.mimeType"
|
||||
mat-menu-item (click)="downloadContent(file)">
|
||||
<mat-icon>file_download</mat-icon>
|
||||
<span>{{ 'FORM.FIELD.DOWNLOAD_FILE' | translate }}</span>
|
||||
|
@@ -256,7 +256,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
||||
from(fileNodeList).pipe(
|
||||
mergeMap((node) =>
|
||||
zip(
|
||||
of(node.content.mimeType),
|
||||
of(node?.content?.mimeType),
|
||||
this.activitiContentService.applyAlfrescoNode(node, siteId, accountId),
|
||||
of(node.isExternal)
|
||||
)
|
||||
|
Reference in New Issue
Block a user