[ACA-3266] Improve version upload component (#5750)

* added new component to compare current and new file version of a node.

* update doc

* added more tests

* updated docs

* small fixes

* changed with typography

* Update version-comparison.component.md

* handle hiding the comparison component on demo shell if cancelled/uploaded a new file version

* small fixes

Co-authored-by: Eugenio Romano <eromano@users.noreply.github.com>
This commit is contained in:
Urse Daniel
2020-06-04 15:01:11 +03:00
committed by GitHub
parent 13066a9a32
commit f0df6b3a5f
16 changed files with 317 additions and 7 deletions

View File

@@ -21,7 +21,8 @@
"SHOW_COMMENTS": "Show comments on versions",
"ALLOW_DOWNLOAD": "Enable version download",
"READ_ONLY": "Read-only",
"COMMENTS": "Show comments"
"COMMENTS": "Show comments",
"VERSION_COMPARISON": "Show version comparison"
},
"PERSONAL-FILES": "Personal Files",
"WARN-MULTIPLE-UPLOADS": "Display warning for multiple uploads.",

View File

@@ -7,7 +7,7 @@
</section>
<section>
<mat-slide-toggle id="adf-version-manager-switch-download"color="primary" [(ngModel)]="allowDownload">
<mat-slide-toggle id="adf-version-manager-switch-download" color="primary" [(ngModel)]="allowDownload">
{{'APP.ADF_VERSION_MANAGER.ALLOW_DOWNLOAD' | translate}}
</mat-slide-toggle>
</section>
@@ -18,11 +18,24 @@
</mat-slide-toggle>
</section>
<section *ngIf="newFileVersion">
<mat-slide-toggle id="adf-version-manager-switch-comparison" color="primary" [(ngModel)]="showVersionComparison">
{{'APP.ADF_VERSION_MANAGER.VERSION_COMPARISON' | translate}}
</mat-slide-toggle>
</section>
<section mat-dialog-content *ngIf="!readOnly">
<adf-version-manager [node]="contentEntry" [newFileVersion]="newFileVersion" [allowDownload]="allowDownload" [showComments]="showComments" (uploadError)="uploadError($event)"></adf-version-manager>
<adf-version-manager [node]="contentEntry"
(uploadCancel)="hideVersionComparison($event)"
(uploadSuccess)="hideVersionComparison($event)"
[showVersionComparison]="showVersionComparison"
[newFileVersion]="newFileVersion"
[allowDownload]="allowDownload"
[showComments]="showComments"
(uploadError)="uploadError($event)"></adf-version-manager>
</section>
<section mat-dialog-content *ngIf="readOnly">
<adf-version-list [node]="contentEntry" [showActions]="false" ></adf-version-list>
<adf-version-list [node]="contentEntry" [showActions]="false"></adf-version-list>
</section>
<footer mat-dialog-actions fxLayout="row" fxLayoutAlign="end center">

View File

@@ -32,6 +32,7 @@ export class VersionManagerDialogAdapterComponent {
showComments = true;
allowDownload = true;
readOnly = false;
showVersionComparison = false;
constructor(@Inject(MAT_DIALOG_DATA) data: any,
private snackBar: MatSnackBar,
@@ -43,10 +44,17 @@ export class VersionManagerDialogAdapterComponent {
}
uploadError(errorMessage: string) {
this.snackBar.open(errorMessage, '', { duration: 4000 });
this.snackBar.open(errorMessage, '', {duration: 4000});
}
close() {
this.containingDialog.close();
}
hideVersionComparison(isCancelled: boolean | Node) {
if (isCancelled) {
this.showVersionComparison = false;
this.newFileVersion = null;
}
}
}