Commit 593c4ab
fix(ui): remove duplicate onclick handler causing double-click for CA cert upload (#4090)
* fix(ui): remove duplicate onclick handler causing double-click for CA cert upload
Fixes #3558
The CA certificate upload drop zone had both an inline onclick attribute
and a JavaScript event listener (initializeCACertUpload), causing the
file selection dialog to open twice.
Removed the inline onclick handler since initializeCACertUpload() already
provides complete functionality including click-to-upload, drag-and-drop,
and visual feedback.
Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>
* fix(ui): prevent multiple event listener registrations for CA cert upload
The initializeCACertUpload() function is called multiple times:
- On DOMContentLoaded
- After 500ms delay
- When switching to gateways tab
Each call was adding new event listeners without removing old ones,
causing multiple click handlers to accumulate and trigger the file
dialog multiple times.
Added initialization guard using data-initialized attribute to prevent
duplicate event listener registrations.
Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>
* feat: secrets updated
Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>
* test(ui): cover CA cert upload double-init guard
Add a regression test that calls initializeCACertUpload() twice on the
same drop zone and asserts the click listener is only attached once, so
the file picker opens a single time.
Also refresh the detect-secrets baseline so generated_at and line
numbers match the rebased tree.
Signed-off-by: Jonathan Springer <jps@s390x.com>
---------
Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>
Signed-off-by: Jonathan Springer <jps@s390x.com>
Co-authored-by: Jonathan Springer <jps@s390x.com>1 parent db17f4a commit 593c4ab
4 files changed
Lines changed: 23 additions & 3 deletions
File tree
- mcpgateway
- admin_ui
- templates
- tests/unit/js
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
6288 | 6288 | | |
6289 | 6289 | | |
6290 | 6290 | | |
6291 | | - | |
| 6291 | + | |
6292 | 6292 | | |
6293 | 6293 | | |
6294 | 6294 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
317 | 323 | | |
318 | 324 | | |
319 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6033 | 6033 | | |
6034 | 6034 | | |
6035 | 6035 | | |
6036 | | - | |
6037 | 6036 | | |
6038 | 6037 | | |
6039 | 6038 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
282 | 297 | | |
283 | 298 | | |
284 | 299 | | |
| |||
0 commit comments