+
+ {action.icon && action.icon}
+
+
+ {ancestors.length > 0 &&
+ ancestors.map((ancestor) => (
+
+
+ {ancestor.name}
+
+
+ ›
+
+
+ ))}
+ {action.name}
+
+ {action.subtitle && (
+
{action.subtitle}
+ )}
+
+
+ {action.shortcut?.length ? (
+
+ {action.shortcut.map((sc) => (
+
+ {sc}
+
+ ))}
+
+ ) : null}
+
+ );
+ }
+);
+
+const mapState = (state: AppState) => ({
+ operatorMode: state.system.operatorMode,
+ features: state.console.session.features,
+});
+
+const connector = connect(mapState, null);
+
+export default connector(ConsoleKBar);
diff --git a/portal-ui/src/screens/Console/Menu/Menu.tsx b/portal-ui/src/screens/Console/Menu/Menu.tsx
index 79705ccb1..ead77bcaa 100644
--- a/portal-ui/src/screens/Console/Menu/Menu.tsx
+++ b/portal-ui/src/screens/Console/Menu/Menu.tsx
@@ -16,7 +16,6 @@
import React from "react";
import { connect } from "react-redux";
-import { NavLink } from "react-router-dom";
import { Drawer } from "@mui/material";
import withStyles from "@mui/styles/withStyles";
import { Theme } from "@mui/material/styles";
@@ -24,7 +23,6 @@ import createStyles from "@mui/styles/createStyles";
import clsx from "clsx";
import { AppState } from "../../../store";
import { setMenuOpen, userLoggedIn } from "../../../actions";
-import { IMenuItem } from "./types";
import { ErrorResponseHandler } from "../../../common/types";
import { clearSession } from "../../../common/utils";
@@ -33,45 +31,9 @@ import history from "../../../history";
import api from "../../../common/api";
import { resetSession } from "../actions";
-import {
- DocumentationIcon,
- LambdaIcon,
- LicenseIcon,
- StorageIcon,
- TenantsOutlineIcon,
- TiersIcon,
-} from "../../../icons";
-
-import {
- AccessMenuIcon,
- AccountsMenuIcon,
- AuditLogsMenuIcon,
- BucketsMenuIcon,
- DrivesMenuIcon,
- GroupsMenuIcon,
- HealthMenuIcon,
- IdentityMenuIcon,
- LogsMenuIcon,
- MetricsMenuIcon,
- MonitoringMenuIcon,
- PerformanceMenuIcon,
- SupportMenuIcon,
- TraceMenuIcon,
- UsersMenuIcon,
-} from "../../../icons/SidebarMenus/MenuIcons";
-import {
- CONSOLE_UI_RESOURCE,
- IAM_PAGES,
- IAM_PAGES_PERMISSIONS,
- IAM_SCOPES,
- S3_ALL_RESOURCES,
-} from "../../../common/SecureComponent/permissions";
-import { hasPermission } from "../../../common/SecureComponent/SecureComponent";
import MenuToggle from "./MenuToggle";
import ConsoleMenuList from "./ConsoleMenuList";
-import RegisterMenuIcon from "../../../icons/SidebarMenus/RegisterMenuIcon";
-import SettingsIcon from "../../../icons/SettingsIcon";
-import WatchIcon from "../../../icons/WatchIcon";
+import { validRoutes } from "../valid-routes";
const drawerWidth = 245;
@@ -157,293 +119,7 @@ const Menu = ({
deleteSession();
});
};
-
- const ldapIsEnabled = (features && features.includes("ldap-idp")) || false;
-
- let consoleMenus: IMenuItem[] = [
- {
- name: "Buckets",
- id: "buckets",
- component: NavLink,
- to: IAM_PAGES.BUCKETS,
- icon: BucketsMenuIcon,
- forceDisplay: true,
- children: [],
- },
- {
- name: "Identity",
- id: "identity",
- icon: IdentityMenuIcon,
- children: [
- {
- component: NavLink,
- id: "users",
- to: IAM_PAGES.USERS,
- customPermissionFnc: () =>
- hasPermission(CONSOLE_UI_RESOURCE, [IAM_SCOPES.ADMIN_LIST_USERS]) ||
- hasPermission(S3_ALL_RESOURCES, [IAM_SCOPES.ADMIN_CREATE_USER]),
- name: "Users",
- icon: UsersMenuIcon,
- fsHidden: ldapIsEnabled,
- },
- {
- component: NavLink,
- id: "groups",
- to: IAM_PAGES.GROUPS,
- name: "Groups",
- icon: GroupsMenuIcon,
- fsHidden: ldapIsEnabled,
- },
- {
- component: NavLink,
- id: "serviceaccounts",
- to: IAM_PAGES.ACCOUNT,
- name: "Service Accounts",
- icon: AccountsMenuIcon,
- forceDisplay: true,
- },
- ],
- },
- {
- name: "Access",
- component: NavLink,
- id: "access",
- to: IAM_PAGES.POLICIES,
- icon: AccessMenuIcon,
- },
-
- {
- name: "Monitoring",
- id: "tools",
- icon: MonitoringMenuIcon,
- children: [
- {
- name: "Metrics",
- id: "monitorMetrics",
- to: IAM_PAGES.DASHBOARD,
- icon: MetricsMenuIcon,
- component: NavLink,
- },
- {
- name: "Logs ",
- id: "monitorLogs",
- to: IAM_PAGES.TOOLS_LOGS,
- icon: LogsMenuIcon,
- component: NavLink,
- },
- {
- name: "Audit",
- id: "monitorAudit",
- to: IAM_PAGES.TOOLS_AUDITLOGS,
- icon: AuditLogsMenuIcon,
- component: NavLink,
- },
- {
- name: "Trace",
- id: "monitorTrace",
- to: IAM_PAGES.TOOLS_TRACE,
- icon: TraceMenuIcon,
- component: NavLink,
- },
- {
- name: "Watch",
- id: "watch",
- component: NavLink,
- icon: WatchIcon,
- to: IAM_PAGES.TOOLS_WATCH,
- },
- {
- name: "Drives",
- id: "monitorDrives",
- to: IAM_PAGES.TOOLS_HEAL,
- icon: DrivesMenuIcon,
- component: NavLink,
- },
- ],
- },
- {
- name: "Support",
- id: "support",
- icon: SupportMenuIcon,
- children: [
- {
- name: "Register",
- id: "register",
- component: NavLink,
- icon: RegisterMenuIcon,
- to: IAM_PAGES.REGISTER_SUPPORT,
- },
- {
- name: "Health",
- id: "diagnostics",
- component: NavLink,
- icon: HealthMenuIcon,
- to: IAM_PAGES.TOOLS_DIAGNOSTICS,
- },
- {
- name: "Performance",
- id: "diagnostics",
- component: NavLink,
- icon: PerformanceMenuIcon,
- to: IAM_PAGES.TOOLS_SPEEDTEST,
- },
-
- // {
- // name: "Call Home",
- // id: "callhome",
- // component: NavLink,
- // icon: CallHomeMenuIcon,
- // to: IAM_PAGES.CALL_HOME,
- // },
- // {
- // name: "Inspect",
- // id: "inspect",
- // component: NavLink,
- // icon: InspectMenuIcon,
- // to: IAM_PAGES.TOOLS_WATCH,
- // },
- // {
- // name: "Profile",
- // id: "profile",
- // component: NavLink,
- // icon: ProfileMenuIcon,
- // to: IAM_PAGES.PROFILE,
- // },
- ],
- },
- {
- component: NavLink,
- to: IAM_PAGES.LICENSE,
- name: "License",
- id: "license",
- icon: LicenseIcon,
- forceDisplay: true,
- },
- {
- name: "Settings",
- id: "settings",
- icon: SettingsIcon,
- children: [
- {
- component: NavLink,
- to: IAM_PAGES.SETTINGS,
- name: "Configurations",
- id: "configurations",
- icon: SettingsIcon,
- },
- {
- component: NavLink,
- to: IAM_PAGES.NOTIFICATIONS_ENDPOINTS,
- name: "Notifications",
- icon: LambdaIcon,
- id: "lambda",
- },
- {
- component: NavLink,
- to: IAM_PAGES.TIERS,
- name: "Tiers",
- icon: TiersIcon,
- id: "tiers",
- },
- ],
- },
- {
- type: "item",
- component: NavLink,
- to: IAM_PAGES.DOCUMENTATION,
- name: "Documentation",
- icon: DocumentationIcon,
- forceDisplay: true,
- onClick: (
- e:
- | React.MouseEvent