[ACA-591] unsharing links (#177)

* unsharing links

* restore move/delete buttons, new icon for unshare
This commit is contained in:
Denys Vuika
2018-01-23 16:47:44 +00:00
committed by Cilibiu Bogdan
parent cb95a422aa
commit b5e394bc07
5 changed files with 77 additions and 2 deletions

View File

@@ -37,6 +37,7 @@ import { NodeMoveDirective } from './directives/node-move.directive';
import { DownloadFileDirective } from './directives/node-download.directive'; import { DownloadFileDirective } from './directives/node-download.directive';
import { NodeRestoreDirective } from './directives/node-restore.directive'; import { NodeRestoreDirective } from './directives/node-restore.directive';
import { NodePermanentDeleteDirective } from './directives/node-permanent-delete.directive'; import { NodePermanentDeleteDirective } from './directives/node-permanent-delete.directive';
import { NodeUnshareDirective } from './directives/node-unshare.directive';
import { ContentManagementService } from './services/content-management.service'; import { ContentManagementService } from './services/content-management.service';
import { BrowsingFilesService } from './services/browsing-files.service'; import { BrowsingFilesService } from './services/browsing-files.service';
@@ -59,7 +60,8 @@ export function declarations() {
NodeMoveDirective, NodeMoveDirective,
DownloadFileDirective, DownloadFileDirective,
NodeRestoreDirective, NodeRestoreDirective,
NodePermanentDeleteDirective NodePermanentDeleteDirective,
NodeUnshareDirective 
]; ];
} }

View File

@@ -0,0 +1,62 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2017 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { Directive, HostListener, Input, ElementRef } from '@angular/core';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { MinimalNodeEntity } from 'alfresco-js-api';
@Directive({
selector: '[appUnshareNode]'
})
export class NodeUnshareDirective {
// tslint:disable-next-line:no-input-rename
@Input('appUnshareNode')
selection: MinimalNodeEntity[];
constructor(
private apiService: AlfrescoApiService,
private el: ElementRef) {
}
@HostListener('click')
onClick() {
if (this.selection.length > 0) {
this.unshareLinks(this.selection);
}
}
private async unshareLinks(links: MinimalNodeEntity[]) {
const promises = links.map(link => this.apiService.sharedLinksApi.deleteSharedLink(link.entry.id));
await Promise.all(promises);
this.emitDone();
}
private emitDone() {
const e = new CustomEvent('links-unshared', { bubbles: true });
this.el.nativeElement.dispatchEvent(e);
}
}

View File

@@ -56,6 +56,15 @@
<span>{{ 'APP.ACTIONS.MOVE' | translate }}</span> <span>{{ 'APP.ACTIONS.MOVE' | translate }}</span>
</button> </button>
<button
mat-menu-item
*ngIf="canDelete(documentList.selection)"
[appUnshareNode]="documentList.selection"
(links-unshared)="refresh()">
<mat-icon>stop_screen_share</mat-icon>
<span>{{ 'APP.ACTIONS.UNSHARE' | translate }}</span>
</button>
<button <button
mat-menu-item mat-menu-item
*ngIf="canDelete(documentList.selection)" *ngIf="canDelete(documentList.selection)"

View File

@@ -87,6 +87,7 @@ export class SharedFilesComponent extends PageComponent implements OnInit, OnDes
refresh(): void { refresh(): void {
if (this.documentList) { if (this.documentList) {
this.documentList.resetSelection();
this.documentList.reload(); this.documentList.reload();
} }
} }

View File

@@ -101,7 +101,8 @@
"MORE": "More actions", "MORE": "More actions",
"UNDO": "Undo", "UNDO": "Undo",
"RESTORE": "Restore", "RESTORE": "Restore",
"FAVORITE": "Favorite" "FAVORITE": "Favorite",
"UNSHARE": "Unshare"
}, },
"DOCUMENT_LIST": { "DOCUMENT_LIST": {
"COLUMNS": { "COLUMNS": {