Skip to content

Add feature to duplicate resources in admin #702

@GUI

Description

@GUI

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 id references 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions