mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-ADF-2528] share directive (#3102)
* share file directive * share link phase 2 * share dialog * share dialog test * more documentation * add more meaningfully specification * Add description in the dialog
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { NodePaging } from 'alfresco-js-api';
|
||||
import { NodePaging, SharedLinkEntry } from 'alfresco-js-api';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { UserPreferencesService } from './user-preferences.service';
|
||||
@@ -25,12 +25,12 @@ import 'rxjs/add/observable/fromPromise';
|
||||
@Injectable()
|
||||
export class SharedLinksApiService {
|
||||
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService,
|
||||
private preferences: UserPreferencesService) {}
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private preferences: UserPreferencesService) {
|
||||
}
|
||||
|
||||
private get sharedLinksApi() {
|
||||
return this.apiService.getInstance().core.sharedlinksApi;
|
||||
return this.apiService.getInstance().core.sharedlinksApi;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ export class SharedLinksApiService {
|
||||
const defaultOptions = {
|
||||
maxItems: this.preferences.paginationSize,
|
||||
skipCount: 0,
|
||||
include: [ 'properties', 'allowableOperations' ]
|
||||
include: ['properties', 'allowableOperations']
|
||||
};
|
||||
const queryOptions = Object.assign({}, defaultOptions, options);
|
||||
const promise = sharedLinksApi
|
||||
@@ -53,6 +53,35 @@ export class SharedLinksApiService {
|
||||
.catch(handleError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a shared links available to the current user.
|
||||
* @param nodeId
|
||||
* @param options Options supported by JSAPI
|
||||
*/
|
||||
createSharedLinks(nodeId: string, options: any = {}): Observable<SharedLinkEntry> {
|
||||
const { sharedLinksApi, handleError } = this;
|
||||
|
||||
const promise = sharedLinksApi.addSharedLink({ nodeId: nodeId });
|
||||
|
||||
return Observable
|
||||
.fromPromise(promise)
|
||||
.catch(handleError);
|
||||
}
|
||||
|
||||
/**
|
||||
* delete shared links
|
||||
* @param sharedId to delete
|
||||
*/
|
||||
deleteSharedLink(sharedId: string): Observable<SharedLinkEntry> {
|
||||
const { sharedLinksApi, handleError } = this;
|
||||
|
||||
const promise = sharedLinksApi.deleteSharedLink(sharedId);
|
||||
|
||||
return Observable
|
||||
.fromPromise(promise)
|
||||
.catch(handleError);
|
||||
}
|
||||
|
||||
private handleError(error: any): Observable<any> {
|
||||
return Observable.of(error);
|
||||
}
|
||||
|
Reference in New Issue
Block a user