mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
Use new API client in search
This commit is contained in:
@@ -210,7 +210,7 @@ Make sure your `systemjs.config` has the following configuration:
|
||||
You must also 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>
|
||||
```
|
||||
|
||||
#### Style
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
|
||||
<script src="node_modules/angular2/bundles/router.dev.js"></script>
|
||||
<script src="node_modules/angular2/bundles/http.dev.js"></script>
|
||||
<script src="node_modules/alfresco-core-rest-api/bundle.js"></script>
|
||||
<script src="node_modules/alfresco-js-api/bundle.js"></script>
|
||||
|
||||
<script>
|
||||
System.config({
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
"rxjs": "5.0.0-beta.2",
|
||||
"zone.js": "^0.6.12",
|
||||
"es6-module-loader": "^0.17.8",
|
||||
"alfresco-core-rest-api": "^0.1.0"
|
||||
"alfresco-js-api": "^0.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"angular2": "2.0.0-beta.15"
|
||||
|
||||
@@ -30,9 +30,11 @@ declare let AlfrescoApi: any;
|
||||
export class AlfrescoService {
|
||||
|
||||
private _baseUrlPath: string = '/alfresco/api/-default-/public/alfresco/versions/1';
|
||||
private _alfrescoClient;
|
||||
|
||||
constructor(private http: Http,
|
||||
private settings: AlfrescoSettingsService) {
|
||||
this._alfrescoClient = AlfrescoApi.getClientWithTicket(this.getBaseUrl(), this.getAlfrescoTicket());
|
||||
}
|
||||
|
||||
public getHost(): string {
|
||||
@@ -47,21 +49,8 @@ export class AlfrescoService {
|
||||
return localStorage.getItem('token');
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private getSearchNodesPromise(term: string) {
|
||||
let alfrescoClient = this.getAlfrescoClient();
|
||||
let apiInstance = new AlfrescoApi.SearchApi(alfrescoClient);
|
||||
let apiInstance = new AlfrescoApi.Core.SearchApi(this._alfrescoClient);
|
||||
let nodeId = '-root-';
|
||||
let opts = {
|
||||
include: ['path'],
|
||||
|
||||
Reference in New Issue
Block a user