Skip to content

SideMenu Changes #1204

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

Merged
merged 5 commits into from
May 30, 2025
Merged

SideMenu Changes #1204

merged 5 commits into from
May 30, 2025

Conversation

ammb-123
Copy link
Contributor

Description

Flag is added to on/off the side menu in the AI CORE app

Changes Made

ADMIN_ONLY_VIEW_MENU_BAR flag added

How to Test

Login to the AI core app ,user can able to view the ai core page without side menu bar and catalog items .
Config api has the adminOnlyViewMenuBarFlag : true

Notes

Uploading AdminUser_updated.docx…

@ammb-123 ammb-123 requested a review from a team as a code owner May 22, 2025 09:03
Copy link

@CodiumAI-Agent /describe

@CodiumAI-Agent
Copy link

Title

SideMenu Changes


User description

Description

Flag is added to on/off the side menu in the AI CORE app

Changes Made

ADMIN_ONLY_VIEW_MENU_BAR flag added

How to Test

Login to the AI core app ,user can able to view the ai core page without side menu bar and catalog items .
Config api has the adminOnlyViewMenuBarFlag : true

Notes

Uploading AdminUser_updated.docx…


PR Type

Enhancement


Description

  • Hide Filterbox when adminOnlyViewMenuBarFlag is true

  • Require isEngineOperationAvailable('APP','add') for display

  • Wrap Filterbox in combined visibility condition


Changes walkthrough 📝

Relevant files
Enhancement
HomePage.tsx`
Conditional `Filterbox` rendering                                               

packages/client/src/pages/HomePage.tsx

  • Added adminOnlyViewMenuBarFlag hide condition
  • Integrated isEngineOperationAvailable('APP','add') check
  • Wrapped Filterbox rendering in combined condition
  • Additional files
    HomePage.tsx +12/-6   

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link

    @CodiumAI-Agent /review

    @CodiumAI-Agent
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Conditional Rendering

    The nested flag and permission check (!configStore.store.config.adminOnlyViewMenuBarFlag && configStore.isEngineOperationAvailable(...)) could become hard to maintain or extend. Consider extracting this into a clearly named boolean or helper function for readability.

    {!configStore.store.config.adminOnlyViewMenuBarFlag &&
        configStore.isEngineOperationAvailable(
            'APP',
            'add',
        ) && (
            <Filterbox
                type={'APP'}
                onChange={(filters: Record<string, unknown>) => {
                    setMetaFilters(filters);
                }}
            />
        )}
    Default Flag Value

    If adminOnlyViewMenuBarFlag is undefined, the negation check may not behave as expected. Ensure the flag has a defined default (e.g., false) or explicitly coerce it to a boolean.

    {!configStore.store.config.adminOnlyViewMenuBarFlag &&
        configStore.isEngineOperationAvailable(
    Missing Tests

    No tests were added or updated to cover the new flag logic. Consider adding unit or integration tests to validate both flag on/off states.

    {!configStore.store.config.adminOnlyViewMenuBarFlag &&
        configStore.isEngineOperationAvailable(
            'APP',
            'add',
        ) && (
            <Filterbox
                type={'APP'}
                onChange={(filters: Record<string, unknown>) => {
                    setMetaFilters(filters);
                }}
            />
        )}

    Copy link

    @CodiumAI-Agent /improve

    @CodiumAI-Agent
    Copy link

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Add optional chaining guard

    Use optional chaining when reading nested properties to prevent runtime errors if
    store or config is undefined. This ensures the guard on adminOnlyViewMenuBarFlag
    won’t throw.

    packages/client/src/pages/HomePage.tsx [353-364]

    -{!configStore.store.config.adminOnlyViewMenuBarFlag &&
    -    configStore.isEngineOperationAvailable(
    -        'APP',
    -        'add',
    -    ) && (
    -        <Filterbox
    -            type={'APP'}
    -            onChange={(filters: Record<string, unknown>) => {
    -                setMetaFilters(filters);
    -            }}
    -        />
    -    )}
    +{ !configStore.store?.config?.adminOnlyViewMenuBarFlag &&
    +  configStore.isEngineOperationAvailable('APP', 'add') && (
    +    <Filterbox
    +      type={'APP'}
    +      onChange={(filters: Record<string, unknown>) => {
    +        setMetaFilters(filters);
    +      }}
    +    />
    +  )}
    Suggestion importance[1-10]: 5

    __

    Why: Using optional chaining on configStore.store?.config prevents potential runtime errors when store or config is undefined without significantly altering behavior.

    Low
    General
    Memoize visibility condition

    Extract the visibility condition into a useMemo or variable to avoid repeated calls
    and improve readability. Then use that variable in the JSX.

    packages/client/src/pages/HomePage.tsx [353-364]

    -{!configStore.store.config.adminOnlyViewMenuBarFlag &&
    -    configStore.isEngineOperationAvailable(
    -        'APP',
    -        'add',
    -    ) && (
    -        <Filterbox
    -            ...
    -        />
    -    )}
    +const showFilterbox = useMemo(
    +  () => !configStore.store.config.adminOnlyViewMenuBarFlag &&
    +        configStore.isEngineOperationAvailable('APP', 'add'),
    +  [configStore.store.config.adminOnlyViewMenuBarFlag, configStore]
    +);
    +...
    +{showFilterbox && (
    +  <Filterbox
    +    type={'APP'}
    +    onChange={(filters: Record<string, unknown>) => setMetaFilters(filters)}
    +  />
    +)}
    Suggestion importance[1-10]: 5

    __

    Why: Extracting the filterbox visibility into useMemo improves readability and avoids recalculating the condition on each render.

    Low
    Simplify onChange callback

    Pass setMetaFilters directly as the callback to avoid recreating the arrow function
    on each render and simplify the code.

    packages/client/src/pages/HomePage.tsx [360-362]

    -onChange={(filters: Record<string, unknown>) => {
    -    setMetaFilters(filters);
    -}}
    +onChange={setMetaFilters}
    Suggestion importance[1-10]: 4

    __

    Why: Passing setMetaFilters directly reduces unnecessary arrow function creation and simplifies the JSX.

    Low

    ammb-123 added 2 commits May 23, 2025 11:43
    @neelneelneel neelneelneel self-assigned this May 30, 2025
    @neelneelneel neelneelneel merged commit 86fe372 into dev May 30, 2025
    3 checks passed
    @neelneelneel neelneelneel deleted the filterBox_change branch May 30, 2025 18:13
    Copy link

    @CodiumAI-Agent /update_changelog

    @CodiumAI-Agent
    Copy link

    Changelog updates: 🔄

    2025-05-30 *

    Added

    • Add ADMIN_ONLY_VIEW_MENU_BAR flag and update side‐menu visibility logic

    to commit the new content to the CHANGELOG.md file, please type:
    '/update_changelog --pr_update_changelog.push_changelog_changes=true'

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    None yet

    3 participants