This is an automated email from the ASF dual-hosted git repository. martin_s pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/archiva.git
commit 02a57faa0e2e6601900c20b4623a3e9b67c866aa Author: Martin Stockhammer <[email protected]> AuthorDate: Tue Jan 12 18:07:40 2021 +0100 Adding check for property value change --- .../security-properties.component.html | 8 ++++---- .../security-properties.component.ts | 21 +++++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.html index b7f0725..c994557 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.html @@ -39,10 +39,10 @@ </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> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.ts index 28e5b95..1a95987 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.ts @@ -35,6 +35,7 @@ export class SecurityPropertiesComponent extends SortedTableComponent<PropertyEn 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>> { @@ -53,14 +54,16 @@ export class SecurityPropertiesComponent extends SortedTableComponent<PropertyEn 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 { @@ -69,9 +72,11 @@ export class SecurityPropertiesComponent extends SortedTableComponent<PropertyEn 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; } } }
