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

[release-4.4] Bug 1806585: only show "Create Project" option in project dropdown i… #4439

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 11 additions & 7 deletions frontend/public/components/namespace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,9 @@ const defaultBookmarks = {};
const namespaceBarDropdownStateToProps = (state) => {
const activeNamespace = state.UI.get('activeNamespace');
const canListNS = state[featureReducerName].get(FLAGS.CAN_LIST_NS);
const canCreateProject = state[featureReducerName].get(FLAGS.CAN_CREATE_PROJECT);

return { activeNamespace, canListNS };
return { activeNamespace, canListNS, canCreateProject };
};
const namespaceBarDropdownDispatchToProps = (dispatch) => ({
setActiveNamespace: (ns) => dispatch(UIActions.setActiveNamespace(ns)),
Expand All @@ -612,6 +613,7 @@ class NamespaceBarDropdowns_ extends React.Component {
onNamespaceChange,
setActiveNamespace,
canListNS,
canCreateProject,
useProjects,
children,
disabled,
Expand Down Expand Up @@ -639,12 +641,14 @@ class NamespaceBarDropdowns_ extends React.Component {
// If the currently active namespace is not found in the list of all namespaces, put it in anyway
items[title] = title;
}
const defaultActionItem = [
{
actionTitle: `Create ${model.label}`,
actionKey: CREATE_NEW_RESOURCE,
},
];
const defaultActionItem = canCreateProject
? [
{
actionTitle: `Create ${model.label}`,
actionKey: CREATE_NEW_RESOURCE,
},
]
: [];

const onChange = (newNamespace) => {
if (newNamespace === CREATE_NEW_RESOURCE) {
Expand Down