Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy template project #4725

Closed
mcbouslog opened this issue Jul 2, 2018 · 11 comments
Closed

Copy template project #4725

mcbouslog opened this issue Jul 2, 2018 · 11 comments

Comments

@mcbouslog
Copy link
Contributor

mcbouslog commented Jul 2, 2018

MVP for https://github.com/zooniverse/rfc/issues/34.

Create client side copy template functionality, similar to workflow copy, limited to:

  1. create new project with original project's description, "copy of " + display_name (or similar), configuration, experimental_tools, introduction, primary_language, tags, urls, and workflow_description attributes, if defined
  2. create copies of original project's active workflows, link new copied workflows to new project
  3. create copies of original project's pages, link new copied pages to new project
  4. create copies of original project's field guide, link new copied field guide to new project
  5. create copies of original project's tutorials, link new copied tutorials to new project
  6. create copies of original project's translations, link new copied translations to new project

Initially, we can manually set a new property in a project's configuration to note it can be copied, and only then show the option to copy the project.

Happy to list aspects punting on for future iterations and temporary work-arounds if useful.

Mentioning @zwolf, @camallen, @eatyourgreens and @trouille. Please feel free to edit this initial comment as you see fit for clarity.

@eatyourgreens
Copy link
Contributor

Translations will need to be copied for each resource in steps 1–5.

@eatyourgreens
Copy link
Contributor

Is there a reason this should be done in javascript, rather than having Panoptes copy the database records in Postgres and making that available as an API call (or set of API calls)?

If Panoptes takes care of copying the records, then the front-end really just boils down to deciding what the UI should be for project owners. A big button saying 'Clone project' that triggers some simple questions like what name to give the new project, and which linked resources to include with the copy?

@eatyourgreens
Copy link
Contributor

Worth remembering that project display name is localised, so 'New Project Name' might need translations too. Looking at Galaxy Zoo in the project builder, I think translators are mostly leaving the project name in its original language.

@eatyourgreens
Copy link
Contributor

Sorry, one more question. Why should we do this in PFE and not in the lab app? My impression was that the project builder was being gradually migrated over to the lab app anyway.

@zwolf
Copy link
Member

zwolf commented Jul 5, 2018

Fundamentally, this is creating "copy project template" functionality and not a true project clone. This has to do with the funding left on the grant, the complexity of deep cloning projects, and our existing functionality. Workflows are copied in PFE in this exact way. Projects will get a flag somewhere to indicate that they're "copyable" or that they're "templates" or similar and the button will only exist if they are.

This could be done on the API side. The API would use the same logic as the front end to create new objects and copy only the relevant data from the existing resources before saving. The number of API calls that this functionality would introduce is not worth worrying about, as this would be used infrequently. Besides, there's lower hanging fruit for that kind of optimization in the lab (see #4720).

No one seems to feel particularly strongly about it one way or the other, so @mcbouslog and I talked it out earlier and decided to go with this method. If you (or @camallen) actually do, then let us know why and we can go from there.

@trouille
Copy link
Member

trouille commented Jul 5, 2018

Hi all - please best to pause on the comments in this thread and wait for the zoom call that you'll have early next week that Mark is setting up. It'll be easiest/most clear to talk directly and hear the pros and cons on both sides and make a decision that way. Thanks! @mcbouslog , please post here when you have the time set.

@eatyourgreens
Copy link
Contributor

For copying resources in the front-end, how about updating the client's Resource API so we can do something like:

let newResource;
existingResource
  .copy()
  .then( resource => newResource = resource);

Resource.copy() could call Panoptes to get a new resource, or handle the copying in JS. The details would be hidden from PFE (which doesn't care how you copy a project.)

@stale
Copy link

stale bot commented Nov 3, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 3, 2018
@mcbouslog
Copy link
Contributor Author

Reposting link to zooniverse/rfc#34.
Panoptes bulk-copying completed with zooniverse/panoptes#2861.
PFE piece remains open.

@stale stale bot removed the stale label Nov 5, 2018
@eatyourgreens
Copy link
Contributor

@mcbouslog will this require changes to zooniverse/json-api-client to handle posting to the /copy endpoint?

@mcbouslog
Copy link
Contributor Author

I think it would. Though unless there's an immediate need, this'll likely get added to the new panoptes-js/frontend-monorepo which has it's own related issue - zooniverse/front-end-monorepo#72. So I'll close this for now, with the RFC and FEM issue taking precedent, but we can re-open this if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants