modal opened with 'clone $thing' has a misleading title of 'edit $clonedthing'

Started by Wolfspyre, July 10, 2024, 10:57:18 PM

Previous topic - Next topic
hai all!

This is something of a widespread behavior within opnsense, and so bringing it up here as it feels like it's prolly a low-level behavioral issue not scoped to any one service or facet of the ui

When a user clicks on 'clone $thing' (rule, server, alias, firewall rule, dhcp reservation, haproxy config, etc)
(read 'pretty much anything that has a clone button')

The resulting modal popup has a title which conveys that the user is editing the original resource, rather than creating a new one from it.

This looks like its controlled by jquery, and the label seems like it would be targetable, thus if one clicks on 'clone' the title could read 'Clone $objectType' or 'Cloning $originalObjectTitle'  rather than 'Edit $objectType'

While it's true, one is TECHNICALLY editing an item of that type, it's misleading, as the window appears the same as if one clicked the 'edit $thing' button...

I'm sure there's a good reason for this behavior, but I'm having a hard time intuiting it...
Can someone more familiar with the code help me see what I'm missing?

I think this is just a shortcut in the JS code handling this. If you open a ticket on GitHub I'll fix that. Shouldn't be much more than a one-liner.


Cheers,
Franco



Thanks. I took a peek and it hardwires the clone/copy to the same edit dialog. It's not a one line fix since the dialog is embedded in each GUI page instead of being created by the JS code, but we will discuss this further internally.


Cheers,
Franco

Nod.. is this likely something you'll wanna internationalize?
Not an ask, I just dunno if it's toil, toil relief, carrot, stick,  or terrible idea 😊

It's already translated but hereby lies the problem. The dialog is hardcoded as is the title. Changing the title requires to stuff another title in all the pages using an edit dialog and then adding the JS glue to switch it according to the action requirement (edit or clone or add also actually).

The other solution would be to ditch the custom title and just hardcode (translatable) "edit item", "clone item" and "add item" titles. But it also requires to touch all dialogs eventually to get rid of the defunct boilerplate that is the custom title name.

I'm not sure if it's worth it. Neither approach seems optimal. The current one also isn't optimal of course.


Cheers,
Franco