Document list uses new alfresco-js-api package

This commit is contained in:
Will Abson
2016-06-06 10:13:28 +01:00
parent abd045dc4f
commit 69c47330f2
4 changed files with 6 additions and 14 deletions

View File

@@ -21,7 +21,7 @@ npm install --save ng2-alfresco-documentlist
Add the following dependency to your index.html:
```html
<script src="node_modules/alfresco-core-rest-api/bundle.js"></script>
<script src="node_modules/alfresco-js-api/bundle.js"></script>
```
Also make sure you include these dependencies in your .html page:

View File

@@ -23,7 +23,7 @@
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<!-- Additional Alfresco libraries -->
<script src="node_modules/alfresco-core-rest-api/bundle.js"></script>
<script src="node_modules/alfresco-js-api/bundle.js"></script>
<script src="systemjs.config.js"></script>
<script>

View File

@@ -57,7 +57,7 @@
"rxjs": "5.0.0-beta.2",
"systemjs": "0.19.26",
"zone.js": "^0.6.12",
"alfresco-core-rest-api": "^0.1.0"
"alfresco-js-api": "^0.1.0"
},
"devDependencies": {
"copyfiles": "^0.2.1",

View File

@@ -48,20 +48,12 @@ export class AlfrescoService {
}
private getAlfrescoClient() {
let defaultClient = new AlfrescoApi.ApiClient();
defaultClient.basePath = this.getBaseUrl();
// Configure HTTP basic authorization: basicAuth
let basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'ROLE_TICKET';
basicAuth.password = this.getAlfrescoTicket();
return defaultClient;
return AlfrescoApi.getClientWithTicket(this.getBaseUrl(), this.getAlfrescoTicket());
}
private getNodesPromise(folder: string) {
let alfrescoClient = this.getAlfrescoClient();
let apiInstance = new AlfrescoApi.NodesApi(alfrescoClient);
let apiInstance = new AlfrescoApi.Core.NodesApi(alfrescoClient);
let nodeId = '-root-';
let opts = {
relativePath: folder,
@@ -72,7 +64,7 @@ export class AlfrescoService {
deleteNode(nodeId: string) {
let client = this.getAlfrescoClient();
let nodesApi = new AlfrescoApi.NodesApi(client);
let nodesApi = new AlfrescoApi.Core.NodesApi(client);
let opts = {};
return Observable.fromPromise(nodesApi.deleteNode(nodeId, opts));
}