]> source.dussan.org Git - archiva.git/commitdiff
Adding check for property value change
authorMartin Stockhammer <martin_s@apache.org>
Tue, 12 Jan 2021 17:07:40 +0000 (18:07 +0100)
committerMartin Stockhammer <martin_s@apache.org>
Tue, 12 Jan 2021 17:07:40 +0000 (18:07 +0100)
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.html
archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.ts

index b7f07258c45dd1fd111948482f8ce7f650ced239..c994557a328c9d3cadafe331befdde9dc692dd83 100644 (file)
             </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>
index 28e5b9562a83fc0e7a4ca670d4233e51932819b0..1a959872cd81b56232fdaa6a5874264bb3d4184f 100644 (file)
@@ -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;
         }
     }
 }