Aman-Mittal opened a new issue, #230:
URL: https://github.com/apache/fineract-backoffice-ui/issues/230

   ## What is wrong
   
   Seven destructive actions under **System** ask for confirmation with 
`window.confirm` and a hardcoded English string:
   
   ```ts
   if (!row.id || !window.confirm('Delete this hook?')) return;
   ```
   
   That produces the browser's own grey dialog: unstyled, untranslated, unable 
to signal that the action is destructive, and it freezes the page while it is 
open. Everywhere else the application uses its own `DialogService.confirm`, 
which is themed, translated and marks destructive actions in red. Across the 
app there are 29 of these native calls left; this issue covers the 7 under 
System.
   
   ## Business value
   
   System administration is where a wrong click costs the most, because the 
damage is not confined to one record. Deleting a hook silently stops outbound 
integrations. Deleting the OIDC configuration can lock users out of sign-in. 
Deleting a report-mailing job stops a scheduled report that someone downstream 
is relying on, and nobody notices until the report fails to arrive. These are 
precisely the actions that deserve a confirmation which looks deliberate and 
explains the consequence — and instead they get the weakest dialog available, 
in English regardless of the chosen locale.
   
   ## Files
   
   | File | Line |
   |---|---|
   | `src/app/features/system/adhoc-query/adhoc-query-list.component.ts` | 117 |
   | 
`src/app/features/system/entity-data-table-checks/entity-data-table-checks-list.component.ts`
 | 106 |
   | `src/app/features/system/entity-mapping/entity-mapping-list.component.ts` 
| 127 |
   | `src/app/features/system/hooks/hooks-list.component.ts` | 117 |
   | `src/app/features/system/oidc-config/oidc-config.component.ts` | 221 |
   | 
`src/app/features/system/report-mailing-jobs/report-mailing-jobs-list.component.ts`
 | 255 |
   | `src/app/features/system/sms/sms-list.component.ts` | 113 |
   
   ## How to fix
   
   There is a worked example in the same directory — 
`src/app/features/system/codes/codes-list.component.ts` was converted this way 
and is the pattern to copy.
   
   ```ts
   private readonly dialogService = inject(DialogService);
   private readonly translate = inject(TranslateService);
   
   void this.dialogService
     .confirm({
       title: this.translate.instant('SYSTEM.DELETE_HOOK'),
       message: this.translate.instant('SYSTEM.CONFIRM_DELETE_HOOK', { name: 
row.name }),
       destructive: true,
     })
     .then((confirmed) => {
       if (!confirmed) return;
       // ...the existing delete call, unchanged
     });
   ```
   
   Notes:
   
   - `confirm()` returns a `Promise<boolean>`, so the early-return guard 
becomes a `.then()` block. That is the only structural change.
   - Add the new keys to `src/assets/i18n/en.json`. Only `en.json` is required 
— `npm run i18n:check` fails on keys referenced in code but missing there, and 
does not require `hi.json`/`ko.json`.
   - Say what the consequence is, not just "Are you sure?". The OIDC one in 
particular is worth spelling out — that deletion affects how people sign in.
   - Set `destructive: true` on every one of these.
   
   ## Verifying
   
   ```
   npm run lint
   npm run i18n:check
   npm test
   npm run build
   ```
   
   If the screen has a spec, add a case asserting the delete is not called when 
the dialog resolves `false`. That is the behaviour most likely to break in the 
rewrite, since the guard moves from a synchronous `return` into a callback.
   
   ## Picking this up
   
   No need to be assigned — assignment here is limited to committers. Comment 
that you are starting, then open a PR; the comment is enough to stop two people 
duplicating the work.
   
   This issue touches only files under `src/app/features/system/`, so it does 
not overlap with the other `window.confirm` issues and several can be in flight 
at the same time.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to