mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Configurable host address for document list
- allow application define host address for AlfrescoService
This commit is contained in:
parent
f39653bf6f
commit
fb208c6007
@ -6,6 +6,7 @@ import {AuthRouterOutlet} from "./components/AuthRouterOutlet";
|
|||||||
import {HomeView} from "./components/home.view";
|
import {HomeView} from "./components/home.view";
|
||||||
import {Page1View} from "./components/page1.view";
|
import {Page1View} from "./components/page1.view";
|
||||||
import {Page2View} from "./components/page2.view";
|
import {Page2View} from "./components/page2.view";
|
||||||
|
import {AlfrescoService} from 'ng2-alfresco/components';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
@ -22,8 +23,11 @@ export class AppComponent {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public auth: Authentication,
|
public auth: Authentication,
|
||||||
public router: Router
|
public router: Router,
|
||||||
){}
|
alfrescoService: AlfrescoService
|
||||||
|
){
|
||||||
|
alfrescoService.host = 'http://192.168.99.100:8080';
|
||||||
|
}
|
||||||
|
|
||||||
isActive(instruction: any[]): boolean {
|
isActive(instruction: any[]): boolean {
|
||||||
return this.router.isRouteActive(this.router.generate(instruction));
|
return this.router.isRouteActive(this.router.generate(instruction));
|
||||||
|
1
demo-shell-ng2/ng2-alfresco/components.d.ts
vendored
1
demo-shell-ng2/ng2-alfresco/components.d.ts
vendored
@ -3,6 +3,7 @@ import { DocumentList } from "./src/document-list.component";
|
|||||||
import { AlfrescoService } from "./src/alfresco.service";
|
import { AlfrescoService } from "./src/alfresco.service";
|
||||||
export * from './src/HelloWorld';
|
export * from './src/HelloWorld';
|
||||||
export * from './src/document-list.component';
|
export * from './src/document-list.component';
|
||||||
|
export * from './src/alfresco.service';
|
||||||
declare var _default: {
|
declare var _default: {
|
||||||
directives: (typeof HelloWorld | typeof DocumentList)[];
|
directives: (typeof HelloWorld | typeof DocumentList)[];
|
||||||
providers: typeof AlfrescoService[];
|
providers: typeof AlfrescoService[];
|
||||||
|
@ -4,6 +4,7 @@ import { AlfrescoService } from "./src/alfresco.service";
|
|||||||
|
|
||||||
export * from './src/HelloWorld';
|
export * from './src/HelloWorld';
|
||||||
export * from './src/document-list.component';
|
export * from './src/document-list.component';
|
||||||
|
export * from './src/alfresco.service';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
directives: [HelloWorld, DocumentList],
|
directives: [HelloWorld, DocumentList],
|
||||||
|
@ -6,7 +6,9 @@ export declare class AlfrescoService {
|
|||||||
private http;
|
private http;
|
||||||
constructor(http: Http);
|
constructor(http: Http);
|
||||||
private _host;
|
private _host;
|
||||||
private _baseUrl;
|
private _baseUrlPath;
|
||||||
|
host: string;
|
||||||
|
private getBaseUrl();
|
||||||
getFolder(folder: string): Observable<FolderEntity>;
|
getFolder(folder: string): Observable<FolderEntity>;
|
||||||
getDocumentThumbnailUrl(document: DocumentEntity): string;
|
getDocumentThumbnailUrl(document: DocumentEntity): string;
|
||||||
getContentUrl(document: DocumentEntity): string;
|
getContentUrl(document: DocumentEntity): string;
|
||||||
|
@ -8,8 +8,20 @@ import {DocumentEntity} from "./core/entities/document.entity";
|
|||||||
export class AlfrescoService {
|
export class AlfrescoService {
|
||||||
constructor(private http: Http) {}
|
constructor(private http: Http) {}
|
||||||
|
|
||||||
private _host: string = 'http://192.168.99.100:8080';
|
private _host: string = 'http://127.0.0.1:8080';
|
||||||
private _baseUrl: string = this._host + '/alfresco/service/slingshot/doclib/doclist/all/site/';
|
private _baseUrlPath: string = '/alfresco/service/slingshot/doclib/doclist/all/site/';
|
||||||
|
|
||||||
|
public get host():string {
|
||||||
|
return this._host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set host(value:string) {
|
||||||
|
this._host = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getBaseUrl():string {
|
||||||
|
return this.host + this._baseUrlPath;
|
||||||
|
}
|
||||||
|
|
||||||
getFolder(folder: string) {
|
getFolder(folder: string) {
|
||||||
let headers = new Headers({
|
let headers = new Headers({
|
||||||
@ -18,7 +30,7 @@ export class AlfrescoService {
|
|||||||
});
|
});
|
||||||
let options = new RequestOptions({ headers: headers });
|
let options = new RequestOptions({ headers: headers });
|
||||||
return this.http
|
return this.http
|
||||||
.get(this._baseUrl + folder, options)
|
.get(this.getBaseUrl() + folder, options)
|
||||||
.map(res => <FolderEntity> res.json())
|
.map(res => <FolderEntity> res.json())
|
||||||
.do(data => console.log(data)) // eyeball results in the console
|
.do(data => console.log(data)) // eyeball results in the console
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user