-
Notifications
You must be signed in to change notification settings - Fork 324
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
Add project/duplicate endpoint #10407
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd choose different name for the message and I'd provide a way to specify name of the new project.
@@ -42,6 +42,7 @@ transport formats, please look [here](./protocol-architecture.md). | |||
- [`project/delete`](#projectdelete) | |||
- [`project/listSample`](#projectlistsample) | |||
- [`project/status`](#projectstatus) | |||
- [`project/duplicate`](#projectduplicate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be called duplicate? Why not copy
or fork
?
/** | ||
* The project to duplicate. | ||
*/ | ||
projectId: UUID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the message support (optional) suggested name for the newly created project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the cloud, the project with the (copy)
suffix is created, and then the user can rename it.
@@ -89,6 +89,20 @@ class BlockingFileSystem[F[+_, +_]: Sync: ErrorChannel]( | |||
} | |||
.mapError(toFsFailure) | |||
|
|||
/** @inheritdoc */ | |||
override def copy(from: File, to: File): F[FileSystemFailure, Unit] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See! It is called copy
here ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see a test case when we try to duplicate the same project twice. Also wondering how does cloud PM behave in such scenario (local PM should be consistent).
@@ -174,10 +174,12 @@ abstract class JsonRpcServerTestKit | |||
def fuzzyExpectJson( | |||
json: Json, | |||
timeout: FiniteDuration = 5.seconds.dilated | |||
)(implicit pos: Position): Assertion = { | |||
)(implicit pos: Position): Json = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we leave Either
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the JSON does not match the expected json
value, the assertion will fail and the function will fail with the assertion exception
} | ||
|
||
private def getNameForDuplicatedProject(projectName: String): String = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if there is already one that exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function returns the suggested project name, and then we use getNameForNewProject
function that checks if the current name exists and returns the final name for the project.
The Cloud just keeps creating projects with the |
i guess it would be good to discuss with @PabloBuchu about what should happen if we duplicate files multiple times? i know in some other places we do use (i guess that happens when uploading files with the same name though) it's worth noting that it's probably a bad thing if cloud allows multiple projects with the same name, since cloud assets are accessed by path, and cloud paths depend on the asset name |
Pull Request Description
close #10367
Changelog:
project/duplicate
project manager command to duplicate existing projectsImportant Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.