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