Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AAE-6165] Add capability in the Attach File of displaying metadata f…
…ields in addition to file name (#7324) * [AAE-6165] Add capability in the Attach File of displaying metadata fields in addition to file name * Minor css styling adjustments * [AAE-6165] Changes done for date datatype and table css * [AAE-6165] Changes done as per the comments * [AAE-6165] Changes done as per comments on PR * Resolved failing lints * Updated CSS for attach file widget * Updated css * Updated UT * Resolved e2e failures * Resolved e2e errors Co-authored-by: amohammedalfresco <abdul.mohammed@alfresco.com>
- Loading branch information
1 parent
1467b6d
commit f14d333
Showing
15 changed files
with
452 additions
and
73 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
lib/core/form/components/widgets/core/displayable-cm-properties.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*! | ||
* @license | ||
* Copyright 2019 Alfresco Software, Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* tslint:disable:component-selector */ | ||
|
||
export interface DisplayableCMProperties { | ||
name?: string; | ||
prefixedName?: string; | ||
title?: string; | ||
dataType?: string; | ||
defaultValue?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 34 additions & 58 deletions
92
...cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,40 @@ | ||
<div class="adf-attach-widget {{field.className}}" [class.adf-invalid]="!field.isValid" | ||
[class.adf-readonly]="field.readOnly"> | ||
<label class="adf-label" [attr.for]="field.id">{{field.name}} | ||
<span *ngIf="isRequired()">*</span> | ||
</label> | ||
<div class="adf-attach-widget-container"> | ||
<div class="adf-attach-widget__menu-upload" *ngIf="isUploadButtonVisible()"> | ||
<button (click)="openSelectDialog()" mat-raised-button color="primary" [id]="field.id" | ||
[matTooltip]="field.tooltip" matTooltipPosition="above" matTooltipShowDelay="1000"> | ||
{{ 'FORM.FIELD.ATTACH' | translate }} | ||
<mat-icon>{{getWidgetIcon()}}</mat-icon> | ||
</button> | ||
<div class="adf-attach-file-widget-container"> | ||
<div class="adf-attach-widget {{field.className}}" [class.adf-invalid]="!field.isValid" | ||
[class.adf-readonly]="field.readOnly"> | ||
<label class="adf-label" [attr.for]="field.id">{{field.name}} | ||
<span *ngIf="isRequired()">*</span> | ||
</label> | ||
<div class="adf-attach-widget-container"> | ||
<div class="adf-attach-widget__menu-upload" *ngIf="isUploadButtonVisible()"> | ||
<button (click)="openSelectDialog()" mat-raised-button color="primary" [id]="field.id" | ||
[matTooltip]="field.tooltip" matTooltipPosition="above" matTooltipShowDelay="1000"> | ||
{{ 'FORM.FIELD.ATTACH' | translate }} | ||
<mat-icon>{{getWidgetIcon()}}</mat-icon> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div id="adf-attach-widget-readonly-list"> | ||
<mat-list *ngIf="hasFile"> | ||
<mat-list-item | ||
[ngClass]="{'adf-attach-files-row': true, 'adf-attach-selected-file-row': displayMenuOption('retrieveMetadata') && selectedNode && file.id === selectedNode.id}" | ||
*ngFor="let file of uploadedFiles"> | ||
<mat-icon mat-list-icon class="adf-datatable-selected" *ngIf="selectedNode && file.id === selectedNode.id" (click)="onRowClicked(file)"> | ||
check_circle | ||
</mat-icon> | ||
<img mat-list-icon class="adf-attach-widget__icon" *ngIf="!selectedNode || file.id !== selectedNode.id" [id]="'file-'+file?.id+'-icon'" (click)="onRowClicked(file)" | ||
[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" *ngIf="!!file.content?.mimeType"> | ||
<mat-icon>more_vert</mat-icon> | ||
</button> | ||
<mat-menu #fileActionMenu="matMenu" xPosition="before"> | ||
<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') && !!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') && !!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> | ||
</button> | ||
<button *ngIf="!field.readOnly && displayMenuOption('remove')" id="{{'file-'+file?.id+'-remove-file'}}" | ||
mat-menu-item [id]="'file-'+file?.id+'-remove'" | ||
(click)="onRemoveAttachFile(file);" (keyup.enter)="onRemoveAttachFile(file);"> | ||
<mat-icon class="mat-24">highlight_off</mat-icon> | ||
<span>{{ 'FORM.FIELD.REMOVE_FILE' | translate }}</span> | ||
</button> | ||
</mat-menu> | ||
</mat-list-item> | ||
</mat-list> | ||
<div *ngIf="!hasFile && field.readOnly" id="{{'adf-attach-empty-list-'+field.id}}"> | ||
{{ 'FORM.FIELD.NO_FILE_ATTACHED' | translate }} | ||
<div id="adf-attach-widget-readonly-list" class="adf-attach-widget-readonly-table"> | ||
<adf-cloud-file-properties-table | ||
[uploadedFiles]="uploadedFiles" | ||
[hasFile]="hasFile" | ||
[selectedNode]="selectedNode" | ||
[field]="field" | ||
[displayedColumns]="displayedColumns" | ||
[mimeTypeIcon]="mimeTypeIcon" | ||
(rowClick)="onRowClicked($event)" | ||
(attachFileClick)="onAttachFileClicked($event)" | ||
(downloadFile)="downloadContent($event)" | ||
(contentModelFileHandler)="contentModelFormFileHandler($event)" | ||
(removeAttachFile)="onRemoveAttachFile($event)" | ||
></adf-cloud-file-properties-table> | ||
<div *ngIf="!hasFile && field.readOnly" id="{{'adf-attach-empty-list-'+field.id}}"> | ||
{{ 'FORM.FIELD.NO_FILE_ATTACHED' | translate }} | ||
</div> | ||
|
||
</div> | ||
|
||
<error-widget [error]="field.validationSummary"></error-widget> | ||
<error-widget *ngIf="isInvalidFieldRequired()" required="{{ 'FORM.FIELD.REQUIRED' | translate }}"></error-widget> | ||
</div> | ||
|
||
<error-widget [error]="field.validationSummary"></error-widget> | ||
<error-widget *ngIf="isInvalidFieldRequired()" required="{{ 'FORM.FIELD.REQUIRED' | translate }}"></error-widget> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.