[ADF-2726] fixed save content for external repository (#3341)

* [ADF-2726] start fixing the show of files loaded from CS

* [ADF-2726] start fixing the show of files loaded from CS

* [ADF-2726] fixed save content for external repository|

* [ADF-2726] fixed save content for external repository|

* [ADF-2726] reeanabled and fixed the tests

* [ADF-2726] reeanabled and fixed the tests

* [ADF-2726] added tests for attach file widget and activiti alfresco service

* [ADF-2726] added tests for attach file widget and activiti alfresco service

* [ADF-2726] fixed test
This commit is contained in:
Vito
2018-05-21 12:14:11 +01:00
committed by Eugenio Romano
parent b599e3a41a
commit 1c7f267c63
9 changed files with 344 additions and 29 deletions

View File

@@ -18,7 +18,7 @@
import { AlfrescoApiService } from '../../services/alfresco-api.service';
import { LogService } from '../../services/log.service';
import { Injectable } from '@angular/core';
import { AlfrescoApi, MinimalNodeEntryEntity } from 'alfresco-js-api';
import { AlfrescoApi, MinimalNodeEntryEntity, RelatedContentRepresentation } from 'alfresco-js-api';
import { Observable } from 'rxjs/Observable';
import { ExternalContent } from '../components/widgets/core/external-content';
import { ExternalContentLink } from '../components/widgets/core/external-content-link';
@@ -85,9 +85,11 @@ export class ActivitiContentService {
applyAlfrescoNode(node: MinimalNodeEntryEntity, siteId: string, accountId: string) {
let apiService: AlfrescoApi = this.apiService.getInstance();
let params: any = {
const currentSideId = siteId ? siteId : this.getSiteNameFromNodePath(node);
const params: RelatedContentRepresentation = {
source: accountId,
sourceId: node.id + ';1.0@' + siteId,
mimeType: node.content.mimeType,
sourceId: node.id + ';' + node.properties['cm:versionLabel'] + '@' + currentSideId,
name: node.name,
link: false
};
@@ -97,6 +99,18 @@ export class ActivitiContentService {
.catch(err => this.handleError(err));
}
private getSiteNameFromNodePath(node: MinimalNodeEntryEntity): string {
let siteName = '';
if (node.path) {
const foundNode = node.path
.elements.find((pathNode: MinimalNodeEntryEntity) =>
pathNode.nodeType === 'st:site' &&
pathNode.name !== 'Sites');
siteName = foundNode ? foundNode.name : '';
}
return siteName.toLocaleLowerCase();
}
toJson(res: any) {
if (res) {
return res || {};