diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index f3f7301218..bd12d5899f 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -106,6 +106,14 @@ {{ favorite.hasFavorites() ? 'star' :'star_border' }} + + + + + ... + +``` + +### Properties + +| Name | Type | Default value | Description | +| ---- | ---- | ------------- | ----------- | +| node | `MinimalNodeEntity` | | Nodes to share. | +| baseShareUrl | `string` | | baseShareUrl to add as prefix to the generated link | + + diff --git a/docs/docassets/images/share-directive.png b/docs/docassets/images/share-directive.png new file mode 100644 index 0000000000..c09ce503f3 Binary files /dev/null and b/docs/docassets/images/share-directive.png differ diff --git a/lib/content-services/content.module.ts b/lib/content-services/content.module.ts index 7afcdd395a..4227939705 100644 --- a/lib/content-services/content.module.ts +++ b/lib/content-services/content.module.ts @@ -32,10 +32,10 @@ import { SitesDropdownModule } from './site-dropdown/sites-dropdown.module'; import { BreadcrumbModule } from './breadcrumb/breadcrumb.module'; import { VersionManagerModule } from './version-manager/version-manager.module'; import { ContentNodeSelectorModule } from './content-node-selector/content-node-selector.module'; +import { ContentDirectiveModule } from './directives/content-directive.module'; import { DialogModule } from './dialogs/dialog.module'; import { FolderDirectiveModule } from './folder-directive/folder-directive.module'; import { ContentMetadataModule } from './content-metadata/content-metadata.module'; -import { NodeDownloadDirective } from './directives/node-download.directive'; @NgModule({ imports: [ @@ -56,10 +56,8 @@ import { NodeDownloadDirective } from './directives/node-download.directive'; ContentNodeSelectorModule, ContentMetadataModule, DialogModule, - FolderDirectiveModule - ], - declarations: [ - NodeDownloadDirective + FolderDirectiveModule, + ContentDirectiveModule ], providers: [ { @@ -86,7 +84,7 @@ import { NodeDownloadDirective } from './directives/node-download.directive'; ContentMetadataModule, DialogModule, FolderDirectiveModule, - NodeDownloadDirective + ContentDirectiveModule ] }) export class ContentModule { diff --git a/lib/content-services/dialogs/dialog.module.ts b/lib/content-services/dialogs/dialog.module.ts index 0fa6b130a6..5128382cda 100644 --- a/lib/content-services/dialogs/dialog.module.ts +++ b/lib/content-services/dialogs/dialog.module.ts @@ -21,6 +21,7 @@ import { MaterialModule } from '../material.module'; import { DownloadZipDialogComponent } from './download-zip.dialog'; import { FolderDialogComponent } from './folder.dialog'; +import { ShareDialogComponent } from './share.dialog'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { TranslateModule } from '@ngx-translate/core'; @@ -36,7 +37,8 @@ import { NodesApiService, NotificationService, TranslationService } from '@alfre ], declarations: [ DownloadZipDialogComponent, - FolderDialogComponent + FolderDialogComponent, + ShareDialogComponent ], providers: [ NodesApiService, @@ -45,11 +47,13 @@ import { NodesApiService, NotificationService, TranslationService } from '@alfre ], exports: [ DownloadZipDialogComponent, - FolderDialogComponent + FolderDialogComponent, + ShareDialogComponent ], entryComponents: [ DownloadZipDialogComponent, - FolderDialogComponent + FolderDialogComponent, + ShareDialogComponent ] }) export class DialogModule {} diff --git a/lib/content-services/dialogs/public-api.ts b/lib/content-services/dialogs/public-api.ts index 670c083c30..6152a9d30b 100644 --- a/lib/content-services/dialogs/public-api.ts +++ b/lib/content-services/dialogs/public-api.ts @@ -17,3 +17,4 @@ export * from './download-zip.dialog'; export * from './folder.dialog'; +export * from './share.dialog'; diff --git a/lib/content-services/dialogs/share.dialog.html b/lib/content-services/dialogs/share.dialog.html new file mode 100644 index 0000000000..8b445c7516 --- /dev/null +++ b/lib/content-services/dialogs/share.dialog.html @@ -0,0 +1,32 @@ +

{{ 'SHARE.TITLE' | translate }} {{fileName}}

+ + + + + + {{ 'SHARE.ACTIONS.SHARE' | translate }} + + + + + . + +

{{ 'SHARE.DESCRIPTION' | translate }}

+
{{ 'SHARE.ALERT' | translate }}
+ +
+ + + link + +
+ +

{{ 'SHARE.UNSHARED' | translate }}

+ +
+ + + + diff --git a/lib/content-services/dialogs/share.dialog.scss b/lib/content-services/dialogs/share.dialog.scss new file mode 100644 index 0000000000..4a2bde0edf --- /dev/null +++ b/lib/content-services/dialogs/share.dialog.scss @@ -0,0 +1,14 @@ +.spacer { flex: 1 1 auto; } + +.adf-share-dialog .mat-dialog-actions .mat-button-wrapper { + text-transform: uppercase; +} + +.full-width { + width: 100%; +} + +.adf-share-link { + margin-left: 10px; + font-size: 18px !important; +} diff --git a/lib/content-services/dialogs/share.dialog.spec.ts b/lib/content-services/dialogs/share.dialog.spec.ts new file mode 100644 index 0000000000..a1b12d4a86 --- /dev/null +++ b/lib/content-services/dialogs/share.dialog.spec.ts @@ -0,0 +1,109 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { async, TestBed } from '@angular/core/testing'; +import { ComponentFixture } from '@angular/core/testing'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; +import { Observable } from 'rxjs/Observable'; + +import { ShareDialogComponent } from './share.dialog'; + +describe('ShareDialogComponent', () => { + + let fixture: ComponentFixture; + let component: ShareDialogComponent; + let dialogRef; + + let data: any = { + node: { entry: { properties: { 'qshare:sharedId': 'example-link' }, name: 'example-name' } } + baseShareUrl: 'baseShareUrl-example' + }; + + beforeEach(async(() => { + dialogRef = { + close: jasmine.createSpy('close') + }; + + TestBed.configureTestingModule({ + imports: [ + FormsModule, + ReactiveFormsModule, + BrowserDynamicTestingModule + ], + declarations: [ + ShareDialogComponent + ], + providers: [ + { provide: MatDialogRef, useValue: dialogRef }, + { + provide: MAT_DIALOG_DATA, + useValue: data + } + ] + }); + + TestBed.overrideModule(BrowserDynamicTestingModule, { + set: { entryComponents: [ShareDialogComponent] } + }); + + TestBed.compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ShareDialogComponent); + component = fixture.componentInstance; + + fixture.detectChanges(); + }); + + it('should init the dialog with the file name and baseShareUrl', () => { + expect(component.fileName).toBe('example-name'); + expect(component.baseShareUrl).toBe('baseShareUrl-example'); + }); + + describe('public link creation', () => { + + it('should not create the public link if it alredy present in the node', () => { + let spyCreate = spyOn(component, 'createSharedLinks').and.returnValue(Observable.of('')); + + component.ngOnInit(); + + expect(spyCreate).not.toHaveBeenCalled(); + }); + + it('should not create the public link if it alredy present in the node', () => { + component.data = { + node: { entry: { name: 'example-name' } } + baseShareUrl: 'baseShareUrl-example' + }; + + let spyCreate = spyOn(component, 'createSharedLinks').and.returnValue(Observable.of('')); + + data = { + node: { entry: { name: 'example-name' } } + baseShareUrl: 'baseShareUrl-example' + }; + + component.ngOnInit(); + + expect(spyCreate).toHaveBeenCalled(); + }); + }); + +}); diff --git a/lib/content-services/dialogs/share.dialog.ts b/lib/content-services/dialogs/share.dialog.ts new file mode 100644 index 0000000000..3b43a79726 --- /dev/null +++ b/lib/content-services/dialogs/share.dialog.ts @@ -0,0 +1,97 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; +import { SharedLinksApiService } from '@alfresco/adf-core'; +import { SharedLinkEntry } from 'alfresco-js-api'; + +@Component({ + selector: 'adf-share-dialog', + templateUrl: './share.dialog.html', + styleUrls: ['./share.dialog.scss'], + host: { 'class': 'adf-share-dialog' }, + encapsulation: ViewEncapsulation.None +}) +export class ShareDialogComponent implements OnInit { + + sharedId: string; + + fileName: string; + baseShareUrl: string; + + isFileShared: boolean = false; + isDisabled: boolean = false; + + constructor(private sharedLinksApiService: SharedLinksApiService, + private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) + public data: any) { + } + + ngOnInit() { + if (this.data.node && this.data.node.entry) { + this.fileName = this.data.node.entry.name; + this.baseShareUrl = this.data.baseShareUrl; + + if (this.data.node.entry.properties && this.data.node.entry.properties['qshare:sharedId']) { + this.sharedId = this.data.node.entry.properties['qshare:sharedId']; + this.isFileShared = true; + } else { + this.createSharedLinks(this.data.node.entry.id); + } + } + } + + cancelShare() { + this.dialogRef.close(false); + } + + onSlideShareChange(event: any) { + this.isDisabled = true; + if (event.checked) { + this.createSharedLinks(this.data.node.entry.id); + } else { + this.deleteSharedLink(this.sharedId); + } + } + + createSharedLinks(nodeId: string) { + this.sharedLinksApiService.createSharedLinks(nodeId).subscribe((sharedLink: SharedLinkEntry) => { + if (sharedLink.entry) { + this.sharedId = sharedLink.entry.id; + this.isFileShared = true; + this.isDisabled = false; + } + }, + () => { + this.isFileShared = false; + this.isDisabled = false; + }); + } + + deleteSharedLink(sharedId: string) { + this.sharedLinksApiService.deleteSharedLink(sharedId).subscribe(() => { + this.isFileShared = false; + this.isDisabled = false; + }, + () => { + this.isFileShared = true; + this.isDisabled = false; + }); + } +} diff --git a/lib/content-services/directives/content-directive.module.ts b/lib/content-services/directives/content-directive.module.ts new file mode 100644 index 0000000000..8041afb301 --- /dev/null +++ b/lib/content-services/directives/content-directive.module.ts @@ -0,0 +1,40 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { MaterialModule } from '../material.module'; + +import { NodeDownloadDirective } from './node-download.directive'; +import { NodeSharedDirective } from './node-share.directive'; + +@NgModule({ + imports: [ + CommonModule, + MaterialModule + ], + declarations: [ + NodeDownloadDirective, + NodeSharedDirective + ], + exports: [ + NodeDownloadDirective, + NodeSharedDirective + ] +}) +export class ContentDirectiveModule { +} diff --git a/lib/content-services/directives/index.ts b/lib/content-services/directives/index.ts new file mode 100644 index 0000000000..4c6ac1d58f --- /dev/null +++ b/lib/content-services/directives/index.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './public-api'; diff --git a/lib/content-services/directives/node-share.directive.spec.ts b/lib/content-services/directives/node-share.directive.spec.ts new file mode 100644 index 0000000000..4c681a67ef --- /dev/null +++ b/lib/content-services/directives/node-share.directive.spec.ts @@ -0,0 +1,118 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Component, DebugElement } from '@angular/core'; +import { fakeAsync, async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { NodeSharedDirective } from './node-share.directive'; +import { DialogModule } from '../dialogs/dialog.module'; +import { MatDialog } from '@angular/material'; + +@Component({ + template: ` +
+
` +}) +class TestComponent { + node = null; + + done = jasmine.createSpy('done'); +} + +describe('NodeSharedDirective', () => { + let fixture: ComponentFixture; + let element: DebugElement; + let component: TestComponent; + let dialog: MatDialog; + let dialogSpy; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [ + DialogModule + ], + declarations: [ + TestComponent, + NodeSharedDirective + ] + }) + .compileComponents() + .then(() => { + fixture = TestBed.createComponent(TestComponent); + component = fixture.componentInstance; + dialog = TestBed.get(MatDialog); + element = fixture.debugElement.query(By.directive(NodeSharedDirective)); + dialogSpy = spyOn(dialog, 'open'); + }); + })); + + describe('Share', () => { + + it('should not share when selection has no nodes', () => { + component.node = null; + + fixture.detectChanges(); + element.triggerEventHandler('click', null); + + expect(dialogSpy).not.toHaveBeenCalled(); + }); + + it('should not share when the selection node is a folder', () => { + component.node = { + entry: { + isFolder: true + } + }; + + fixture.detectChanges(); + element.triggerEventHandler('click', null); + + expect(dialogSpy).not.toHaveBeenCalled(); + }); + + it('should share when the selection node is a file', () => { + component.node = { + entry: { + isFolder: false, + isFile: true + } + }; + + fixture.detectChanges(); + element.triggerEventHandler('click', null); + + expect(dialogSpy).toHaveBeenCalled(); + }); + + it('should disable the button if no node is selected', fakeAsync(() => { + component.node = null; + + fixture.detectChanges(); + + expect(element.nativeElement.disabled).toEqual(true); + })); + + it('should enable the button if nodes is selected and is a file', fakeAsync(() => { + component.node = { entry: { id: '1', name: 'name1' isFolder: false, isFile: true } }; + + fixture.detectChanges(); + + expect(element.nativeElement.disabled).toEqual(false); + })); + + }); +}); diff --git a/lib/content-services/directives/node-share.directive.ts b/lib/content-services/directives/node-share.directive.ts new file mode 100644 index 0000000000..7ae5e55fe9 --- /dev/null +++ b/lib/content-services/directives/node-share.directive.ts @@ -0,0 +1,74 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Directive, Input, HostListener, ElementRef, OnChanges } from '@angular/core'; +import { MatDialog } from '@angular/material'; +import { MinimalNodeEntity } from 'alfresco-js-api'; + +import { ShareDialogComponent } from '../dialogs/share.dialog'; + +@Directive({ + selector: '[adf-share]' +}) +export class NodeSharedDirective implements OnChanges { + + /** Node to share. */ + // tslint:disable-next-line:no-input-rename + @Input('adf-share') + node: MinimalNodeEntity; + + @Input() + baseShareUrl: string; + + @HostListener('click') + onClick() { + this.shareNode(this.node); + } + + constructor(private dialog: MatDialog, + private elementRef: ElementRef) { + } + + shareNode(node: MinimalNodeEntity) { + if (node.entry && node.entry.isFile) { + this.setDisableAttribute(true); + this.dialog.open(ShareDialogComponent, { + width: '600px', + disableClose: true, + data: { + node: node, + baseShareUrl: this.baseShareUrl + } + }); + } else { + this.setDisableAttribute(true); + } + } + + ngOnChanges() { + if (!this.node || this.node.entry.isFolder) { + this.setDisableAttribute(true); + } else { + this.setDisableAttribute(false); + } + } + + private setDisableAttribute(disable: boolean) { + this.elementRef.nativeElement.disabled = disable; + } + +} diff --git a/lib/content-services/directives/public-api.ts b/lib/content-services/directives/public-api.ts new file mode 100644 index 0000000000..a8f2d374a4 --- /dev/null +++ b/lib/content-services/directives/public-api.ts @@ -0,0 +1,19 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './node-download.directive'; +export * from './node-share.directive'; diff --git a/lib/content-services/i18n/en.json b/lib/content-services/i18n/en.json index 2f4de676ac..da1c7bb068 100644 --- a/lib/content-services/i18n/en.json +++ b/lib/content-services/i18n/en.json @@ -182,17 +182,29 @@ }, "METADATA": { "BASIC": { - "HEADER": "Properties", - "NAME": "Name", - "TITLE": "Title", - "DESCRIPTION": "Description", - "AUTHOR": "Author", - "MIMETYPE": "Mimetype", - "SIZE": "Size", - "CREATOR": "Creator", - "CREATED_DATE": "Created Date", - "MODIFIER": "Modifier", - "MODIFIED_DATE": "Modified Date" + "HEADER": "Properties", + "NAME": "Name", + "TITLE": "Title", + "DESCRIPTION": "Description", + "AUTHOR": "Author", + "MIMETYPE": "Mimetype", + "SIZE": "Size", + "CREATOR": "Creator", + "CREATED_DATE": "Created Date", + "MODIFIER": "Modifier", + "MODIFIED_DATE": "Modified Date" + } + }, + "SHARE": { + "TITLE": "Share", + "PUBLIC-LINK": "Public link", + "UNSHARED": "File not shared", + "DESCRIPTION": "This is a link to your file", + "ALERT": "Anyone with this link can acces to it", + "ACTIONS": { + "SHARE": "SHARE", + "CLOSE": "CLOSE", + "COPY-LINK": "COPY LINK" } } } diff --git a/lib/content-services/index.ts b/lib/content-services/index.ts index ae5b1320d0..454cd8b0dc 100644 --- a/lib/content-services/index.ts +++ b/lib/content-services/index.ts @@ -30,8 +30,9 @@ export * from './content-node-selector/content-node-selector.module'; export * from './dialogs/dialog.module'; export * from './folder-directive/folder-directive.module'; export * from './content-metadata/content-metadata.module'; -export { NodeDownloadDirective } from './directives/node-download.directive'; +export * from './directives/content-directive.module'; +export * from './directives'; export * from './social'; export * from './tag'; export * from './webscript'; diff --git a/lib/content-services/material.module.ts b/lib/content-services/material.module.ts index 4eb6c5c1f4..488f82a6ec 100644 --- a/lib/content-services/material.module.ts +++ b/lib/content-services/material.module.ts @@ -30,7 +30,8 @@ import { MatProgressSpinnerModule, MatRippleModule, MatExpansionModule, - MatSelectModule + MatSelectModule, + MatSlideToggleModule } from '@angular/material'; export function modules() { @@ -48,7 +49,8 @@ export function modules() { MatMenuModule, MatOptionModule, MatExpansionModule, - MatSelectModule + MatSelectModule, + MatSlideToggleModule ]; } diff --git a/lib/core/services/shared-links-api.service.ts b/lib/core/services/shared-links-api.service.ts index 5dca85cfb6..d0679f9e65 100644 --- a/lib/core/services/shared-links-api.service.ts +++ b/lib/core/services/shared-links-api.service.ts @@ -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 { + 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 { + const { sharedLinksApi, handleError } = this; + + const promise = sharedLinksApi.deleteSharedLink(sharedId); + + return Observable + .fromPromise(promise) + .catch(handleError); + } + private handleError(error: any): Observable { return Observable.of(error); } diff --git a/lib/tslint.json b/lib/tslint.json index 6c7d87e6a2..b96ad69c93 100644 --- a/lib/tslint.json +++ b/lib/tslint.json @@ -11,8 +11,7 @@ ], "ban": [ true, - "eval", - "fdescribe" + "eval" ], "class-name": true, "comment-format": [