-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: add visibility when fork a project (#1272) #1617
Conversation
You can access the deployment of this PR at https://renku-ci-ui-1617.dev.renku.ch |
acf2352
to
b42270d
Compare
…ect' into 1272-add-visibility-forking-project # Conflicts: # client/src/project/new/ProjectNew.container.js # client/src/project/new/ProjectNew.present.js
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.
It works well in all cases I tried! 🎉
Just a tiny change on using an input
field a a condition to show the element to set that input.
I also added a note on a function you created. Feel free to ignore it if it's not easy to derive a common function
async getVisibilities(namespace, projectVisibility = "private") { | ||
const computeVisibilities = (options) => { | ||
if (options.includes("private")) { | ||
return { | ||
visibilities: ["private"], | ||
default: "private", | ||
}; | ||
} | ||
else if (options.includes("internal")) { | ||
return { | ||
visibilities: ["private", "internal"], | ||
default: "internal", | ||
}; | ||
} | ||
return { | ||
visibilities: ["private", "internal", "public"], | ||
default: "public" | ||
}; | ||
}; | ||
|
||
let availableVisibilities = null; | ||
if (!namespace || !projectVisibility) | ||
return null; | ||
|
||
if (namespace?.kind === "user") { | ||
return computeVisibilities(["public", projectVisibility]); | ||
} | ||
else if (namespace?.kind === "group") { | ||
// get group visibility | ||
const group = await this.client.getGroupByPath(namespace.full_path).then(r => r.data); | ||
return computeVisibilities([group.visibility, projectVisibility]); | ||
} | ||
return availableVisibilities; |
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 is a very nice function!
We have something on the same line in ProjectNew.state.js
at line 466 (async getVisibilities(namespace)
). I'm wondering if it would make sense to merge the 2, or extrapolate a common function. Maybe it's not that straightforward tho...
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.
P.S. this is just a "nice to have". If you think it's feasible (and reasonably easy) let's include it in the PR. Otherwise, feel free to leave this out.
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.
At the very least, I think it would be nice to merge the computeVisibilities
functions. It may be necessary to introduce a maxVisibility(projectVisibility, groupVisibility)
function.
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.
Thanks for the suggestion, I refactor the function to be used also by the NewProjectCoordinator class.
…d fork a project form
dec10ff
to
9e5bacc
Compare
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.
Very nice addition to the fork feature! 🚀
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.
Very nice!
Tearing down the temporary RenkuLab deplyoment for this PR. |
Added a Visibility option to the modal dialog. The initial value should be the same as the project being forked, and only as visible or less visible options should be available.
For a public project: public, internal, private
For an internal project: internal, private
For a private project: private
Display an informative text in the fork modal dialog when the project was forked but the custom visibility can't be added.
Successful fork
Error setting visibility
Error when setting visibility when closing the modal
closes #1272
/deploy