mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2540] Lock node feature (#3138)
* add adf-node-lock directive * add lock-node service + button in context menu * unit tests * docs * unit tests fix * Remove unnecessary imports * PR changes * Remove fit from tests * Update specific node from list on lock/ulock
This commit is contained in:
committed by
Denys Vuika
parent
7b7e39d989
commit
7d1b4bf14a
@@ -16,20 +16,24 @@
|
||||
*/
|
||||
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { EventEmitter, Injectable, Output } from '@angular/core';
|
||||
import { ContentService } from '@alfresco/adf-core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { ShareDataRow } from '../document-list/data/share-data-row.model';
|
||||
import { MinimalNodeEntryEntity, SitePaging } from 'alfresco-js-api';
|
||||
import { DataColumn, SitesService, TranslationService } from '@alfresco/adf-core';
|
||||
import { DataColumn, SitesService, TranslationService, PermissionsEnum } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../document-list/services/document-list.service';
|
||||
import { ContentNodeSelectorComponent } from './content-node-selector.component';
|
||||
import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface';
|
||||
import { NodeLockDialogComponent } from '../dialogs/node-lock.dialog';
|
||||
|
||||
@Injectable()
|
||||
export class ContentNodeDialogService {
|
||||
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
constructor(private dialog: MatDialog,
|
||||
private contentService: ContentService,
|
||||
private documentListService: DocumentListService,
|
||||
@@ -45,6 +49,32 @@ export class ContentNodeDialogService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a lock node dialog
|
||||
*
|
||||
* @param contentEntry Node to lock
|
||||
*/
|
||||
public openLockNodeDialog(contentEntry: MinimalNodeEntryEntity): Subject<string> {
|
||||
const observable: Subject<string> = new Subject<string>();
|
||||
|
||||
if (this.contentService.hasPermission(contentEntry, PermissionsEnum.LOCK)) {
|
||||
this.dialog.open(NodeLockDialogComponent, {
|
||||
data: {
|
||||
node: contentEntry,
|
||||
onError: (error) => {
|
||||
this.error.emit(error);
|
||||
observable.error(error);
|
||||
}
|
||||
},
|
||||
width: '400px'
|
||||
});
|
||||
} else {
|
||||
observable.error('OPERATION.FAIL.NODE.NO_PERMISSION');
|
||||
}
|
||||
|
||||
return observable;
|
||||
}
|
||||
|
||||
/** Opens a file browser at a chosen site location. */
|
||||
openFileBrowseDialogBySite(): Observable<MinimalNodeEntryEntity[]> {
|
||||
return this.siteService.getSites().switchMap((response: SitePaging) => {
|
||||
|
Reference in New Issue
Block a user