mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-591] unsharing links (#177)
* unsharing links * restore move/delete buttons, new icon for unshare
This commit is contained in:
committed by
Cilibiu Bogdan
parent
cb95a422aa
commit
b5e394bc07
@@ -37,6 +37,7 @@ import { NodeMoveDirective } from './directives/node-move.directive';
|
||||
import { DownloadFileDirective } from './directives/node-download.directive';
|
||||
import { NodeRestoreDirective } from './directives/node-restore.directive';
|
||||
import { NodePermanentDeleteDirective } from './directives/node-permanent-delete.directive';
|
||||
import { NodeUnshareDirective } from './directives/node-unshare.directive';
|
||||
|
||||
import { ContentManagementService } from './services/content-management.service';
|
||||
import { BrowsingFilesService } from './services/browsing-files.service';
|
||||
@@ -59,7 +60,8 @@ export function declarations() {
|
||||
NodeMoveDirective,
|
||||
DownloadFileDirective,
|
||||
NodeRestoreDirective,
|
||||
NodePermanentDeleteDirective
|
||||
NodePermanentDeleteDirective,
|
||||
NodeUnshareDirective
|
||||
];
|
||||
}
|
||||
|
||||
|
62
src/app/common/directives/node-unshare.directive.ts
Normal file
62
src/app/common/directives/node-unshare.directive.ts
Normal 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);
|
||||
}
|
||||
|
||||
}
|
@@ -56,6 +56,15 @@
|
||||
<span>{{ 'APP.ACTIONS.MOVE' | translate }}</span>
|
||||
</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
|
||||
mat-menu-item
|
||||
*ngIf="canDelete(documentList.selection)"
|
||||
|
@@ -87,6 +87,7 @@ export class SharedFilesComponent extends PageComponent implements OnInit, OnDes
|
||||
|
||||
refresh(): void {
|
||||
if (this.documentList) {
|
||||
this.documentList.resetSelection();
|
||||
this.documentList.reload();
|
||||
}
|
||||
}
|
||||
|
@@ -101,7 +101,8 @@
|
||||
"MORE": "More actions",
|
||||
"UNDO": "Undo",
|
||||
"RESTORE": "Restore",
|
||||
"FAVORITE": "Favorite"
|
||||
"FAVORITE": "Favorite",
|
||||
"UNSHARE": "Unshare"
|
||||
},
|
||||
"DOCUMENT_LIST": {
|
||||
"COLUMNS": {
|
||||
|
Reference in New Issue
Block a user