mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
commit
23529f2957
@ -33,7 +33,7 @@
|
||||
<li class="mdl-menu__item " (click)="changeLanguage('en')"><span class="flag-icon flag-icon-gb"></span> English</li>
|
||||
<li class="mdl-menu__item" (click)="changeLanguage('gr')"><span class="flag-icon flag-icon-gr"></span> Greek</li>
|
||||
<li class="mdl-menu__item" (click)="changeLanguage('it')"><span class="flag-icon flag-icon-it"></span> Italian</li>
|
||||
<li *ngIf="!isLoggedIn()" class="mdl-menu__item" >More</li>
|
||||
<li *ngIf="!isLoggedIn()" class="mdl-menu__item">More</li>
|
||||
<li *ngIf="!isLoggedIn()" class="mdl-menu__item" [routerLink]="['Login']">Login</li>
|
||||
<li *ngIf="isLoggedIn()" class="mdl-menu__item" (click)="onLogout($event)">Logout</li>
|
||||
</ul>
|
||||
@ -51,6 +51,16 @@
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['Webscript']" (click)="hideDrawer()">Webscript</a>
|
||||
<a class="mdl-navigation__link" href="" [routerLink]="['About']" (click)="hideDrawer()">About</a>
|
||||
</nav>
|
||||
<span class="mdl-layout-title">ECM host</span>
|
||||
<nav class="mdl-navigation">
|
||||
<input type="text" class="mdl-textfield__input" id="ecmHost" data-automation-id="ecmHost"
|
||||
tabindex="1" (change)="onChangeECMHost($event)" value="{{ecmHost}}"/>
|
||||
</nav>
|
||||
<span class="mdl-layout-title">BPM host</span>
|
||||
<nav class="mdl-navigation">
|
||||
<input type="text" class="mdl-textfield__input" id="bpmHost" data-automation-id="bpmHost"
|
||||
tabindex="1" (change)="onChangeBPMHost($event)" value="{{bpmHost}}"/>
|
||||
</nav>
|
||||
</div>
|
||||
<main class="mdl-layout__content">
|
||||
<div class="page-content">
|
||||
|
@ -46,32 +46,50 @@ declare var document: any;
|
||||
pipes: [AlfrescoPipeTranslate]
|
||||
})
|
||||
@RouteConfig([
|
||||
{ path: '/home', name: 'Home', component: FilesComponent },
|
||||
{ path: '/files', name: 'Files', component: FilesComponent },
|
||||
{ path: '/datatable', name: 'DataTable', component: DataTableDemoComponent },
|
||||
{ path: '/', name: 'Login', component: LoginDemoComponent, useAsDefault: true },
|
||||
{ path: '/uploader', name: 'Uploader', component: UploadButtonComponent },
|
||||
{ path: '/login', name: 'Login', component: LoginDemoComponent },
|
||||
{ path: '/search', name: 'Search', component: SearchComponent },
|
||||
{ path: '/tasks', name: 'Tasks', component: TasksDemoComponent },
|
||||
{ path: '/activiti', name: 'Activiti', component: ActivitiDemoComponent },
|
||||
{ path: '/webscript', name: 'Webscript', component: WebscriptComponent },
|
||||
{ path: '/about', name: 'About', component: AboutComponent }
|
||||
{path: '/home', name: 'Home', component: FilesComponent},
|
||||
{path: '/files', name: 'Files', component: FilesComponent},
|
||||
{path: '/datatable', name: 'DataTable', component: DataTableDemoComponent},
|
||||
{path: '/', name: 'Login', component: LoginDemoComponent, useAsDefault: true},
|
||||
{path: '/uploader', name: 'Uploader', component: UploadButtonComponent},
|
||||
{path: '/login', name: 'Login', component: LoginDemoComponent},
|
||||
{path: '/search', name: 'Search', component: SearchComponent},
|
||||
{path: '/tasks', name: 'Tasks', component: TasksDemoComponent},
|
||||
{path: '/activiti', name: 'Activiti', component: ActivitiDemoComponent},
|
||||
{path: '/webscript', name: 'Webscript', component: WebscriptComponent},
|
||||
{path: '/about', name: 'About', component: AboutComponent}
|
||||
])
|
||||
export class AppComponent {
|
||||
translate: AlfrescoTranslationService;
|
||||
searchTerm: string = '';
|
||||
|
||||
ecmHost: string = 'http://localhost:8080';
|
||||
bpmHost: string = 'http://localhost:9999';
|
||||
|
||||
constructor(public auth: AlfrescoAuthenticationService,
|
||||
public router: Router,
|
||||
translate: AlfrescoTranslationService,
|
||||
alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
alfrescoSettingsService.host = 'http://localhost:8080';
|
||||
public alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
this.setEcmHost();
|
||||
this.setBpmHost();
|
||||
|
||||
this.translate = translate;
|
||||
this.translate.addTranslationFolder();
|
||||
}
|
||||
|
||||
public onChangeECMHost(event: KeyboardEvent): void {
|
||||
console.log((<HTMLInputElement>event.target).value);
|
||||
this.ecmHost = (<HTMLInputElement>event.target).value;
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
localStorage.setItem(`ecmHost`, this.ecmHost);
|
||||
}
|
||||
|
||||
public onChangeBPMHost(event: KeyboardEvent): void {
|
||||
console.log((<HTMLInputElement>event.target).value);
|
||||
this.bpmHost = (<HTMLInputElement>event.target).value;
|
||||
this.alfrescoSettingsService.bpmHost = this.bpmHost;
|
||||
localStorage.setItem(`bpmHost`, this.bpmHost);
|
||||
}
|
||||
|
||||
isActive(instruction: any[]): boolean {
|
||||
return this.router.isRouteActive(this.router.generate(instruction));
|
||||
}
|
||||
@ -106,4 +124,22 @@ export class AppComponent {
|
||||
// todo: workaround for drawer closing
|
||||
document.querySelector('.mdl-layout').MaterialLayout.toggleDrawer();
|
||||
}
|
||||
|
||||
private setEcmHost() {
|
||||
if (localStorage.getItem(`ecmHost`)) {
|
||||
this.alfrescoSettingsService.ecmHost = localStorage.getItem(`ecmHost`);
|
||||
this.ecmHost = localStorage.getItem(`ecmHost`);
|
||||
} else {
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
}
|
||||
}
|
||||
|
||||
private setBpmHost() {
|
||||
if (localStorage.getItem(`bpmHost`)) {
|
||||
this.alfrescoSettingsService.bpmHost = localStorage.getItem(`bpmHost`);
|
||||
this.bpmHost = localStorage.getItem(`bpmHost`);
|
||||
} else {
|
||||
this.alfrescoSettingsService.bpmHost = this.bpmHost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,17 +19,16 @@ import { Injectable } from '@angular/core';
|
||||
import { Response, Http, Headers, RequestOptions } from '@angular/http';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { FormValues } from './../components/widgets/widget.model';
|
||||
import { AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
|
||||
@Injectable()
|
||||
export class FormService {
|
||||
|
||||
private basePath: string = 'http://localhost:9999/activiti-app';
|
||||
|
||||
constructor(private http: Http) {
|
||||
constructor(private http: Http, private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
}
|
||||
|
||||
getTasks(): Observable<any> {
|
||||
let url = `${this.basePath}/api/enterprise/tasks/query`;
|
||||
let url = `${this.alfrescoSettingsService.bpmHost}/activiti-app/api/enterprise/tasks/query`;
|
||||
let body = JSON.stringify({});
|
||||
let options = this.getRequestOptions();
|
||||
|
||||
@ -40,7 +39,7 @@ export class FormService {
|
||||
}
|
||||
|
||||
getTask(id: string): Observable<any> {
|
||||
let url = `${this.basePath}/api/enterprise/tasks/${id}`;
|
||||
let url = `${this.alfrescoSettingsService.bpmHost}/activiti-app/api/enterprise/tasks/${id}`;
|
||||
let options = this.getRequestOptions();
|
||||
|
||||
return this.http
|
||||
@ -50,7 +49,7 @@ export class FormService {
|
||||
}
|
||||
|
||||
saveTaskForm(id: string, formValues: FormValues): Observable<Response> {
|
||||
let url = `${this.basePath}/api/enterprise/task-forms/${id}/save-form`;
|
||||
let url = `${this.alfrescoSettingsService.bpmHost}/activiti-app/api/enterprise/task-forms/${id}/save-form`;
|
||||
let body = JSON.stringify({
|
||||
values: formValues
|
||||
});
|
||||
@ -62,8 +61,8 @@ export class FormService {
|
||||
}
|
||||
|
||||
completeTaskForm(id: string, formValues: FormValues, outcome?: string): Observable<Response> {
|
||||
let url = `${this.basePath}/api/enterprise/task-forms/${id}`;
|
||||
let data: any = { values: formValues };
|
||||
let url = `${this.alfrescoSettingsService.bpmHost}/activiti-app/api/enterprise/task-forms/${id}`;
|
||||
let data: any = {values: formValues};
|
||||
if (outcome) {
|
||||
data.outcome = outcome;
|
||||
}
|
||||
@ -76,7 +75,7 @@ export class FormService {
|
||||
}
|
||||
|
||||
getTaskForm(id: string): Observable<any> {
|
||||
let url = `${this.basePath}/api/enterprise/task-forms/${id}`;
|
||||
let url = `${this.alfrescoSettingsService.bpmHost}/activiti-app/api/enterprise/task-forms/${id}`;
|
||||
let options = this.getRequestOptions();
|
||||
|
||||
return this.http
|
||||
@ -95,7 +94,7 @@ export class FormService {
|
||||
|
||||
private getRequestOptions(): RequestOptions {
|
||||
let headers = this.getHeaders();
|
||||
return new RequestOptions({ headers: headers });
|
||||
return new RequestOptions({headers: headers});
|
||||
}
|
||||
|
||||
private toJson(res: Response) {
|
||||
@ -108,7 +107,7 @@ export class FormService {
|
||||
return body.data || [];
|
||||
}
|
||||
|
||||
private handleError (error: any) {
|
||||
private handleError(error: any) {
|
||||
// In a real world app, we might use a remote logging infrastructure
|
||||
// We'd also dig deeper into the error to get a better message
|
||||
let errMsg = (error.message) ? error.message :
|
||||
|
@ -36,7 +36,7 @@ import { HTTP_PROVIDERS, BrowserXhr } from '@angular/http';
|
||||
class MyDemoApp implements OnInit {
|
||||
|
||||
authenticated: boolean;
|
||||
host: string = 'http://127.0.0.1:9999';
|
||||
ecmHost: string = 'http://127.0.0.1:9999';
|
||||
token: string;
|
||||
|
||||
constructor(
|
||||
@ -45,7 +45,7 @@ class MyDemoApp implements OnInit {
|
||||
) {
|
||||
console.log('constructor');
|
||||
|
||||
alfrescoSettingsService.host = this.host;
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
if (this.authService.getTicket()) {
|
||||
this.token = this.authService.getTicket();
|
||||
}
|
||||
@ -60,7 +60,7 @@ class MyDemoApp implements OnInit {
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.host = this.host;
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
AlfrescoSettingsService
|
||||
} from 'ng2-alfresco-core';
|
||||
import { AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
import { ProcessInstance } from '../models/process-instance';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Http, Response, RequestOptions, Headers } from '@angular/http';
|
||||
@ -28,7 +26,6 @@ import 'rxjs/add/operator/catch';
|
||||
@Injectable()
|
||||
export class ActivitiProcessService {
|
||||
|
||||
private processesUrl = 'http://localhost:9999/activiti-app/api/enterprise/process-instances/query';
|
||||
|
||||
constructor(private alfrescoSettingsService: AlfrescoSettingsService, private http: Http) {
|
||||
}
|
||||
@ -38,7 +35,7 @@ export class ActivitiProcessService {
|
||||
headers.append('Content-Type', 'application/json');
|
||||
// headers.append('Authorization', 'Basic ' + btoa('admin@app.activiti.com:admin'));
|
||||
return this.http.post(
|
||||
this.processesUrl,
|
||||
this.alfrescoSettingsService.bpmHost + '/activiti-app/api/enterprise/process-instances/query',
|
||||
'{"page":0,"sort":"created-desc","state":"all"}',
|
||||
new RequestOptions({
|
||||
headers: headers
|
||||
|
@ -81,7 +81,7 @@ describe('ActivitiTaskList', () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
let activitiSerevice = new ActivitiTaskListService(null);
|
||||
let activitiSerevice = new ActivitiTaskListService(null, null);
|
||||
taskList = new ActivitiTaskList(null, null, activitiSerevice);
|
||||
});
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
import { Http, Headers, RequestOptions, Response } from '@angular/http';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { FilterModel } from '../models/filter.model';
|
||||
@ -23,7 +24,7 @@ import { FilterModel } from '../models/filter.model';
|
||||
@Injectable()
|
||||
export class ActivitiTaskListService {
|
||||
|
||||
constructor(private http: Http) {
|
||||
constructor(private http: Http, public alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,7 +57,7 @@ export class ActivitiTaskListService {
|
||||
}
|
||||
|
||||
private callApiTasksFiltered(data: Object) {
|
||||
let url = 'http://localhost:9999/activiti-app/app/rest/filter/tasks';
|
||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + '/rest/filter/tasks';
|
||||
let headers = new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
'Cache-Control': 'no-cache'
|
||||
@ -68,7 +69,7 @@ export class ActivitiTaskListService {
|
||||
}
|
||||
|
||||
private callApiTaskFilters() {
|
||||
let url = 'http://localhost:9999/activiti-app/app/rest/filters/tasks';
|
||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + '/rest/filters/tasks';
|
||||
let headers = new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
'Cache-Control': 'no-cache'
|
||||
|
@ -30,6 +30,10 @@ export class AlfrescoAuthenticationBPM extends AlfrescoAuthenticationBase implem
|
||||
super(alfrescoSettingsService, http);
|
||||
}
|
||||
|
||||
getHost(): string {
|
||||
return this.alfrescoSettingsService.bpmHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a login on behalf of the user and store the ticket returned
|
||||
*
|
||||
@ -68,7 +72,7 @@ export class AlfrescoAuthenticationBPM extends AlfrescoAuthenticationBase implem
|
||||
}
|
||||
|
||||
private apiActivitiLogin(username: string, password: string) {
|
||||
let url = 'http://localhost:9999/activiti-app/app/authentication';
|
||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + '/authentication';
|
||||
let headers = new Headers({
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
});
|
||||
@ -84,10 +88,14 @@ export class AlfrescoAuthenticationBPM extends AlfrescoAuthenticationBase implem
|
||||
}
|
||||
|
||||
private apiActivitiLogout() {
|
||||
let url = 'http://localhost:9999/activiti-app/app/logout';
|
||||
let url = this.alfrescoSettingsService.getBPMApiBaseUrl() + '/logout';
|
||||
return this.http.get(url).toPromise();
|
||||
}
|
||||
|
||||
/**
|
||||
* The method return the ticket stored in the localStorage
|
||||
* @returns ticket
|
||||
*/
|
||||
public getTicket(): string {
|
||||
return localStorage.getItem(`ticket-${this.TYPE}`);
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ export class AlfrescoAuthenticationBase {
|
||||
|
||||
alfrescoApi: any;
|
||||
|
||||
private _authUrl: string = '/alfresco/api/-default-/public/authentication/versions/1';
|
||||
private alfrescoSetting: AlfrescoSettingsService;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param alfrescoSettingsService
|
||||
@ -36,15 +36,11 @@ export class AlfrescoAuthenticationBase {
|
||||
this.alfrescoSetting = alfrescoSettingsService;
|
||||
}
|
||||
|
||||
getBaseUrl(): string {
|
||||
return this.alfrescoSetting.host + this._authUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method save the toke in the localStorage
|
||||
* @param ticket
|
||||
*/
|
||||
public saveTicket(provider:string, ticket: string): void {
|
||||
public saveTicket(provider: string, ticket: string): void {
|
||||
if (ticket) {
|
||||
localStorage.setItem(`ticket-${provider}`, ticket);
|
||||
}
|
||||
@ -53,7 +49,7 @@ export class AlfrescoAuthenticationBase {
|
||||
/**
|
||||
* Remove the login ticket from localStorage
|
||||
*/
|
||||
public removeTicket(provider:string): void {
|
||||
public removeTicket(provider: string): void {
|
||||
localStorage.removeItem(`ticket-${provider}`);
|
||||
}
|
||||
|
||||
|
@ -40,18 +40,18 @@ export class AlfrescoAuthenticationECM extends AlfrescoAuthenticationBase implem
|
||||
|
||||
if (!this.isLoggedIn) {
|
||||
this.alfrescoApi = new AlfrescoApi({
|
||||
host: this.getBaseUrl()
|
||||
host: this.getHost()
|
||||
});
|
||||
} else {
|
||||
this.alfrescoApi = new AlfrescoApi({
|
||||
ticket: this.getTicket(),
|
||||
host: this.getBaseUrl()
|
||||
host: this.getHost()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
getBaseUrl(): string {
|
||||
return this.alfrescoSettingsService.host;
|
||||
getHost(): string {
|
||||
return this.alfrescoSettingsService.ecmHost;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,7 +87,7 @@ export class AlfrescoAuthenticationECM extends AlfrescoAuthenticationBase implem
|
||||
this.alfrescoApi = new AlfrescoApi({
|
||||
username: username,
|
||||
password: password,
|
||||
host: this.getBaseUrl()
|
||||
host: this.getHost()
|
||||
});
|
||||
return this.alfrescoApi.login();
|
||||
}
|
||||
@ -111,7 +111,7 @@ export class AlfrescoAuthenticationECM extends AlfrescoAuthenticationBase implem
|
||||
*
|
||||
* @returns {*|Observable<string>|Observable<any>|Promise<T>}
|
||||
*/
|
||||
private callApiLogout():Promise<any> {
|
||||
private callApiLogout(): Promise<any> {
|
||||
return this.alfrescoApi.logout();
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ describe('AlfrescoContentService', () => {
|
||||
id: nodeId
|
||||
}
|
||||
})).toBe(
|
||||
AlfrescoSettingsService.DEFAULT_HOST_ADDRESS + DEFAULT_CONTEXT_PATH +
|
||||
AlfrescoSettingsService.DEFAULT_ECM_ADDRESS + DEFAULT_CONTEXT_PATH +
|
||||
DEFAULT_BASE_API_PATH + '/nodes/' + nodeId + '/content' +
|
||||
'?attachment=false&alf_ticket=' + authService.getTicket()
|
||||
);
|
||||
@ -61,7 +61,7 @@ describe('AlfrescoContentService', () => {
|
||||
id: nodeId
|
||||
}
|
||||
})).toBe(
|
||||
AlfrescoSettingsService.DEFAULT_HOST_ADDRESS + DEFAULT_CONTEXT_PATH +
|
||||
AlfrescoSettingsService.DEFAULT_ECM_ADDRESS + DEFAULT_CONTEXT_PATH +
|
||||
DEFAULT_BASE_API_PATH + '/nodes/' + nodeId + '/renditions/doclib/content' +
|
||||
'?attachment=false&alf_ticket=' + authService.getTicket()
|
||||
);
|
||||
|
@ -20,33 +20,55 @@ import { Injectable } from '@angular/core';
|
||||
@Injectable()
|
||||
export class AlfrescoSettingsService {
|
||||
|
||||
static DEFAULT_HOST_ADDRESS: string = 'http://127.0.0.1:8080';
|
||||
static DEFAULT_CONTEXT_PATH: string = '/alfresco';
|
||||
static DEFAULT_BASE_API_PATH: string = '/api/-default-/public/alfresco/versions/1';
|
||||
static DEFAULT_ECM_ADDRESS: string = 'http://127.0.0.1:8080';
|
||||
static DEFAULT_BPM_ADDRESS: string = 'http://127.0.0.1:9999';
|
||||
|
||||
private _host: string = AlfrescoSettingsService.DEFAULT_HOST_ADDRESS;
|
||||
private _contextPath = AlfrescoSettingsService.DEFAULT_CONTEXT_PATH;
|
||||
private _apiBasePath: string = AlfrescoSettingsService.DEFAULT_BASE_API_PATH;
|
||||
static DEFAULT_ECM_CONTEXT_PATH: string = '/alfresco';
|
||||
static DEFAULT_BPM_CONTEXT_PATH: string = '/activiti-app';
|
||||
|
||||
static DEFAULT_ECM_BASE_API_PATH: string = '/api/-default-/public/alfresco/versions/1';
|
||||
static DEFAULT_BPM_BASE_API_PATH: string = '/app';
|
||||
|
||||
private _ecmHost: string = AlfrescoSettingsService.DEFAULT_ECM_ADDRESS;
|
||||
private _bpmHost: string = AlfrescoSettingsService.DEFAULT_BPM_ADDRESS;
|
||||
|
||||
private _ecmContextPath = AlfrescoSettingsService.DEFAULT_ECM_CONTEXT_PATH;
|
||||
private _bpmContextPath = AlfrescoSettingsService.DEFAULT_BPM_CONTEXT_PATH;
|
||||
|
||||
private _apiECMBasePath: string = AlfrescoSettingsService.DEFAULT_ECM_BASE_API_PATH;
|
||||
private _apiBPMBasePath: string = AlfrescoSettingsService.DEFAULT_BPM_BASE_API_PATH;
|
||||
|
||||
private providers: string[] = ['ECM', 'BPM'];
|
||||
|
||||
public get host(): string {
|
||||
return this._host;
|
||||
public get ecmHost(): string {
|
||||
return this._ecmHost;
|
||||
}
|
||||
|
||||
public set host(value: string) {
|
||||
this._host = value;
|
||||
public set ecmHost(value: string) {
|
||||
this._ecmHost = value;
|
||||
}
|
||||
|
||||
getApiBaseUrl(): string {
|
||||
return this._host + this._contextPath + this._apiBasePath;
|
||||
public get bpmHost(): string {
|
||||
return this._bpmHost;
|
||||
}
|
||||
|
||||
getProviders(): string [] {
|
||||
public set bpmHost(value: string) {
|
||||
this._bpmHost = value;
|
||||
}
|
||||
|
||||
public getBPMApiBaseUrl(): string {
|
||||
return this._bpmHost + this._bpmContextPath + this._apiBPMBasePath;
|
||||
}
|
||||
|
||||
public getECMApiBaseUrl(): string {
|
||||
return this._ecmHost + this._ecmContextPath + this._apiECMBasePath;
|
||||
}
|
||||
|
||||
public getProviders(): string [] {
|
||||
return this.providers;
|
||||
}
|
||||
|
||||
setProviders(providers: string []) {
|
||||
public setProviders(providers: string []) {
|
||||
this.providers = providers;
|
||||
}
|
||||
}
|
||||
|
@ -26,15 +26,27 @@ describe('AlfrescoSettingsService', () => {
|
||||
service = new AlfrescoSettingsService();
|
||||
});
|
||||
|
||||
it('should have default host', () => {
|
||||
expect(service.host).toBe(AlfrescoSettingsService.DEFAULT_HOST_ADDRESS);
|
||||
it('should have default ECM host', () => {
|
||||
expect(service.ecmHost).toBe(AlfrescoSettingsService.DEFAULT_ECM_ADDRESS);
|
||||
});
|
||||
|
||||
it('should change host', () => {
|
||||
it('should change host ECM', () => {
|
||||
// this test ensures 'host' getter/setter working properly
|
||||
let address = 'http://192.168.0.1';
|
||||
service.host = address;
|
||||
expect(service.host).toBe(address);
|
||||
service.ecmHost = address;
|
||||
expect(service.ecmHost).toBe(address);
|
||||
});
|
||||
|
||||
it('should have default BPM host', () => {
|
||||
expect(service.bpmHost).toBe(AlfrescoSettingsService.DEFAULT_BPM_ADDRESS);
|
||||
});
|
||||
|
||||
it('should change host BPM', () => {
|
||||
// this test ensures 'host' getter/setter working properly
|
||||
let address = 'http://192.168.0.1';
|
||||
service.bpmHost = address;
|
||||
expect(service.bpmHost).toBe(address);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
@ -143,8 +143,8 @@ class DocumentListDemo implements OnInit {
|
||||
currentPath: string = '/';
|
||||
authenticated: boolean;
|
||||
|
||||
host: string = 'http://devproducts-platform.alfresco.me';
|
||||
// host: string = 'http://127.0.0.1:8080';
|
||||
ecmHost: string = 'http://devproducts-platform.alfresco.me';
|
||||
// ecmHost: string = 'http://127.0.0.1:8080';
|
||||
|
||||
token: string;
|
||||
|
||||
@ -154,7 +154,7 @@ class DocumentListDemo implements OnInit {
|
||||
translation: AlfrescoTranslationService,
|
||||
private documentActions: DocumentActionsService) {
|
||||
|
||||
alfrescoSettingsService.host = this.host;
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
if (this.authService.getTicket()) {
|
||||
this.token = this.authService.getTicket();
|
||||
}
|
||||
@ -167,7 +167,7 @@ class DocumentListDemo implements OnInit {
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.host = this.host;
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ import {
|
||||
})
|
||||
export class AppComponent {
|
||||
|
||||
public host: string = 'http://devproducts-platform.alfresco.me';
|
||||
public ecmHost: string = 'http://devproducts-platform.alfresco.me';
|
||||
|
||||
public token: string;
|
||||
|
||||
@ -66,11 +66,11 @@ export class AppComponent {
|
||||
|
||||
constructor(public auth: AlfrescoAuthenticationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
alfrescoSettingsService.host = this.host;
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.host = this.host;
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
}
|
||||
|
||||
mySuccessMethod($event) {
|
||||
|
@ -58,7 +58,7 @@ class SearchDemo implements OnInit {
|
||||
|
||||
public searchTerm: string = 'test';
|
||||
|
||||
public host: string = 'http://devproducts-platform.alfresco.me';
|
||||
public ecmHost: string = 'http://devproducts-platform.alfresco.me';
|
||||
|
||||
token: string;
|
||||
|
||||
@ -66,13 +66,13 @@ class SearchDemo implements OnInit {
|
||||
private alfrescoSettingsService: AlfrescoSettingsService,
|
||||
translation: AlfrescoTranslationService) {
|
||||
|
||||
alfrescoSettingsService.host = this.host;
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
|
||||
translation.addTranslationFolder();
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.host = this.host;
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
|
@ -76,12 +76,12 @@ export class MyDemoApp implements OnInit {
|
||||
|
||||
authenticated: boolean;
|
||||
|
||||
public host: string = 'http://devproducts-platform.alfresco.me';
|
||||
public ecmHost: string = 'http://devproducts-platform.alfresco.me';
|
||||
|
||||
token: string;
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService, private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
alfrescoSettingsService.host = this.host;
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
|
||||
if (this.authService.getTicket()) {
|
||||
this.token = this.authService.getTicket();
|
||||
@ -93,7 +93,7 @@ export class MyDemoApp implements OnInit {
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.host = this.host;
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ export class AlfrescoSettingsServiceMock {
|
||||
|
||||
private _host: string = AlfrescoSettingsServiceMock.DEFAULT_HOST_ADDRESS;
|
||||
|
||||
public get host(): string {
|
||||
public get ecmHost(): string {
|
||||
return this._host;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ class WebscriptDemo implements OnInit {
|
||||
|
||||
authenticated: boolean;
|
||||
|
||||
host: string = 'http://127.0.0.1:8080';
|
||||
ecmHost: string = 'http://127.0.0.1:8080';
|
||||
|
||||
scriptPath: string = 'sample/folder/Company%20Home';
|
||||
|
||||
@ -78,7 +78,7 @@ class WebscriptDemo implements OnInit {
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
|
||||
alfrescoSettingsService.host = this.host;
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
if (this.authService.getTicket()) {
|
||||
this.token = this.authService.getTicket();
|
||||
}
|
||||
@ -89,7 +89,7 @@ class WebscriptDemo implements OnInit {
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.host = this.host;
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ export class AlfrescoSettingsServiceMock {
|
||||
|
||||
private _host: string = AlfrescoSettingsServiceMock.DEFAULT_HOST_ADDRESS;
|
||||
|
||||
public get host(): string {
|
||||
public get ecmHost(): string {
|
||||
return this._host;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user