fix: hide uncategorized from nav, when it is not available to RBAC user
@@ -116,8 +116,15 @@ const NavigationSideBar: React.FC = () => {
const shortVersion = version.replace(/^(\d+\.\d+\.\d+).*?$/i, '$1');
const isVersionLong = version !== shortVersion;
- const menuConfig = useMemo(
- () => ({
+ const { canCreateWorkspace, canViewWorkspace } = usePermissions();
+
+ const canAccessUncategorized = canViewWorkspace({ workspace: { id: 1 } });
+
+ const menuConfig = useMemo(() => {
+ const topNav = canAccessUncategorized
+ ? [{ icon: 'experiment', label: 'Uncategorized', path: paths.uncategorized() }]
+ : [];
+ return {
bottom: [
{ external: true, icon: 'docs', label: 'Docs', path: paths.docs(), popout: true },
{
@@ -136,14 +143,13 @@ const NavigationSideBar: React.FC = () => {
},
],
top: [
- { icon: 'experiment', label: 'Uncategorized', path: paths.uncategorized() },
+ ...topNav,
{ icon: 'model', label: 'Model Registry', path: paths.modelList() },
{ icon: 'tasks', label: 'Tasks', path: paths.taskList() },
{ icon: 'cluster', label: 'Cluster', path: paths.cluster() },
],
- }),
- [info.branding],
- );
+ };
+ }, [canAccessUncategorized, info.branding]);
const handleCollapse = useCallback(() => {
updateSettings({ navbarCollapsed: !settings.navbarCollapsed });
@@ -153,8 +159,6 @@ const NavigationSideBar: React.FC = () => {
openWorkspaceCreateModal();
}, [openWorkspaceCreateModal]);
- const { canCreateWorkspace } = usePermissions();
-
if (!showNavigation) return null;
return (
