Skip to content

Commit

Permalink
RavenDB-22631 No menu items on unsecure server fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kalczur authored and ppekrol committed Jul 29, 2024
1 parent d81c3f2 commit c24d357
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { collectionsTrackerSelectors } from "components/common/shell/collections
import { databaseSelectors } from "components/common/shell/databaseSliceSelectors";
import { useAppSelector } from "components/store";
import menu from "common/shell/menu";
import { accessManagerSelectors } from "components/common/shell/accessManagerSliceSelectors";

interface UseStudioSearchSyncRegisterParams {
omniSearch: OmniSearch<StudioSearchItem, StudioSearchItemType>;
Expand All @@ -31,6 +32,7 @@ export function useStudioSearchSyncRegister(props: UseStudioSearchSyncRegisterPa
const activeDatabaseName = useAppSelector(databaseSelectors.activeDatabaseName);
const allDatabaseNames = useAppSelector(databaseSelectors.allDatabaseNames);
const collectionNames = useAppSelector(collectionsTrackerSelectors.collectionNames);
const getCanHandleOperation = useAppSelector(accessManagerSelectors.getCanHandleOperation);

const { appUrl } = useAppUrls();

Expand Down Expand Up @@ -128,10 +130,7 @@ export function useStudioSearchSyncRegister(props: UseStudioSearchSyncRegisterPa
menuLeafs
.filter((item) => item.search?.isExcluded !== true)
.forEach((item) => {
const canHandle = item.requiredAccess
? accessManager.canHandleOperation(item.requiredAccess, activeDatabaseName)
: true;

const canHandle = item.requiredAccess ? getCanHandleOperation(item.requiredAccess) : true;
if (!canHandle) {
return;
}
Expand Down Expand Up @@ -165,7 +164,7 @@ export function useStudioSearchSyncRegister(props: UseStudioSearchSyncRegisterPa
searchItems.filter((x) => x.type === type)
);
});
}, [activeDatabaseName, mainMenu, omniSearch, goToMenuItem, getMenuItemType]);
}, [activeDatabaseName, mainMenu, omniSearch, goToMenuItem, getMenuItemType, getCanHandleOperation]);
}

const databaseRoutePrefix = "databases/";
Expand Down

0 comments on commit c24d357

Please sign in to comment.