LP1901930 SIP Account admin UI improvements
authorBill Erickson <berickxx@gmail.com>
Mon, 22 Feb 2021 16:09:26 +0000 (11:09 -0500)
committerBill Erickson <berickxx@gmail.com>
Mon, 24 Oct 2022 17:21:58 +0000 (13:21 -0400)
* Clear the password value from the password prompt upon close
* Add New Account button to account edit page
* Fixes issues with navigating between new and existing accounts.
* Fixes issues with dialog body/title display.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/dialog/prompt.component.html
Open-ILS/src/eg2/src/app/share/dialog/prompt.component.ts
Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.html
Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.ts

index ca47961..50e8236 100644 (file)
@@ -2,7 +2,7 @@
   <div class="modal-header bg-info">
     <h4 class="modal-title">{{dialogTitle}}</h4>
     <button type="button" class="close" 
-      i18n-aria-label aria-label="Close" (click)="close()">
+      i18n-aria-label aria-label="Close" (click)="closeAndClear()">
       <span aria-hidden="true">&times;</span>
     </button>
   </div>
@@ -14,8 +14,8 @@
   </div>
   <div class="modal-footer">
     <button type="button" class="btn btn-success" 
-      (click)="close(promptValue)" i18n>Confirm</button>
+      (click)="closeAndClear(promptValue)" i18n>Confirm</button>
     <button type="button" class="btn btn-warning" 
-      (click)="close()" i18n>Cancel</button>
+      (click)="closeAndClear()" i18n>Cancel</button>
   </div>
 </ng-template>
index a5d8eca..4db0896 100644 (file)
@@ -16,6 +16,11 @@ export class PromptDialogComponent extends DialogComponent {
     @Input() public promptValue: string;
     // 'password', etc.
     @Input() promptType = 'text';
+
+    closeAndClear(value?: any) {
+        this.close(value);
+        this.promptValue = '';
+    }
 }
 
 
index a63b3ea..ded1b74 100644 (file)
   </button>
 </a>
 
+<ng-container *ngIf="!createMode">
+  <a routerLink="/staff/admin/server/sip/account/new">
+    <button class="btn btn-outline-dark label-with-material-icon ml-2">
+      <span class="material-icons">add</span>
+      <span i18n>New Account</span>
+    </button>
+  </a>
+</ng-container>
+
 <eg-sip-group-delete-dialog *ngIf="account && account.setting_group()"
   #deleteGroupDialog
   [group]="account.setting_group()" [settingGroups]="settingGroups">
 
 <ng-container *ngIf="createMode">
   <eg-prompt-dialog #passwordDialog i18n-dialogTitle i18n-dialogBody
-    dialogTitle="Create SIP Password" i18n-dialogBody="Create a new password"
+    dialogTitle="Create SIP Password" dialogBody="Create a new password"
     promptType="password">
   </eg-prompt-dialog>
 </ng-container>
 
 <ng-container *ngIf="!createMode">
   <eg-prompt-dialog #passwordDialog i18n-dialogTitle i18n-dialogBody
-    dialogTitle="Create SIP Password" i18n-dialogBody="Create a new password"
+    dialogTitle="Modify SIP Password" dialogBody="Change SIP account password"
     promptType="password">
   </eg-prompt-dialog>
 </ng-container>
index 5f72cd4..a2351e0 100644 (file)
@@ -61,8 +61,11 @@ export class SipAccountComponent implements OnInit {
                 this.account = this.idl.create('sipacc'); // dummy
                 this.createMode = true;
                 return;
+            } else {
+                this.createMode = false;
             }
 
+            this.usrId = null;
             this.accountId = Number(params.get('id'));
             this.loadAccount().toPromise(); // force it to run
         });