mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
upgrade 'create folder' action
This commit is contained in:
parent
44906157a0
commit
71877aa8d0
@ -1,7 +1,8 @@
|
||||
<alfresco-document-menu-action *ngIf="creationMenuActions"
|
||||
[currentFolderPath]="currentFolderPath"
|
||||
(success)="onActionMenuSuccess($event)"
|
||||
(error)="onActionMenuError($event)">
|
||||
<alfresco-document-menu-action
|
||||
*ngIf="creationMenuActions"
|
||||
[folderId]="currentFolderId"
|
||||
(success)="onActionMenuSuccess($event)"
|
||||
(error)="onActionMenuError($event)">
|
||||
</alfresco-document-menu-action>
|
||||
<alfresco-datatable
|
||||
[data]="data"
|
||||
|
@ -15,16 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
Input,
|
||||
Output,
|
||||
EventEmitter,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
import { DocumentListService } from './../services/document-list.service';
|
||||
import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core';
|
||||
import { AlfrescoTranslateService } from 'ng2-alfresco-core';
|
||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||
import { DocumentListService } from './../services/document-list.service';
|
||||
import { ContentActionModel } from './../models/content-action.model';
|
||||
|
||||
declare let dialogPolyfill: any;
|
||||
@ -37,10 +31,10 @@ const ERROR_FOLDER_ALREADY_EXIST = 409;
|
||||
styleUrls: ['./document-menu-action.css'],
|
||||
templateUrl: './document-menu-action.html'
|
||||
})
|
||||
export class DocumentMenuAction implements OnInit {
|
||||
export class DocumentMenuAction {
|
||||
|
||||
@Input()
|
||||
currentFolderPath: string;
|
||||
folderId: string;
|
||||
|
||||
@Output()
|
||||
success = new EventEmitter();
|
||||
@ -66,16 +60,14 @@ export class DocumentMenuAction implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
public createFolder(name: string) {
|
||||
this.cancel();
|
||||
this.documentListService.createFolder(name, this.currentFolderPath)
|
||||
this.documentListService.createFolder(name, this.folderId)
|
||||
.subscribe(
|
||||
res => {
|
||||
let relativeDir = this.currentFolderPath;
|
||||
(res: MinimalNodeEntity) => {
|
||||
this.folderName = '';
|
||||
this.success.emit({value: relativeDir});
|
||||
console.log(res.entry);
|
||||
this.success.emit({node: res.entry});
|
||||
},
|
||||
error => {
|
||||
let errorMessagePlaceholder = this.getErrorMessage(error.response);
|
||||
|
@ -96,15 +96,12 @@ export class DocumentListService {
|
||||
|
||||
/**
|
||||
* Create a new folder in the path.
|
||||
* @param name
|
||||
* @param path
|
||||
* @param name Folder name
|
||||
* @param parentId Parent folder ID
|
||||
* @returns {any}
|
||||
*/
|
||||
createFolder(name: string, path: string): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().nodes.createFolder(name, path))
|
||||
.map(res => {
|
||||
return res;
|
||||
})
|
||||
createFolder(name: string, parentId: string): Observable<MinimalNodeEntity> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().nodes.createFolder(name, '/', parentId))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user