</thead>
<tbody>
<tr *ngFor="let propertyEntry of propertyItem.data" >
- <td>{{propertyEntry.key}}</td>
- <td *ngIf="isEdit(propertyEntry.key)"><input class="form-control" type="text" [(ngModel)]="propertyValue"></td>
- <td *ngIf="!isEdit(propertyEntry.key)">{{propertyEntry.value}}</td>
- <td>
+ <td class="align-middle">{{propertyEntry.key}}</td>
+ <td class="align-middle" *ngIf="isEdit(propertyEntry.key)"><input class="form-control" type="text" [(ngModel)]="propertyValue"></td>
+ <td class="align-middle" *ngIf="!isEdit(propertyEntry.key)">{{propertyEntry.value}}</td>
+ <td class="align-middle" >
<a [routerLink]="" (click)="toggleEditProperty(propertyEntry)"
[attr.title]="'security.config.properties.edit' |translate"><span class="fas fa-edit"></span></a>
</td>
editProperty:string='';
propertyValue:string='';
+ originPropertyValue:string='';
constructor(translator: TranslateService, private securityService: SecurityService, private toastService: ToastService) {
super(translator, function (searchTerm: string, offset: number, limit: number, orderBy: string[], order: string): Observable<PagedResult<PropertyEntry>> {
updateProperty(key:string, value:string) {
console.log("Updating "+key+"="+value)
- this.securityService.updateProperty(key, value).subscribe(
- ()=>{
- this.toastService.showSuccessByKey('security-properties', 'security.config.properties.edit_success')
- },
- (error: ErrorResult) => {
- this.toastService.showErrorByKey('security-properties', 'security.config.properties.edit_failure', {error:error.firstMessageString()})
- }
- );
+ if (this.propertyValue!=this.originPropertyValue) {
+ this.securityService.updateProperty(key, value).subscribe(
+ () => {
+ this.toastService.showSuccessByKey('security-properties', 'security.config.properties.edit_success')
+ },
+ (error: ErrorResult) => {
+ this.toastService.showErrorByKey('security-properties', 'security.config.properties.edit_failure', {error: error.firstMessageString()})
+ }
+ );
+ }
}
toggleEditProperty(propertyEntry:PropertyEntry) : void {
this.editProperty='';
this.updateProperty(propertyEntry.key, this.propertyValue);
this.propertyValue = '';
+ this.originPropertyValue='';
} else {
this.editProperty = propertyEntry.key;
this.propertyValue = propertyEntry.value;
+ this.originPropertyValue = propertyEntry.value;
}
}
}