Skip to content

feat(client): changes made to remove iscustomgroup and usages (#839) #1210

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 17 commits into from
Jun 19, 2025

Conversation

Subhadeepghosh1
Copy link
Contributor

Description:
changes made to remove isCustomGroup and Usages

Changes Made:

TeamTileCard.tsx
monolith.store.tsx
TeamsSettingsPage.tsx
AddTeamModal.tsx

@Subhadeepghosh1 Subhadeepghosh1 self-assigned this May 23, 2025
@Subhadeepghosh1 Subhadeepghosh1 requested a review from a team as a code owner May 23, 2025 12:42
Copy link

@CodiumAI-Agent /describe

@CodiumAI-Agent
Copy link

Title

feat(client): changes made to remove iscustomgroup and usages (#839)


User description

Description:
changes made to remove isCustomGroup and Usages

Changes Made:

TeamTileCard.tsx
monolith.store.tsx
TeamsSettingsPage.tsx
AddTeamModal.tsx


PR Type

Enhancement


Description

  • Remove isCustomGroup flag and usages

  • Simplify addTeam/editTeam method signatures

  • Use type property for custom groups

  • Clean up modal, card, and settings props


Changes walkthrough 📝

Relevant files
Enhancement
AddTeamModal.tsx
Simplify add/edit team modal calls                                             

packages/client/src/components/teams/AddTeamModal.tsx

  • Remove conditional ternary on isCustomGroup
  • Call monolithStore.addTeam/editTeam with data.TEAM_TYPE
  • Drop boolean parameter usage entirely
  • +10/-26 
    TeamTileCard.tsx
    Remove isCustomGroup checks in card                                           

    packages/client/src/components/teams/TeamTileCard.tsx

  • Drop isCustomGroup prop destructuring
  • Replace checks with type === 'Custom'
  • Adjust menu and user loading logic
  • +3/-14   
    TeamsSettingsPage.tsx
    Omit isCustomGroup prop on cards                                                 

    packages/client/src/pages/settings/TeamsSettingsPage.tsx

  • Remove isCustomGroup={team.is_custom_group} prop
  • Rely on type for group behavior
  • +0/-1     
    monolith.store.ts
    Simplify addTeam/editTeam store methods                                   

    packages/client/src/stores/monolith/monolith.store.ts

  • Remove isCustomGroup parameter
  • Update signatures to accept type only
  • Drop related URL query param
  • +2/-16   

    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

    Copy link

    @CodiumAI-Agent /improve

    @CodiumAI-Agent
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    Backend Compatibility

    Verify that replacing isCustomGroup with a type query parameter is supported by backend endpoints and that type=Custom is interpreted correctly to maintain existing behavior.

    async addTeam(groupId: string, description: string, type?: string) {
        let url = `${Env.MODULE}/api/auth/admin/`,
            postData = '';
    
        url += 'group/addGroup';
    
        postData += 'groupId=' + encodeURIComponent(groupId);
        postData += '&description=' + encodeURIComponent(description);
        if (type) {
            postData += '&type=' + encodeURIComponent(type);
        }
    
        const response = await axios.post<{ success: boolean }>(url, postData, {
            headers: {
                'content-type': 'application/x-www-form-urlencoded',
            },
        });
    
        return response;
    }
    
    /**
     * @name editTeam
     * @param groupId
     * @param description
     * @param type
     * @returns
     */
    async editTeam(groupId: string, description: string, type?: string) {
    Props Interface

    Ensure that TeamCardProps is updated to include the type property (and any other needed props like tag) so the destructuring in TeamTileCard is valid and no runtime errors occur.

        /** dispatch function */
        dispatch: (val: { type: string; field: string; value: unknown[] }) => void;
    
        /** databases to update */
        teams;
    
        onClick?: (value: string) => void;
    }
    
    const StyledModalTitle = styled(Modal.Title)(({ theme }) => ({

    @CodiumAI-Agent
    Copy link

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Await API call errors

    Replace the promise .then() chain with await so that errors thrown by editTeam
    bubble into the surrounding try/catch. This ensures API failures are properly
    handled and simplifies control flow.

    packages/client/src/components/teams/AddTeamModal.tsx [184-188]

    -const editResponse = monolithStore.editTeam(
    +const response = await monolithStore.editTeam(
         data.TEAM_NAME,
         data.TEAM_DESCRIPTION,
         data.TEAM_TYPE,
     );
    Suggestion importance[1-10]: 8

    __

    Why: The suggestion improves error handling by ensuring errors in editTeam are caught in the existing try/catch and simplifies the promise chain.

    Medium
    General
    Build payload with URLSearchParams

    Use URLSearchParams to assemble the request body instead of manual string
    concatenation. This avoids mistakes with separators or encoding and makes the code
    more maintainable.

    packages/client/src/stores/monolith/monolith.store.ts [1070-1078]

    -let postData = '';
    -postData += 'groupId=' + encodeURIComponent(groupId);
    -postData += '&description=' + encodeURIComponent(description);
    +const params = new URLSearchParams({
    +  groupId: groupId,
    +  description: description,
    +});
     if (type) {
    -    postData += '&type=' + encodeURIComponent(type);
    +  params.append('type', type);
     }
    +const postData = params.toString();
    Suggestion importance[1-10]: 5

    __

    Why: Using URLSearchParams makes assembling the request body more concise, avoids manual string concatenation mistakes, and enhances maintainability.

    Low
    Extract custom group flag

    Extract the type === 'Custom' check into a boolean constant like isCustomGroup at
    the top of the component. This avoids magic strings and repeated logic, improving
    readability.

    packages/client/src/components/teams/TeamTileCard.tsx [323]

    -if (type === 'Custom') {
    +const isCustomGroup = type === 'Custom';
    +if (isCustomGroup) {
    Suggestion importance[1-10]: 4

    __

    Why: Defining isCustomGroup removes the magic string, improves readability, and allows reusing the boolean check throughout the component.

    Low

    Copy link
    Contributor

    @AAfghahi AAfghahi left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    I like that we are putting type into the pixel call, seems a lot cleaner.

    @@ -331,7 +320,7 @@ export const TeamTileCard = (props: TeamCardProps) => {
    return;
    }
    setIsLoading(true);
    if (isCustomGroup) {
    if (type === 'Custom') {
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    what's the difference btwn isCustomGroup and type=== 'Custom'

    @anurag91jain anurag91jain linked an issue May 26, 2025 that may be closed by this pull request
    AAfghahi and others added 2 commits May 28, 2025 15:21
    color: 'success',
    message: 'Successfully updated team',
    });
    onClose({
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    this should do some error checking.

    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    done

    AAfghahi and others added 2 commits June 4, 2025 07:43
    color: 'success',
    message: 'Successfully updated team',
    });
    } catch (e) {
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Another check you should do is to check if OPERATION is equal to Error, sometimes the pixel shows up at as having passed, but it is still an error in the pixel call.

    );
    },
    );
    } catch (e) {
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Same here

    …move_isCustomGroupAndUsages
    anurag91jain and others added 5 commits June 16, 2025 15:47
    …m/SEMOSS/semoss-ui into 839-Remove_isCustomGroupAndUsages
    @anurag91jain anurag91jain merged commit 91cad43 into dev Jun 19, 2025
    3 checks passed
    @anurag91jain anurag91jain deleted the 839-Remove_isCustomGroupAndUsages branch June 19, 2025 09:11
    Copy link

    @CodiumAI-Agent /update_changelog

    @CodiumAI-Agent
    Copy link

    Changelog updates: 🔄

    2025-06-19 *

    Changed

    • Removed isCustomGroup flag and related logic from team UI components and store
    • Refactored team add/edit flows to use async/await and unified type handling (CUSTOM)

    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.

    Remove is_custom_group field and related usages
    4 participants