[ADF-3609 ] fallback for metadata and undefined value check (#3838)

* [ADF-3609 ] fallback for metadata and undefined value check

* fix lint issues

* make name new property optional
This commit is contained in:
Mario Romano
2018-10-23 14:35:44 +01:00
committed by Eugenio Romano
parent 2baf20b370
commit 53d96679ea
7 changed files with 46 additions and 17 deletions

View File

@@ -409,7 +409,8 @@
<adf-info-drawer [title]="'Details'" *ngIf="documentList.selection[0]" >
<adf-info-drawer-tab [label]="'Properties'">
<adf-content-metadata-card
[node]="documentList.selection[0].entry">
[node]="documentList.selection[0].entry"
[displayEmpty]="displayEmptyMetadata">
</adf-content-metadata-card>
</adf-info-drawer-tab>
<adf-info-drawer-tab [label]="'Versions'">
@@ -556,6 +557,14 @@
</mat-slide-toggle>
</section>
<section>
<mat-slide-toggle
color="primary" [(ngModel)]="displayEmptyMetadata" id="displayEmptyMetadata">
Display Empty Metadata
</mat-slide-toggle>
</section>
<h5>Upload</h5>
<section *ngIf="acceptedFilesTypeShow">
<mat-form-field floatPlaceholder="float">

View File

@@ -186,6 +186,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
thumbnails = false;
enableCustomPermissionMessage = false;
enableMediumTimeFormat = false;
displayEmptyMetadata = false;
private onCreateFolder: Subscription;
private onEditFolder: Subscription;
@@ -415,7 +416,10 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
if (this.contentService.hasPermission(contentEntry, 'update')) {
this.dialog.open(MetadataDialogAdapterComponent, {
data: { contentEntry },
data: {
contentEntry: contentEntry,
displayEmptyMetadata: this.displayEmptyMetadata
},
panelClass: 'adf-metadata-manager-dialog',
width: '630px'
});
@@ -439,8 +443,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
hasOneFileSelected(): boolean {
const selection: Array<MinimalNodeEntity> = this.documentList.selection;
const hasOneFileSelected = selection && selection.length === 1 && selection[0].entry.isFile;
return hasOneFileSelected;
return selection && selection.length === 1 && selection[0].entry.isFile;
}
userHasPermissionToManageVersions(): boolean {
@@ -528,11 +531,9 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
this.documentList.reload();
}
canDownloadNode = (node: MinimalNodeEntity): boolean => {
if (node && node.entry && node.entry.name === 'custom') {
return true;
}
return false;
canDownloadNode(node: MinimalNodeEntity): boolean {
return node && node.entry && node.entry.name === 'custom';
}
onBeginUpload(event: UploadFilesEvent) {
@@ -558,7 +559,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}
}
isCustomActionDisabled = (node: MinimalNodeEntity): boolean => {
isCustomActionDisabled(node: MinimalNodeEntity): boolean {
if (node && node.entry && node.entry.name === 'custom') {
return false;
}

View File

@@ -1,6 +1,7 @@
<header mat-dialog-title>{{'METADATA.DIALOG.TITLE' | translate}}</header>
<section mat-dialog-content>
<adf-content-metadata-card [node]="contentEntry"></adf-content-metadata-card>
<adf-content-metadata-card [node]="contentEntry"
[displayEmpty]="displayEmptyMetadata"></adf-content-metadata-card>
</section>
<footer mat-dialog-actions fxLayout="row" fxLayoutAlign="end center">
<button mat-button (click)="close()">{{'METADATA.DIALOG.CLOSE' | translate}}</button>

View File

@@ -27,9 +27,12 @@ export class MetadataDialogAdapterComponent {
public contentEntry: MinimalNodeEntryEntity;
displayEmptyMetadata = false;
constructor(@Inject(MAT_DIALOG_DATA) data: any,
private containingDialog?: MatDialogRef<MetadataDialogAdapterComponent>) {
this.contentEntry = data.contentEntry;
this.displayEmptyMetadata = data.displayEmptyMetadata;
}
close() {