mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#ADF-498 added check for valid settings addresses (#1834)
* #ADF-498 added check for valid settings addresses * #ADF-498 added adf prefix to the new style class
This commit is contained in:
@@ -29,3 +29,7 @@
|
|||||||
.table-row {
|
.table-row {
|
||||||
display: table-row;
|
display: table-row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.adf-setting-input-padding{
|
||||||
|
padding-top: 0px !important;
|
||||||
|
}
|
||||||
|
@@ -10,18 +10,31 @@
|
|||||||
Content Services host URL configuration
|
Content Services host URL configuration
|
||||||
</div>
|
</div>
|
||||||
<nav class="mdl-navigation">
|
<nav class="mdl-navigation">
|
||||||
<div class="icon material-icons icon-margin">link</div>
|
<i class="icon material-icons icon-margin">link</i>
|
||||||
<input type="text" class="mdl-textfield__input" id="ecmHost" data-automation-id="ecmHost"
|
<div class="mdl-textfield mdl-js-textfield adf-setting-input-padding">
|
||||||
tabindex="1" (change)="onChangeECMHost($event)" value="{{ecmHost}}"/>
|
<input data-automation-id="ecmHost"
|
||||||
|
class="mdl-textfield__input" tabindex="1"
|
||||||
|
type="text" tabindex="1"
|
||||||
|
(change)="onChangeECMHost($event)"
|
||||||
|
pattern="^(http|https):\/\/.*" id="ecmHost" value="{{ecmHost}}">
|
||||||
|
<label class="mdl-textfield__label" for="ecmHost">ECM Host</label>
|
||||||
|
<span class="mdl-textfield__error">ECM host is not valid!</span>
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="mdl-card__supporting-text">
|
<div class="mdl-card__supporting-text">
|
||||||
Process Services host URL configuration
|
Process Services host URL configuration
|
||||||
</div>
|
</div>
|
||||||
<nav class="mdl-navigation">
|
<nav class="mdl-navigation">
|
||||||
<div class="icon material-icons icon-margin">link</div>
|
<i class="icon material-icons icon-margin">link</i>
|
||||||
<input type="text" class="mdl-textfield__input" id="bpmHost" data-automation-id="bpmHost"
|
<div class="mdl-textfield mdl-js-textfield adf-setting-input-paddingg">
|
||||||
tabindex="1" (change)="onChangeBPMHost($event)" value="{{bpmHost}}"/>
|
<input class="mdl-textfield__input"
|
||||||
|
type="text"
|
||||||
|
(change)="onChangeBPMHost($event)"
|
||||||
|
tabindex="2" pattern="^(http|https):\/\/.*" id="bpmHost" value="{{bpmHost}}">
|
||||||
|
<label class="mdl-textfield__label" for="bpmHost">BPM Host</label>
|
||||||
|
<span class="mdl-textfield__error">BPM host is not valid!</span>
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-card__actions mdl-card--border">
|
<div class="mdl-card__actions mdl-card--border">
|
||||||
|
@@ -15,15 +15,17 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component, AfterViewChecked } from '@angular/core';
|
||||||
import { AlfrescoSettingsService, StorageService, LogService } from 'ng2-alfresco-core';
|
import { AlfrescoSettingsService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
|
declare var componentHandler: any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-setting-demo',
|
selector: 'alfresco-setting-demo',
|
||||||
templateUrl: './setting.component.html',
|
templateUrl: './setting.component.html',
|
||||||
styleUrls: ['./setting.component.css']
|
styleUrls: ['./setting.component.css']
|
||||||
})
|
})
|
||||||
export class SettingComponent {
|
export class SettingComponent implements AfterViewChecked {
|
||||||
|
|
||||||
ecmHost: string;
|
ecmHost: string;
|
||||||
bpmHost: string;
|
bpmHost: string;
|
||||||
@@ -35,24 +37,39 @@ export class SettingComponent {
|
|||||||
this.bpmHost = this.settingsService.bpmHost;
|
this.bpmHost = this.settingsService.bpmHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngAfterViewChecked() {
|
||||||
|
// workaround for MDL issues with dynamic components
|
||||||
|
if (componentHandler) {
|
||||||
|
componentHandler.upgradeAllRegistered();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public onChangeECMHost(event: KeyboardEvent): void {
|
public onChangeECMHost(event: KeyboardEvent): void {
|
||||||
let value = (<HTMLInputElement>event.target).value.trim();
|
let value = (<HTMLInputElement>event.target).value.trim();
|
||||||
if (value) {
|
if (value && this.isValidUrl(value)) {
|
||||||
this.logService.info(`ECM host: ${value}`);
|
this.logService.info(`ECM host: ${value}`);
|
||||||
this.ecmHost = value;
|
this.ecmHost = value;
|
||||||
this.settingsService.ecmHost = value;
|
this.settingsService.ecmHost = value;
|
||||||
this.storage.setItem(`ecmHost`, value);
|
this.storage.setItem(`ecmHost`, value);
|
||||||
|
} else {
|
||||||
|
console.error('Ecm address does not match the pattern');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public onChangeBPMHost(event: KeyboardEvent): void {
|
public onChangeBPMHost(event: KeyboardEvent): void {
|
||||||
let value = (<HTMLInputElement>event.target).value.trim();
|
let value = (<HTMLInputElement>event.target).value.trim();
|
||||||
if (value) {
|
if (value && this.isValidUrl(value)) {
|
||||||
this.logService.info(`BPM host: ${value}`);
|
this.logService.info(`BPM host: ${value}`);
|
||||||
this.bpmHost = value;
|
this.bpmHost = value;
|
||||||
this.settingsService.bpmHost = value;
|
this.settingsService.bpmHost = value;
|
||||||
this.storage.setItem(`bpmHost`, value);
|
this.storage.setItem(`bpmHost`, value);
|
||||||
|
} else {
|
||||||
|
console.error('Bpm address does not match the pattern');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isValidUrl(url: string) {
|
||||||
|
return /^(http|https):\/\/.*/.test(url);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user