GSA / GSA/api.data.gov

Add feature to duplicate resources in admin

Open
#702 0 comments 0 reactions 1 assignee Claimed by @jtmkrueger View on GitHub
Dominant language
JavaScript
Stars
113
Forks
75
PR merge metrics
No merged PRs in 30d

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 `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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.