mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
setting component (#2571)
This commit is contained in:
parent
a03145f765
commit
24b590ca16
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -33,15 +33,8 @@
|
||||
"START-PROCESS": "Prozess starten",
|
||||
"AUDIT-LOG": "Audit-Protokoll verarbeiten"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "Einstellungen",
|
||||
"CS-HOST": "Konfiguration der Host-URL für Content Services",
|
||||
"BP-HOST": "Konfiguration der Host-URL für Process Services",
|
||||
"BACK": "Zurück",
|
||||
"APPLY": "ANWENDEN"
|
||||
},
|
||||
"FORM-LIST": {
|
||||
"STORE": "Speichern",
|
||||
"RESTORE": "Wiederherstellen"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,14 +72,6 @@
|
||||
"START-PROCESS": "Start process",
|
||||
"AUDIT-LOG": "Process Audit log"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "Settings",
|
||||
"CS-HOST": "Content Services host URL configuration",
|
||||
"BP-HOST": "Process Services host URL configuration",
|
||||
"BACK": "Back",
|
||||
"APPLY": "APPLY",
|
||||
"NOT_VALID": "Host not valid! http(s)://host|ip:port(/path)"
|
||||
},
|
||||
"FORM-LIST": {
|
||||
"STORE": "Store",
|
||||
"RESTORE": "Restore"
|
||||
|
@ -32,16 +32,9 @@
|
||||
"START-TASK": "Iniciar tarea",
|
||||
"START-PROCESS": "Iniciar proceso",
|
||||
"AUDIT-LOG": "Procesar registro de auditorías"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "Configuración",
|
||||
"CS-HOST": "Configuración de URL de host de Content Services",
|
||||
"BP-HOST": "Configuración de URL de host de Process Services",
|
||||
"BACK": "Volver",
|
||||
"APPLY": "APLICAR"
|
||||
},
|
||||
}
|
||||
"FORM-LIST": {
|
||||
"STORE": "Almacenar",
|
||||
"RESTORE": "Restaurar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,16 +32,9 @@
|
||||
"START-TASK": "Démarrer la tâche",
|
||||
"START-PROCESS": "Démarrer le processus",
|
||||
"AUDIT-LOG": "Journal d'audit des processus"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "Paramètres",
|
||||
"CS-HOST": "Configuration de l'URL de l'hôte de Content Services",
|
||||
"BP-HOST": "Configuration de l'URL de l'hôte de Process Services",
|
||||
"BACK": "Retour",
|
||||
"APPLY": "APPLIQUER"
|
||||
},
|
||||
}
|
||||
"FORM-LIST": {
|
||||
"STORE": "Stocker",
|
||||
"RESTORE": "Restaurer"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,15 +33,8 @@
|
||||
"START-PROCESS": "Avvia processo",
|
||||
"AUDIT-LOG": "Log di audit processo"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "Impostazioni",
|
||||
"CS-HOST": "Configurazione URL host Content Services",
|
||||
"BP-HOST": "Configurazione URL host Process Services",
|
||||
"BACK": "Indietro",
|
||||
"APPLY": "APPLICA"
|
||||
},
|
||||
"FORM-LIST": {
|
||||
"STORE": "Memorizza",
|
||||
"RESTORE": "Ripristina"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,15 +33,8 @@
|
||||
"START-PROCESS": "プロセスの開始",
|
||||
"AUDIT-LOG": "プロセスの監査ログ"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "設定",
|
||||
"CS-HOST": "Content Services ホストの URL の設定",
|
||||
"BP-HOST": "Process Services ホストの URL の設定",
|
||||
"BACK": "戻る",
|
||||
"APPLY": "適用"
|
||||
},
|
||||
"FORM-LIST": {
|
||||
"STORE": "保存",
|
||||
"RESTORE": "復元"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,15 +33,8 @@
|
||||
"START-PROCESS": "Start prosess",
|
||||
"AUDIT-LOG": "Behandle revisjonslogg"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "Innstillinger",
|
||||
"CS-HOST": "Innholdstjenestevert URL-konfigurasjon",
|
||||
"BP-HOST": "Prosesstjenestevert URL-konfigurasjon",
|
||||
"BACK": "Tilbake",
|
||||
"APPLY": "BRUK"
|
||||
},
|
||||
"FORM-LIST": {
|
||||
"STORE": "Lagre",
|
||||
"RESTORE": "Gjenopprett"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,15 +33,8 @@
|
||||
"START-PROCESS": "Proces starten",
|
||||
"AUDIT-LOG": "Auditlog van proces"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "Instellingen",
|
||||
"CS-HOST": "URL-configuratie Content Services-host",
|
||||
"BP-HOST": "URL-configuratie Process Services-host",
|
||||
"BACK": "Terug",
|
||||
"APPLY": "TOEPASSEN"
|
||||
},
|
||||
"FORM-LIST": {
|
||||
"STORE": "Opslaan",
|
||||
"RESTORE": "Herstellen"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,15 +33,8 @@
|
||||
"START-PROCESS": "Iniciar processo",
|
||||
"AUDIT-LOG": "Log de auditoria de processo"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "Configurações",
|
||||
"CS-HOST": "Configuração de URL de host do Content Services",
|
||||
"BP-HOST": "Configuração de URL de host do Process Services",
|
||||
"BACK": "Voltar",
|
||||
"APPLY": "APLICAR"
|
||||
},
|
||||
"FORM-LIST": {
|
||||
"STORE": "Armazenar",
|
||||
"RESTORE": "Restaurar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,15 +33,8 @@
|
||||
"START-PROCESS": "Начать процесс",
|
||||
"AUDIT-LOG": "Журнал аудита процессов"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "Параметры",
|
||||
"CS-HOST": "Конфигурация URL-адреса хоста Content Services",
|
||||
"BP-HOST": "Конфигурация URL-адреса хоста Process Services",
|
||||
"BACK": "Назад",
|
||||
"APPLY": "ПРИМЕНИТЬ"
|
||||
},
|
||||
"FORM-LIST": {
|
||||
"STORE": "Хранилище",
|
||||
"RESTORE": "Восстановить"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,15 +33,8 @@
|
||||
"START-PROCESS": "启动流程",
|
||||
"AUDIT-LOG": "流程审计记录"
|
||||
},
|
||||
"SETTINGS": {
|
||||
"TITLE": "设置",
|
||||
"CS-HOST": "Content Services 主机 URL 配置",
|
||||
"BP-HOST": "流程服务主机 URL 配置",
|
||||
"BACK": "返回",
|
||||
"APPLY": "应用"
|
||||
},
|
||||
"FORM-LIST": {
|
||||
"STORE": "存储",
|
||||
"RESTORE": "恢复"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +1 @@
|
||||
<div class="adf-setting-container">
|
||||
<div class="adf-setting-card-padding"></div>
|
||||
<mat-toolbar color="primary" >
|
||||
<h3>{{'SETTINGS.TITLE' | translate}}</h3>
|
||||
</mat-toolbar>
|
||||
|
||||
<mat-card class="adf-setting-card">
|
||||
<mat-card-content>
|
||||
|
||||
<mat-card-subtitle>{{'SETTINGS.CS-HOST' | translate }}</mat-card-subtitle>
|
||||
|
||||
<mat-form-field class="full-width">
|
||||
<mat-icon class="adf-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')">
|
||||
{{ 'SETTINGS.NOT_VALID'| translate }}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<p>
|
||||
<p>
|
||||
<mat-card-subtitle>{{'SETTINGS.BP-HOST' | translate }}</mat-card-subtitle>
|
||||
|
||||
<mat-form-field class="full-width">
|
||||
<mat-icon class="adf-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')">
|
||||
{{ 'SETTINGS.NOT_VALID'| translate }}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
</mat-card-content>
|
||||
<mat-card-actions class="adf-settings-actions">
|
||||
|
||||
<button mat-button onclick="window.history.back()" color="primary">
|
||||
{{'SETTINGS.BACK' | translate }}
|
||||
</button>
|
||||
|
||||
<button mat-raised-button (click)="save($event)" [disabled]="urlFormControlBpm.hasError('pattern') || urlFormControlEcm.hasError('pattern')" color="primary">
|
||||
{{'SETTINGS.APPLY' | translate }}
|
||||
</button>
|
||||
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
<div class="adf-setting-card-padding"></div>
|
||||
</div>
|
||||
<adf-host-settings (error)="onError($event)"></adf-host-settings>
|
||||
|
@ -1,37 +0,0 @@
|
||||
.adf-app-settings {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
|
||||
.adf-setting-container {
|
||||
display: table;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
.adf-setting-card {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
@ -15,69 +15,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { FormControl, Validators } from '@angular/forms';
|
||||
import { AlfrescoSettingsService, LogService, StorageService } from 'ng2-alfresco-core';
|
||||
import { Component } from '@angular/core';
|
||||
import { LogService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings',
|
||||
templateUrl: 'settings.component.html',
|
||||
host: {
|
||||
'class': 'adf-app-settings'
|
||||
},
|
||||
styleUrls: ['settings.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
templateUrl: 'settings.component.html'
|
||||
})
|
||||
export class SettingsComponent {
|
||||
|
||||
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)]);
|
||||
|
||||
constructor(private settingsService: AlfrescoSettingsService,
|
||||
private storage: StorageService,
|
||||
private logService: LogService) {
|
||||
this.ecmHostTmp = this.ecmHost = storage.getItem('ecmHost') || this.settingsService.ecmHost;
|
||||
this.bpmHostTmp = this.bpmHost = storage.getItem('bpmHost') || this.settingsService.bpmHost;
|
||||
}
|
||||
|
||||
public onChangeECMHost(event: KeyboardEvent): void {
|
||||
let value = (<HTMLInputElement> event.target).value.trim();
|
||||
if (value && this.isValidUrl(value)) {
|
||||
this.logService.info(`ECM host: ${value}`);
|
||||
this.ecmHostTmp = value;
|
||||
} else {
|
||||
console.error('Ecm address does not match the pattern');
|
||||
}
|
||||
}
|
||||
|
||||
public onChangeBPMHost(event: KeyboardEvent): void {
|
||||
let value = (<HTMLInputElement> event.target).value.trim();
|
||||
if (value && this.isValidUrl(value)) {
|
||||
this.logService.info(`BPM host: ${value}`);
|
||||
this.bpmHostTmp = value;
|
||||
} else {
|
||||
console.error('Bpm address does not match the pattern');
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
constructor(public logService: LogService){
|
||||
}
|
||||
|
||||
onError(error: string){
|
||||
this.logService.log(error)
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
"no-bitwise": true,
|
||||
"no-console": [
|
||||
true,
|
||||
"log",
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
@ -99,7 +100,7 @@
|
||||
],
|
||||
|
||||
"directive-selector": [true, "attribute", "app", "camelCase"],
|
||||
"component-selector": [true, "element", "app", "kebab-case"],
|
||||
"component-selector": [true, "element", "adf", "kebab-case"],
|
||||
"use-input-property-decorator": true,
|
||||
"use-output-property-decorator": true,
|
||||
"use-host-property-decorator": true,
|
||||
|
@ -323,6 +323,7 @@ for more information about installing and using the source code.
|
||||
- [Toolbar title component](toolbar-title.component.md)
|
||||
- [Toolbar component](toolbar.component.md)
|
||||
- [Card view component](card-view.component.md)
|
||||
- [Host settings component](host-settings.component.md)
|
||||
- [*Infinite pagination component](../ng2-components/ng2-alfresco-core/src/components/pagination/infinite-pagination.component.ts)
|
||||
|
||||
### Directives
|
||||
|
BIN
docs/docassets/images/host-settings-component.png
Normal file
BIN
docs/docassets/images/host-settings-component.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 65 KiB |
27
docs/host-settings.component.md
Normal file
27
docs/host-settings.component.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Host settings component
|
||||
|
||||
This component is a form that allow you to validate and set the url of your content service and process service saving
|
||||
it in the user local storage
|
||||
|
||||

|
||||
|
||||
## Basic Usage
|
||||
|
||||
```html
|
||||
<adf-host-settings>
|
||||
</adf-breadcrumb>
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Default Value | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| providers | string | ALL | Possible valid values are ECM, BPM or ALL. It indicate which URL configurations show |
|
||||
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Returned Type | Description |
|
||||
| --- | --- | --- |
|
||||
| error | string | emitted when the url inserted is wrong |
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -130,6 +130,7 @@ import { UploadDirective } from './src/directives/upload.directive';
|
||||
|
||||
import { InfinitePaginationComponent } from './src/components/pagination/infinite-pagination.component';
|
||||
import { PaginationComponent } from './src/components/pagination/pagination.component';
|
||||
import { HostSettingsComponent } from './src/components/settings/host-settings.component';
|
||||
import { FileSizePipe } from './src/pipes/file-size.pipe';
|
||||
import { MimeTypeIconPipe } from './src/pipes/mime-type-icon.pipe';
|
||||
import { NodeNameTooltipPipe } from './src/pipes/node-name-tooltip.pipe';
|
||||
@ -139,6 +140,7 @@ import { InitialUsernamePipe } from './src/pipes/user-initial.pipe';
|
||||
|
||||
export { InfinitePaginationComponent } from './src/components/pagination/infinite-pagination.component';
|
||||
export { PaginationComponent } from './src/components/pagination/pagination.component';
|
||||
export { HostSettingsComponent } from './src/components/settings/host-settings.component';
|
||||
export { ContextMenuModule } from './src/components/context-menu/context-menu.module';
|
||||
export { CardViewModule } from './src/components/view/card-view.module';
|
||||
export { CollapsableModule } from './src/components/collapsable/collapsable.module';
|
||||
@ -278,6 +280,7 @@ export function createTranslateLoader(http: Http, logService: LogService) {
|
||||
InfoDrawerButtonsDirective,
|
||||
InfoDrawerContentDirective,
|
||||
LanguageMenuComponent,
|
||||
HostSettingsComponent,
|
||||
CreateFolderDialogComponent,
|
||||
DownloadZipDialogComponent,
|
||||
InfinitePaginationComponent,
|
||||
@ -316,6 +319,7 @@ export function createTranslateLoader(http: Http, logService: LogService) {
|
||||
NodeFavoriteDirective,
|
||||
NodeDeleteDirective,
|
||||
HighlightDirective,
|
||||
HostSettingsComponent,
|
||||
DataColumnComponent,
|
||||
DataColumnListComponent,
|
||||
CreateFolderDialogComponent,
|
||||
|
@ -0,0 +1,67 @@
|
||||
<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">
|
||||
<mat-card-content>
|
||||
|
||||
<div *ngIf="providers==='ALL' || providers==='ECM'">
|
||||
<mat-card-subtitle>{{'CORE.HOST_SETTINGS.CS-HOST' | translate }}</mat-card-subtitle>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
<p>
|
||||
<div *ngIf="providers==='ALL' || providers==='BPM'">
|
||||
|
||||
<mat-card-subtitle>{{'CORE.HOST_SETTINGS.BP-HOST' | translate }}</mat-card-subtitle>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
<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>
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { CoreModule } from '../../../index';
|
||||
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,
|
||||
HttpModule,
|
||||
CoreModule
|
||||
]
|
||||
}).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();
|
||||
});
|
||||
});
|
@ -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 { AlfrescoSettingsService } from '../../services/alfresco-settings.service';
|
||||
import { LogService } from '../../services/log.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: AlfrescoSettingsService,
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
|
||||
@mixin adf-adf-toolbar-theme($theme) {
|
||||
@mixin adf-toolbar-theme($theme) {
|
||||
$foreground: map-get($theme, foreground);
|
||||
$adf-toolbar-height: 48px;
|
||||
$adf-toolbar-font-size: 14px;
|
||||
|
@ -4,7 +4,14 @@
|
||||
"ITEMS_RANGE": "Angezeigt werden {{ range }} von {{ total }}",
|
||||
"ITEMS_PER_PAGE": "Elemente pro Seite",
|
||||
"CURRENT_PAGE": "Seite {{ number }}",
|
||||
"TOTAL_PAGES": "von {{ total }}"
|
||||
"TOTAL_PAGES": "von {{ total }}",
|
||||
"HOST_SETTINGS": {
|
||||
"TITLE": "Einstellungen",
|
||||
"CS-HOST": "Konfiguration der Host-URL für Content Services",
|
||||
"BP-HOST": "Konfiguration der Host-URL für Process Services",
|
||||
"BACK": "Zurück",
|
||||
"APPLY": "ANWENDEN"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,16 @@
|
||||
"PARTIAL_PLURAL": "Deleted {{ success }} items, {{ failed }} couldn't be deleted",
|
||||
"ERROR_SINGULAR": "{{ name }} couldn't be deleted",
|
||||
"ERROR_PLURAL": "{{ number }} items couldn't be deleted"
|
||||
},
|
||||
"HOST_SETTINGS" : {
|
||||
"CS_URL_ERROR":"Content service address does not match the pattern",
|
||||
"PS_URL_ERROR":"Process service address does not match the pattern",
|
||||
"TITLE": "Settings",
|
||||
"CS-HOST": "Content Services host URL configuration",
|
||||
"BP-HOST": "Process Services host URL configuration",
|
||||
"BACK": "Back",
|
||||
"APPLY": "APPLY",
|
||||
"NOT_VALID": "Host not valid! http(s)://host|ip:port(/path)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,13 @@
|
||||
"ITEMS_PER_PAGE": "Elementos por página",
|
||||
"CURRENT_PAGE": "Página {{ number }}",
|
||||
"TOTAL_PAGES": "de {{ total }}"
|
||||
},
|
||||
"HOST_SETTINGS": {
|
||||
"TITLE": "Configuración",
|
||||
"CS-HOST": "Configuración de URL de host de Content Services",
|
||||
"BP-HOST": "Configuración de URL de host de Process Services",
|
||||
"BACK": "Volver",
|
||||
"APPLY": "APLICAR"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,13 @@
|
||||
"ITEMS_PER_PAGE": "Éléments par page",
|
||||
"CURRENT_PAGE": "Page {{ number }}",
|
||||
"TOTAL_PAGES": "sur {{ total }}"
|
||||
}
|
||||
},
|
||||
"HOST_SETTINGS": {
|
||||
"TITLE": "Paramètres",
|
||||
"CS-HOST": "Configuration de l'URL de l'hôte de Content Services",
|
||||
"BP-HOST": "Configuration de l'URL de l'hôte de Process Services",
|
||||
"BACK": "Retour",
|
||||
"APPLY": "APPLIQUER"
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,13 @@
|
||||
"ITEMS_PER_PAGE": "Elementi per pagina",
|
||||
"CURRENT_PAGE": "Pagina {{ number }}",
|
||||
"TOTAL_PAGES": "di {{ total }}"
|
||||
},
|
||||
"HOST_SETTINGS": {
|
||||
"TITLE": "Impostazioni",
|
||||
"CS-HOST": "Configurazione URL host Content Services",
|
||||
"BP-HOST": "Configurazione URL host Process Services",
|
||||
"BACK": "Indietro",
|
||||
"APPLY": "APPLICA"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,13 @@
|
||||
"ITEMS_PER_PAGE": "1 ページのアイテム数",
|
||||
"CURRENT_PAGE": "ページ: {{ number }}",
|
||||
"TOTAL_PAGES": "/ {{ total }}"
|
||||
},
|
||||
"HOST_SETTINGS": {
|
||||
"TITLE": "設定",
|
||||
"CS-HOST": "Content Services ホストの URL の設定",
|
||||
"BP-HOST": "Process Services ホストの URL の設定",
|
||||
"BACK": "戻る",
|
||||
"APPLY": "適用"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,13 @@
|
||||
"ITEMS_PER_PAGE": "Elementer per side",
|
||||
"CURRENT_PAGE": "Side {{ number }}",
|
||||
"TOTAL_PAGES": "av {{ total }}"
|
||||
},
|
||||
"HOST_SETTINGS": {
|
||||
"TITLE": "Innstillinger",
|
||||
"CS-HOST": "Innholdstjenestevert URL-konfigurasjon",
|
||||
"BP-HOST": "Prosesstjenestevert URL-konfigurasjon",
|
||||
"BACK": "Tilbake",
|
||||
"APPLY": "BRUK"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,13 @@
|
||||
"ITEMS_PER_PAGE": "Items per pagina",
|
||||
"CURRENT_PAGE": "Pagina {{ number }}",
|
||||
"TOTAL_PAGES": "van {{ total }}"
|
||||
},
|
||||
"HOST_SETTINGS": {
|
||||
"TITLE": "Instellingen",
|
||||
"CS-HOST": "URL-configuratie Content Services-host",
|
||||
"BP-HOST": "URL-configuratie Process Services-host",
|
||||
"BACK": "Terug",
|
||||
"APPLY": "TOEPASSEN"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,13 @@
|
||||
"ITEMS_PER_PAGE": "Itens por página",
|
||||
"CURRENT_PAGE": "Página {{ number }}",
|
||||
"TOTAL_PAGES": "de {{ total }}"
|
||||
},
|
||||
"HOST_SETTINGS": {
|
||||
"TITLE": "Configurações",
|
||||
"CS-HOST": "Configuração de URL de host do Content Services",
|
||||
"BP-HOST": "Configuração de URL de host do Process Services",
|
||||
"BACK": "Voltar",
|
||||
"APPLY": "APLICAR"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,13 @@
|
||||
"ITEMS_PER_PAGE": "Элементов на странице",
|
||||
"CURRENT_PAGE": "Страница {{ number }}",
|
||||
"TOTAL_PAGES": "из {{ total }}"
|
||||
},
|
||||
"HOST_SETTINGS": {
|
||||
"TITLE": "Параметры",
|
||||
"CS-HOST": "Конфигурация URL-адреса хоста Content Services",
|
||||
"BP-HOST": "Конфигурация URL-адреса хоста Process Services",
|
||||
"BACK": "Назад",
|
||||
"APPLY": "ПРИМЕНИТЬ"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,13 @@
|
||||
"ITEMS_PER_PAGE": "每页的项目",
|
||||
"CURRENT_PAGE": "第 {{number}} 页",
|
||||
"TOTAL_PAGES": "/共 {{total}} 页"
|
||||
},
|
||||
"HOST_SETTINGS": {
|
||||
"TITLE": "设置",
|
||||
"CS-HOST": "Content Services 主机 URL 配置",
|
||||
"BP-HOST": "流程服务主机 URL 配置",
|
||||
"BACK": "返回",
|
||||
"APPLY": "应用"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,15 @@
|
||||
@import '../src/components/toolbar/toolbar.component';
|
||||
@import '../src/components/pagination/pagination.component';
|
||||
@import '../src/components/info-drawer/info-drawer-layout.component';
|
||||
@import '../src/components/settings/host-settings.component';
|
||||
|
||||
@mixin alfresco-core-theme($theme) {
|
||||
@include adf-host-settings-theme($theme);
|
||||
@include adf-accordion-theme($theme);
|
||||
@include adf-card-view-textitem-theme($theme);
|
||||
@include adf-card-view-dateitem-theme($theme);
|
||||
@include adf-card-view-theme($theme);
|
||||
@include adf-adf-toolbar-theme($theme);
|
||||
@include adf-toolbar-theme($theme);
|
||||
@include adf-info-drawer-theme($theme);
|
||||
@include adf-pagination-theme($theme);
|
||||
@include adf-colors-theme($theme);
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -10,7 +10,7 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[package.json]
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -92,6 +92,7 @@
|
||||
"ng2-activiti-form": "1.9.0",
|
||||
"ng2-alfresco-datatable": "1.9.0",
|
||||
"ng2-activiti-tasklist": "1.9.0",
|
||||
"ng2-alfresco-upload": "1.9.0",
|
||||
"ng2-alfresco-documentlist": "1.9.0",
|
||||
"minimatch": "3.0.4",
|
||||
"pdfjs-dist": "1.5.404"
|
||||
|
Loading…
x
Reference in New Issue
Block a user