New packages org (#2639)

New packages org
This commit is contained in:
Eugenio Romano
2017-11-16 14:12:52 +00:00
committed by GitHub
parent 6a24c6ef75
commit a52bb5600a
1984 changed files with 17179 additions and 40423 deletions

View File

@@ -0,0 +1,70 @@
<div class="adf-setting-container">
<div class="adf-setting-card-padding"></div>
<mat-toolbar color="primary" class="adf-setting-toolbar">
<h3>{{'CORE.HOST_SETTINGS.TITLE' | translate}}</h3>
</mat-toolbar>
<mat-card class="adf-setting-card">
<div *ngIf="providers==='ALL' || providers==='ECM'">
<mat-card-header>
<mat-card-subtitle>{{'CORE.HOST_SETTINGS.CS-HOST' | translate }}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<mat-form-field class="full-width">
<mat-icon class="adf-CORE.HOST_SETTINGS-link-icon" matPrefix>link</mat-icon>
<input matInput
[formControl]="urlFormControlEcm"
data-automation-id="ecmHost"
type="text"
(change)="onChangeECMHost($event)"
tabindex="2"
id="ecmHost"
value="{{ecmHost}}"
placeholder="http(s)://host|ip:port(/path)">
<mat-error *ngIf="urlFormControlEcm.hasError('pattern')">
{{ 'CORE.HOST_SETTINGS.NOT_VALID'| translate }}
</mat-error>
</mat-form-field>
<p>
</mat-card-content>
</div>
<p>
<div *ngIf="providers==='ALL' || providers==='BPM'">
<mat-card-header>
<mat-card-subtitle>{{'CORE.HOST_SETTINGS.BP-HOST' | translate }}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<mat-form-field class="full-width">
<mat-icon class="adf-CORE.HOST_SETTINGS-link-icon" matPrefix>link</mat-icon>
<input matInput
[formControl]="urlFormControlBpm"
data-automation-id="bpmHost"
type="text"
(change)="onChangeBPMHost($event)"
tabindex="2"
id="bpmHost"
value="{{bpmHost}}"
placeholder="http(s)://host|ip:port(/path)">
<mat-error *ngIf="urlFormControlBpm.hasError('pattern')">
{{ 'CORE.HOST_SETTINGS.NOT_VALID'| translate }}
</mat-error>
</mat-form-field>
</mat-card-content>
</div>
<mat-card-actions class="adf-CORE.HOST_SETTINGS-actions">
<button mat-button onclick="window.history.back()" color="primary">
{{'CORE.HOST_SETTINGS.BACK' | translate }}
</button>
<button mat-raised-button (click)="save($event)"
[disabled]="urlFormControlBpm.hasError('pattern') || urlFormControlEcm.hasError('pattern')"
color="primary">
{{'CORE.HOST_SETTINGS.APPLY' | translate }}
</button>
</mat-card-actions>
</mat-card>
<div class="adf-setting-card-padding"></div>
</div>

View File

@@ -0,0 +1,41 @@
@mixin adf-host-settings-theme($theme) {
.adf-host-settings {
display: flex;
height: 100%;
align-items: center;
.adf-setting-toolbar {
width: 600px;
}
.adf-setting-container {
display: table;
border-collapse: collapse;
border-spacing: 0;
}
.full-width {
width: 100%;
}
.adf-setting-card-padding {
width: 50%;
display: table-cell;
vertical-align: middle;
margin: 0;
}
.adf-settings-link-icon {
position: relative;
top: 6px;
margin-right: 10px;
}
.adf-settings-actions {
display: flex;
justify-content: flex-end;
}
}
}

View File

@@ -0,0 +1,104 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { HttpClientModule } from '@angular/common/http';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HostSettingsModule } from './host-settings.module';
import { MaterialModule } from '../material.module';
import { HostSettingsComponent } from './host-settings.component';
describe('HostSettingsComponent', () => {
let fixture: ComponentFixture<HostSettingsComponent>;
let component: HostSettingsComponent;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
FormsModule,
ReactiveFormsModule,
MaterialModule,
HttpClientModule,
HostSettingsModule
]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HostSettingsComponent);
component = fixture.componentInstance;
});
afterEach(() => {
fixture.destroy();
});
it('should emit an error when the ECM url inserted is wrong', (done) => {
fixture.detectChanges();
component.error.subscribe((message: string) => {
expect(message).toEqual('CORE.HOST_SETTING.CS_URL_ERROR');
done();
});
let ecmUrlInput = fixture.nativeElement.querySelector('#ecmHost');
ecmUrlInput.value = 'wrong_url';
let event: any = {};
event.target = ecmUrlInput;
component.onChangeECMHost(event);
});
it('should emit an error when the BPM url inserted is wrong', (done) => {
fixture.detectChanges();
component.error.subscribe((message: string) => {
expect(message).toEqual('CORE.HOST_SETTING.PS_URL_ERROR');
done();
});
let bpmUrlInput: any = fixture.nativeElement.querySelector('#bpmHost');
bpmUrlInput.value = 'wrong_url';
let event: any = {};
event.target = bpmUrlInput;
component.onChangeBPMHost(event);
});
it('should not render the ECM url config if setting provider is BPM', () => {
component.providers = 'BPM';
fixture.detectChanges();
let bpmUrlInput = fixture.nativeElement.querySelector('#bpmHost');
let ecmUrlInput = fixture.nativeElement.querySelector('#ecmHost');
expect(ecmUrlInput).toEqual(null);
expect(bpmUrlInput).toBeDefined();
});
it('should hide the BPM url config if setting provider is ECM', () => {
component.providers = 'ECM';
fixture.detectChanges();
let ecmUrlInput = fixture.nativeElement.querySelector('#ecmHost');
let bpmUrlInput = fixture.nativeElement.querySelector('#bpmHost');
expect(bpmUrlInput).toEqual(null);
expect(ecmUrlInput).toBeDefined();
});
});

View File

@@ -0,0 +1,97 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { LogService } from '../services/log.service';
import { SettingsService } from '../services/settings.service';
import { StorageService } from '../services/storage.service';
import { TranslationService } from '../services/translation.service';
@Component({
selector: 'adf-host-settings',
templateUrl: 'host-settings.component.html',
host: {
'class': 'adf-host-settings'
},
styleUrls: ['host-settings.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class HostSettingsComponent {
HOST_REGEX: string = '^(http|https):\/\/.*[^/]$';
ecmHost: string;
ecmHostTmp: string;
bpmHost: string;
bpmHostTmp: string;
urlFormControlEcm = new FormControl('', [Validators.required, Validators.pattern(this.HOST_REGEX)]);
urlFormControlBpm = new FormControl('', [Validators.required, Validators.pattern(this.HOST_REGEX)]);
@Input()
providers: string = 'ALL';
@Output()
error = new EventEmitter<string>();
constructor(private settingsService: SettingsService,
private storage: StorageService,
private logService: LogService,
private translationService: TranslationService) {
this.ecmHostTmp = this.ecmHost = storage.getItem('ecmHost') || this.settingsService.ecmHost;
this.bpmHostTmp = this.bpmHost = storage.getItem('bpmHost') || this.settingsService.bpmHost;
}
public onChangeECMHost(event: any): void {
let value = (<HTMLInputElement> event.target).value.trim();
if (value && this.isValidUrl(value)) {
this.logService.info(`ECM host: ${value}`);
this.ecmHostTmp = value;
} else {
this.translationService.get('CORE.HOST_SETTING.CS_URL_ERROR').subscribe((message) => {
this.error.emit(message);
});
}
}
public onChangeBPMHost(event: any): void {
let value = (<HTMLInputElement> event.target).value.trim();
if (value && this.isValidUrl(value)) {
this.logService.info(`BPM host: ${value}`);
this.bpmHostTmp = value;
} else {
this.translationService.get('CORE.HOST_SETTING.PS_URL_ERROR').subscribe((message) => {
this.error.emit(message);
});
}
}
public save(event: KeyboardEvent): void {
if (this.bpmHost !== this.bpmHostTmp) {
this.storage.setItem(`bpmHost`, this.bpmHostTmp);
}
if (this.ecmHost !== this.ecmHostTmp) {
this.storage.setItem(`ecmHost`, this.ecmHostTmp);
}
window.location.href = '/';
}
isValidUrl(url: string) {
return /^(http|https):\/\/.*/.test(url);
}
}

View File

@@ -0,0 +1,42 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { MaterialModule } from '../material.module';
import { HostSettingsComponent } from './host-settings.component';
@NgModule({
imports: [
CommonModule,
MaterialModule,
TranslateModule,
FormsModule,
ReactiveFormsModule
],
declarations: [
HostSettingsComponent
],
exports: [
HostSettingsComponent
]
})
export class HostSettingsModule {
}

View File

@@ -0,0 +1,18 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './public-api';

View File

@@ -0,0 +1,20 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './host-settings.component';
export * from './host-settings.module';