Document list uses new alfresco-js-api package

This commit is contained in:
Will Abson
2016-06-06 10:32:11 +01:00
parent abd045dc4f
commit 69c47330f2
4 changed files with 6 additions and 14 deletions
@@ -21,7 +21,7 @@ npm install --save ng2-alfresco-documentlist
Add the following dependency to your index.html: Add the following dependency to your index.html:
```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: Also make sure you include these dependencies in your .html page:
@@ -23,7 +23,7 @@
<script src="node_modules/angular2/bundles/http.dev.js"></script> <script src="node_modules/angular2/bundles/http.dev.js"></script>
<!-- Additional Alfresco libraries --> <!-- 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 src="systemjs.config.js"></script>
<script> <script>
@@ -57,7 +57,7 @@
"rxjs": "5.0.0-beta.2", "rxjs": "5.0.0-beta.2",
"systemjs": "0.19.26", "systemjs": "0.19.26",
"zone.js": "^0.6.12", "zone.js": "^0.6.12",
"alfresco-core-rest-api": "^0.1.0" "alfresco-js-api": "^0.1.0"
}, },
"devDependencies": { "devDependencies": {
"copyfiles": "^0.2.1", "copyfiles": "^0.2.1",
@@ -48,20 +48,12 @@ export class AlfrescoService {
} }
private getAlfrescoClient() { private getAlfrescoClient() {
let defaultClient = new AlfrescoApi.ApiClient(); return AlfrescoApi.getClientWithTicket(this.getBaseUrl(), this.getAlfrescoTicket());
defaultClient.basePath = this.getBaseUrl();
// Configure HTTP basic authorization: basicAuth
let basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'ROLE_TICKET';
basicAuth.password = this.getAlfrescoTicket();
return defaultClient;
} }
private getNodesPromise(folder: string) { private getNodesPromise(folder: string) {
let alfrescoClient = this.getAlfrescoClient(); let alfrescoClient = this.getAlfrescoClient();
let apiInstance = new AlfrescoApi.NodesApi(alfrescoClient); let apiInstance = new AlfrescoApi.Core.NodesApi(alfrescoClient);
let nodeId = '-root-'; let nodeId = '-root-';
let opts = { let opts = {
relativePath: folder, relativePath: folder,
@@ -72,7 +64,7 @@ export class AlfrescoService {
deleteNode(nodeId: string) { deleteNode(nodeId: string) {
let client = this.getAlfrescoClient(); let client = this.getAlfrescoClient();
let nodesApi = new AlfrescoApi.NodesApi(client); let nodesApi = new AlfrescoApi.Core.NodesApi(client);
let opts = {}; let opts = {};
return Observable.fromPromise(nodesApi.deleteNode(nodeId, opts)); return Observable.fromPromise(nodesApi.deleteNode(nodeId, opts));
} }