-
Notifications
You must be signed in to change notification settings - Fork 72
Add feature to duplicate resources in admin #702
Description
It would be useful to have the ability to duplicate or clone resources in the admin. The primary use-case would be for cloning API Backends or API Users, but if we wanted to be complete, we could add the ability to clone all resources (so also Web Site Backends, Admins, Admin Groups, and API Scopes).
The reason duplicating resources would be handy for the admin is that for API Backends or API Users with custom rate limits/roles, there can be a lot of UI interaction required to mimic another record. So, for example, an admin may want to duplicate an API backend to move a backend from a staging-only domain to a production domain. Or an admin may want to create many similar API keys for different environments (eg, development, staging, test, and production keys) with more complicated custom rate limits and roles setup.
So what I might propose:
- Somewhere on each record (maybe above the "Delete" link in the footer), have a "Duplicate" link/button.
- That would then take you to a URL like
#/apis/new?duplicate_id=EXISTING_UUID - The UI would then fetch that record from the API and populate the new form. I'm thinking/hoping the UI code could mostly reuse the same logic that happens when it's fetching a record and displaying the form for editing purposes, but it would just omit the various
idreferences so that it would be treated as a new record upon submission. - Saving would then create a new record as normal.
So with this approach, the duplication is achieved by the UI just pre-populating the "new" form with existing data. There are other ways we could go about this too (eg, having the server perform a duplication of all of the records), but I think this frontend approach may be the simplest (and also give the user the ability to tweak the record before the actual duplication happens). But I'm also open to other ideas here.