From 5325fd4cd45ac3c6c85adc84d419c7d013b20504 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 6 Apr 2018 18:40:17 +0100 Subject: [PATCH] [ADF-2567] delete a version (#3151) * configuration support for version manager * checkbox for version deletion demo * i18n support for version manager * deleting versions * confirmation dialog for version deletion * readme update * update schema * update code as per code review * update i18n resources for demo shell * unit tests --- demo-shell/resources/i18n/en.json | 7 +- demo-shell/src/app.config.json | 5 ++ .../app/components/files/files.component.html | 26 +++++-- .../app/components/files/files.component.ts | 9 ++- ...sion-manager-dialog-adapter.component.html | 2 +- ...ersion-manager-dialog-adapter.component.ts | 4 +- .../version-list.component.md | 3 +- lib/content-services/content.module.ts | 10 +-- .../dialogs/confirm.dialog.ts | 58 ++++++++++++++ lib/content-services/dialogs/dialog.module.ts | 10 ++- lib/content-services/dialogs/public-api.ts | 1 + lib/content-services/i18n/en.json | 23 ++++++ .../version-list.component.html | 17 ++++- .../version-list.component.spec.ts | 75 ++++++++++++++++++- .../version-manager/version-list.component.ts | 42 +++++++++-- .../version-manager.component.html | 5 +- .../version-manager.component.ts | 18 ++++- .../version-upload.component.html | 4 +- lib/core/app-config/schema.json | 9 +++ 19 files changed, 285 insertions(+), 43 deletions(-) create mode 100644 lib/content-services/dialogs/confirm.dialog.ts diff --git a/demo-shell/resources/i18n/en.json b/demo-shell/resources/i18n/en.json index b09db9a03d..9589d50b36 100644 --- a/demo-shell/resources/i18n/en.json +++ b/demo-shell/resources/i18n/en.json @@ -5,6 +5,11 @@ "COMMENTS": "Comments", "PROPERTIES": "Properties", "VERSIONS": "Versions" + }, + "ADF_VERSION_MANAGER": { + "ALLOW_DELETE": "Allow delete", + "SHOW_COMMENTS" : "Show comments on versions", + "ALLOW_DOWNLOAD" :"Enable version download" } }, "title": "Welcome", @@ -67,11 +72,9 @@ "CUSTOM_FILTER" :"Custom extensions filter", "MAX_SIZE" : "Max size filter", "ENABLE_VERSIONING" :"Enable versioning", - "ENABLE_VERSION_DOWNLOAD" :"Enable version download", "DESCRIPTION_UPLOAD" : "Enable upload", "ENABLE_INFINITE_SCROLL":"Enable Infinite Scrolling", "MULTISELECT_DESCRIPTION" : "Use Cmd (Mac) or Ctrl (Windows) to toggle selection of multiple items", - "SHOW_VERSION_COMMENTS" : "Show comments on versions", "RECENT" : { "EMPTY_STATE": { "TITLE": "Recent is empty" diff --git a/demo-shell/src/app.config.json b/demo-shell/src/app.config.json index e55d910b5f..1028d7377c 100644 --- a/demo-shell/src/app.config.json +++ b/demo-shell/src/app.config.json @@ -484,5 +484,10 @@ "exif:exif": "*" } } + }, + "adf-version-manager": { + "allowComments": true, + "allowDownload": true, + "allowDelete": true } } diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index 084ba7dd2e..28278682bf 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -362,7 +362,8 @@ + [allowDownload]="allowVersionDownload" + [allowDelete]="allowVersionDelete"> @@ -437,23 +438,32 @@
- {{'DOCUMENT_LIST.ENABLE_VERSIONING' | - translate}} + + {{'DOCUMENT_LIST.ENABLE_VERSIONING' | translate}}
- + {{'DOCUMENT_LIST.ENABLE_INFINITE_SCROLL' | translate}}
- - {{'DOCUMENT_LIST.SHOW_VERSION_COMMENTS' | translate}} + + {{'APP.ADF_VERSION_MANAGER.SHOW_COMMENTS' | translate}} - - {{'DOCUMENT_LIST.ENABLE_VERSION_DOWNLOAD' | translate}} +
+ +
+ + {{'APP.ADF_VERSION_MANAGER.ALLOW_DOWNLOAD' | translate}} + +
+ +
+ + {{'APP.ADF_VERSION_MANAGER.ALLOW_DELETE' | translate}}
diff --git a/demo-shell/src/app/components/files/files.component.ts b/demo-shell/src/app/components/files/files.component.ts index 6124d90346..063329055e 100644 --- a/demo-shell/src/app/components/files/files.component.ts +++ b/demo-shell/src/app/components/files/files.component.ts @@ -103,7 +103,10 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { versioning = false; @Input() - enableVersionDownload = true; + allowVersionDownload = true; + + @Input() + allowVersionDelete = true; @Input() acceptedFilesType = '.jpg,.pdf,.js'; @@ -365,11 +368,11 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { onManageVersions(event) { const contentEntry = event.value.entry; const showComments = this.showVersionComments; - const enableDownload = this.enableVersionDownload; + const allowDownload = this.allowVersionDownload; if (this.contentService.hasPermission(contentEntry, 'update')) { this.dialog.open(VersionManagerDialogAdapterComponent, { - data: { contentEntry, showComments, enableDownload }, + data: { contentEntry, showComments, allowDownload }, panelClass: 'adf-version-manager-dialog', width: '630px' }); diff --git a/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.html b/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.html index 509c3bb54a..ffb418667d 100644 --- a/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.html +++ b/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.html @@ -1,6 +1,6 @@
{{'VERSION.DIALOG.TITLE' | translate}}
- +