LP#1839341: Address sort, revert, and layout
authorMike Rylander <mrylander@gmail.com>
Fri, 25 Mar 2022 17:00:23 +0000 (13:00 -0400)
committerJane Sandberg <sandbergja@gmail.com>
Thu, 13 Oct 2022 16:04:01 +0000 (09:04 -0700)
Based on testing feedback, this commit:
 * improves the layout and styling of the Edit dialog buttons
 * adds the Description as a (hidden) column
 * enables sort/multisort on the main grid
 * corrects the logic of the Revert function
 * corrects the logic used when saving booleans

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Jane Sandberg <sandbergja@gmail.com>
Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/edit-org-unit-setting-dialog.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/org-unit-setting-history-dialog.component.ts
Open-ILS/src/eg2/src/app/staff/admin/local/org-unit-settings/org-unit-settings.component.html

index a2ef464..bfa2c0e 100644 (file)
   </div>
   <div class="modal-footer">
     <button type="button" class="btn btn-success" 
-      (click)="delete()" i18n>Delete Setting</button>
-    <button type="button" class="btn btn-warning" 
       (click)="update()" i18n>Update Setting</button>
+    <button type="button" class="btn btn-warning" 
+      (click)="delete()" i18n>Delete Setting</button>
   </div>
 </ng-template>
 
 <ng-template #fmClassLabel let-r="result" i18n>
   {{r.label}}
-</ng-template>
\ No newline at end of file
+</ng-template>
index 200c25b..3b297cc 100644 (file)
@@ -45,12 +45,21 @@ export class OuSettingHistoryDialogComponent extends DialogComponent implements
         if (log) {
             const intTypes = ['integer', 'currency', 'link'];
             if (intTypes.includes(this.entry.dataType)) {
-                log.new_value = Number(log.new_value);
+                log.original_value = Number(log.original_value);
             } else {
-                log.new_value = log.new_value.replace(/^"(.*)"$/, '$1');
+                log.original_value = log.original_value.replace(/^"(.*)"$/, '$1');
             }
+
+            if (this.entry.dataType === 'bool') {
+                if (log.original_value.match(/^t/)) {
+                    log.original_value = true;
+                } else {
+                    log.original_value = false;
+                }
+            }
+
             this.close({
-                setting: {[this.entry.name]: log.new_value},
+                setting: {[this.entry.name]: log.original_value},
                 context: this.org.get(log.org),
                 revert: true
             });
index 2ad7679..1cb3146 100644 (file)
 <!-- Org Unit Settings Grid -->
 <div class='w-11 mt-3'>
   <eg-grid #orgUnitSettingsGrid [dataSource]="gridDataSource"
-    [disableSelect]="true"
-    [sortable]="false" [showDeclaredFieldsOnly]="true"
+    [disableSelect]="true" [useLocalSort]="true" [multiSortable]="true"
+    [sortable]="true" [showDeclaredFieldsOnly]="true"
     persistKey="admin.actor.org_unit_settings">
 
-    <eg-grid-column i18n-label label="Edit" name="edit" [flex]="1"
+    <eg-grid-column i18n-label label="Edit" name="edit" [flex]="1" [sortable]="false" [multiSortable]="false"
       [disableTooltip]="true" [cellTemplate]="editCellTemplate"></eg-grid-column>
-    <eg-grid-column i18n-label label="History" name="history" [flex]="1"
+    <eg-grid-column i18n-label label="History" name="history" [flex]="1" [sortable]="false" [multiSortable]="false"
       [disableTooltip]="true" [cellTemplate]="historyCellTemplate"></eg-grid-column>
     <eg-grid-column path="name" label="Name" i18n-label [hidden]="true" [flex]="3"></eg-grid-column>
     <eg-grid-column path="grp" label="Group" i18n-label [flex]="1"></eg-grid-column>
     <eg-grid-column path="label" label="Setting" [index]="true" i18n-label [flex]="4"></eg-grid-column>
+    <eg-grid-column path="description" label="Description" [hidden]="true" i18n-label [flex]="6"></eg-grid-column>
     <eg-grid-column path="context.shortname()" label="Context" i18n-label [flex]="1"></eg-grid-column>
     <eg-grid-column path="value_str" label="Value" i18n-label [flex]="1"></eg-grid-column>