mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
name unify for setting import
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"zone.js": "^0.6.12",
|
||||
"ng2-activiti-processlist": "file:../",
|
||||
"alfresco-js-api": "^0.1.0",
|
||||
"alfresco-js-api": "^0.2.0",
|
||||
"material-design-icons": "^2.2.3",
|
||||
"material-design-lite": "^1.1.3"
|
||||
},
|
||||
|
@@ -25,27 +25,45 @@ import {
|
||||
AlfrescoSettingsService,
|
||||
ALFRESCO_CORE_PROVIDERS
|
||||
} from 'ng2-alfresco-core';
|
||||
import { HTTP_PROVIDERS, BrowserXhr } from '@angular/http';
|
||||
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
template: `<activiti-processlist></activiti-processlist>`,
|
||||
template: `label for="token"><b>Insert a valid access token / ticket:</b></label><br>
|
||||
<input id="token" type="text" size="48" (change)="updateToken();documentList.reload()" [(ngModel)]="token"><br>
|
||||
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br>
|
||||
<input id="token" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="bpmHost"><br><br>
|
||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||
Authentication failed to ip {{ bpmHost }} with user: admin, admin, you can still try to add a valid token to perform
|
||||
operations.
|
||||
</div>
|
||||
<hr>
|
||||
<label for="token"><b>Insert a scriptPath</b></label><br>
|
||||
<input id="token" type="text" size="48" [(ngModel)]="scriptPath"><br>
|
||||
<label for="token"><b>Insert a contextRoot</b></label><br>
|
||||
<input id="token" type="text" size="48" [(ngModel)]="contextRoot"><br>
|
||||
<label for="token"><b>Insert a servicePath</b></label><br>
|
||||
<input id="token" type="text" size="48" [(ngModel)]="servicePath"><br>
|
||||
<div class="container" *ngIf="authenticated">
|
||||
<activiti-processlist></activiti-processlist>
|
||||
</div>`,
|
||||
providers: [ACTIVITI_PROCESSLIST_PROVIDERS],
|
||||
directives: [ACTIVITI_PROCESSLIST_DIRECTIVES]
|
||||
})
|
||||
class MyDemoApp implements OnInit {
|
||||
|
||||
authenticated: boolean;
|
||||
ecmHost: string = 'http://127.0.0.1:9999';
|
||||
ecmHost: string = 'http://127.0.0.1:9999';
|
||||
token: string;
|
||||
|
||||
constructor(
|
||||
private authService: AlfrescoAuthenticationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService
|
||||
private settingsService: AlfrescoSettingsService
|
||||
) {
|
||||
console.log('constructor');
|
||||
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
settingsService.setProviders('BPM');
|
||||
settingsService.bpmHost = this.bpmHost;
|
||||
|
||||
if (this.authService.getTicket()) {
|
||||
this.token = this.authService.getTicket();
|
||||
}
|
||||
@@ -60,12 +78,12 @@ class MyDemoApp implements OnInit {
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
login() {
|
||||
this.authService.login('admin@app.activiti.com', 'admin', ['BPM']).subscribe(
|
||||
this.authService.login('admin', 'admin').subscribe(
|
||||
token => {
|
||||
console.log(token);
|
||||
this.token = token;
|
||||
@@ -78,18 +96,6 @@ class MyDemoApp implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class CustomBrowserXhr extends BrowserXhr {
|
||||
constructor() {}
|
||||
build(): any {
|
||||
let xhr = super.build();
|
||||
xhr.withCredentials = true;
|
||||
return <any>(xhr);
|
||||
}
|
||||
}
|
||||
|
||||
bootstrap(MyDemoApp, [
|
||||
ALFRESCO_CORE_PROVIDERS,
|
||||
HTTP_PROVIDERS,
|
||||
provide(BrowserXhr, { useClass: CustomBrowserXhr })
|
||||
ALFRESCO_CORE_PROVIDERS
|
||||
]);
|
||||
|
@@ -63,7 +63,8 @@
|
||||
"zone.js": "^0.6.12",
|
||||
"ng2-translate": "2.2.2",
|
||||
"ng2-alfresco-core": "0.2.0",
|
||||
"ng2-alfresco-datatable": "0.2.0"
|
||||
"ng2-alfresco-datatable": "0.2.0",
|
||||
"alfresco-js-api": "^0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"angular-cli": "1.0.0-beta.9",
|
||||
|
@@ -27,7 +27,7 @@ import 'rxjs/add/operator/catch';
|
||||
export class ActivitiProcessService {
|
||||
|
||||
|
||||
constructor(private alfrescoSettingsService: AlfrescoSettingsService, private http: Http) {
|
||||
constructor(private settingsService: AlfrescoSettingsService, private http: Http) {
|
||||
}
|
||||
|
||||
getProcesses(): Observable<ProcessInstance[]> {
|
||||
@@ -35,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.alfrescoSettingsService.bpmHost + '/activiti-app/api/enterprise/process-instances/query',
|
||||
this.settingsService.bpmHost + '/activiti-app/api/enterprise/process-instances/query',
|
||||
'{"page":0,"sort":"created-desc","state":"all"}',
|
||||
new RequestOptions({
|
||||
headers: headers
|
||||
|
@@ -33,11 +33,10 @@
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"zone.js": "0.6.12",
|
||||
"license-check": "1.1.5",
|
||||
|
||||
"material-design-icons": "2.2.3",
|
||||
"material-design-lite": "1.1.3",
|
||||
"ng2-translate": "2.2.2",
|
||||
|
||||
"alfresco-js-api": "^0.2.0",
|
||||
"ng2-alfresco-datatable": "^0.1.12",
|
||||
"ng2-alfresco-core": "^0.1.36"
|
||||
},
|
||||
|
@@ -15,36 +15,60 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { HTTP_PROVIDERS } from '@angular/http';
|
||||
import { ALFRESCO_CORE_PROVIDERS, AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
||||
import { ActivitiTaskList } from 'ng2-activiti-tasklist';
|
||||
import { ObjectDataTableAdapter, ObjectDataColumn } from 'ng2-alfresco-datatable';
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {ALFRESCO_CORE_PROVIDERS, AlfrescoAuthenticationService, AlfrescoSettingsService} from 'ng2-alfresco-core';
|
||||
import {bootstrap} from '@angular/platform-browser-dynamic';
|
||||
import {ActivitiTaskList} from 'ng2-activiti-tasklist';
|
||||
import {ObjectDataTableAdapter, ObjectDataColumn} from 'ng2-alfresco-datatable';
|
||||
import {HTTP_PROVIDERS} from '@angular/http';
|
||||
|
||||
declare let AlfrescoApi: any;
|
||||
|
||||
@Component({
|
||||
selector: 'activiti-tasklist-demo',
|
||||
template: `
|
||||
<activiti-tasklist [data]="data"></activiti-tasklist>
|
||||
`,
|
||||
template: `label for="token"><b>Insert a valid access token / ticket:</b></label><br>
|
||||
<input id="token" type="text" size="48" (change)="updateToken();documentList.reload()" [(ngModel)]="token"><br>
|
||||
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br>
|
||||
<input id="token" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="bpmHost"><br><br>
|
||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||
Authentication failed to ip {{ bpmHost }} with user: admin, admin, you can still try to add a valid token to perform
|
||||
operations.
|
||||
</div>
|
||||
<hr>
|
||||
<label for="token"><b>Insert a scriptPath</b></label><br>
|
||||
<input id="token" type="text" size="48" [(ngModel)]="scriptPath"><br>
|
||||
<label for="token"><b>Insert a contextRoot</b></label><br>
|
||||
<input id="token" type="text" size="48" [(ngModel)]="contextRoot"><br>
|
||||
<label for="token"><b>Insert a servicePath</b></label><br>
|
||||
<input id="token" type="text" size="48" [(ngModel)]="servicePath"><br>
|
||||
<div class="container" *ngIf="authenticated">
|
||||
<activiti-tasklist></activiti-tasklist>
|
||||
</div>`,
|
||||
styles: [
|
||||
':host > .container {padding: 10px}',
|
||||
'.p-10 { padding: 10px; }'
|
||||
],
|
||||
directives: [ActivitiTaskList],
|
||||
providers: [AlfrescoAuthenticationService]
|
||||
directives: [ActivitiTaskList]
|
||||
})
|
||||
class ActivitiTaskListDemo implements OnInit {
|
||||
|
||||
bpmHost: string = 'http://127.0.0.1:9999';
|
||||
|
||||
token: string;
|
||||
|
||||
data: ObjectDataTableAdapter;
|
||||
|
||||
constructor(private setting: AlfrescoSettingsService) {
|
||||
this.setting.setProviders(['BPM']);
|
||||
authenticated: boolean;
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private settingsService: AlfrescoSettingsService) {
|
||||
this.settingsService.setProviders('BPM');
|
||||
this.data = new ObjectDataTableAdapter([], []);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.login();
|
||||
|
||||
let schema = [
|
||||
{type: 'text', key: 'id', title: 'Id'},
|
||||
{type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true},
|
||||
@@ -56,9 +80,21 @@ class ActivitiTaskListDemo implements OnInit {
|
||||
this.data.setColumns(columns);
|
||||
}
|
||||
|
||||
login() {
|
||||
this.authService.login('admin', 'admin').subscribe(
|
||||
token => {
|
||||
console.log(token);
|
||||
this.token = token;
|
||||
this.authenticated = true;
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
this.authenticated = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bootstrap(ActivitiTaskListDemo, [
|
||||
HTTP_PROVIDERS,
|
||||
ALFRESCO_CORE_PROVIDERS]
|
||||
HTTP_PROVIDERS,
|
||||
ALFRESCO_CORE_PROVIDERS]
|
||||
);
|
||||
|
@@ -68,9 +68,9 @@
|
||||
"zone.js": "0.6.12",
|
||||
"ng2-translate": "2.2.2",
|
||||
"ng2-alfresco-core": "0.2.0",
|
||||
"ng2-alfresco-datatable": "0.2.0",
|
||||
"ng2-alfresco-datatable": "0.2.0",
|
||||
"ng2-activiti-form": "0.2.0",
|
||||
"alfresco-js-api": "0.2.0"
|
||||
"alfresco-js-api": "^0.2.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"material-design-icons": "^2.2.3",
|
||||
|
@@ -149,11 +149,11 @@ class DocumentListDemo implements OnInit {
|
||||
|
||||
constructor(
|
||||
private authService: AlfrescoAuthenticationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService,
|
||||
private settingsService: AlfrescoSettingsService,
|
||||
translation: AlfrescoTranslationService,
|
||||
private documentActions: DocumentActionsService) {
|
||||
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
settingsService.ecmHost = this.ecmHost;
|
||||
if (this.authService.getTicket()) {
|
||||
this.token = this.authService.getTicket();
|
||||
}
|
||||
@@ -166,7 +166,7 @@ class DocumentListDemo implements OnInit {
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
|
@@ -65,12 +65,12 @@ export class AppComponent {
|
||||
public providers: string = 'ECM';
|
||||
|
||||
constructor(public auth: AlfrescoAuthenticationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
private settingsService: AlfrescoSettingsService) {
|
||||
settingsService.ecmHost = this.ecmHost;
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
}
|
||||
|
||||
mySuccessMethod($event) {
|
||||
|
@@ -69,12 +69,12 @@ export class AlfrescoLoginComponent {
|
||||
* Constructor
|
||||
* @param _fb
|
||||
* @param authService
|
||||
* @param settingService
|
||||
* @param settingsService
|
||||
* @param translate
|
||||
*/
|
||||
constructor(private _fb: FormBuilder,
|
||||
public authService: AlfrescoAuthenticationService,
|
||||
public settingService: AlfrescoSettingsService,
|
||||
public settingsService: AlfrescoSettingsService,
|
||||
private translate: AlfrescoTranslationService) {
|
||||
|
||||
this.formError = {
|
||||
@@ -113,7 +113,7 @@ export class AlfrescoLoginComponent {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
this.settingService.setProviders(this.providers);
|
||||
this.settingsService.setProviders(this.providers);
|
||||
|
||||
this.authService.login(value.username, value.password)
|
||||
.subscribe(
|
||||
|
@@ -63,16 +63,16 @@ class SearchDemo implements OnInit {
|
||||
token: string;
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService,
|
||||
private settingsService: AlfrescoSettingsService,
|
||||
translation: AlfrescoTranslationService) {
|
||||
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
settingsService.ecmHost = this.ecmHost;
|
||||
|
||||
translation.addTranslationFolder();
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
|
@@ -80,8 +80,8 @@ export class MyDemoApp implements OnInit {
|
||||
|
||||
token: string;
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService, private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) {
|
||||
settingsService.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.ecmHost = this.ecmHost;
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
|
@@ -57,9 +57,9 @@ class MyDemoApp {
|
||||
token: string;
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
private settingsService: AlfrescoSettingsService) {
|
||||
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
settingsService.ecmHost = this.ecmHost;
|
||||
if (this.authService.getTicket()) {
|
||||
this.token = this.authService.getTicket();
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class MyDemoApp {
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
|
@@ -34,9 +34,9 @@ import { WEBSCRIPTCOMPONENT } from 'ng2-alfresco-webscript';
|
||||
<label for="token"><b>Insert a valid access token / ticket:</b></label><br>
|
||||
<input id="token" type="text" size="48" (change)="updateToken();documentList.reload()" [(ngModel)]="token"><br>
|
||||
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br>
|
||||
<input id="token" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="host"><br><br>
|
||||
<input id="token" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="ecmHost"><br><br>
|
||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid token to perform
|
||||
Authentication failed to ip {{ ecmHost }} with user: admin, admin, you can still try to add a valid token to perform
|
||||
operations.
|
||||
</div>
|
||||
<hr>
|
||||
@@ -76,10 +76,10 @@ class WebscriptDemo implements OnInit {
|
||||
token: string;
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
private settingsService: AlfrescoSettingsService) {
|
||||
|
||||
alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
alfrescoSettingsService.setProviders('ECM');
|
||||
settingsService.ecmHost = this.ecmHost;
|
||||
settingsService.setProviders('ECM');
|
||||
|
||||
if (this.authService.getTicket()) {
|
||||
this.token = this.authService.getTicket();
|
||||
@@ -91,7 +91,7 @@ class WebscriptDemo implements OnInit {
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.ecmHost = this.ecmHost;
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user