-
Notifications
You must be signed in to change notification settings - Fork 6
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
Ability to select SpaceLevel2 on create VC #7386
Conversation
WalkthroughThis pull request introduces changes across multiple files related to the Virtual Contributor creation process and form handling. The modifications focus on improving localization, error handling, and space selection functionality. Key updates include adding a new error message for space selection, refining the Formik autocomplete component's error handling, and updating the space selection logic to support a more complex hierarchical structure of selectable spaces. Changes
Sequence DiagramsequenceDiagram
participant User
participant VCWizard as Virtual Contributor Wizard
participant SpaceSelection as Space Selection Component
participant Backend
User->>VCWizard: Initiate Virtual Contributor Creation
VCWizard->>SpaceSelection: Request Available Spaces
Backend->>SpaceSelection: Return Selectable Spaces
SpaceSelection-->>User: Display Hierarchical Space List
User->>SpaceSelection: Select Space
SpaceSelection->>VCWizard: Validate and Submit Space Selection
alt Space Not Selected
VCWizard-->>User: Display Error: "Unable to find selected spaceId"
else Space Selected
VCWizard->>Backend: Create Virtual Contributor
end
Possibly Related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
...ain/topLevelPages/myDashboard/newVirtualContributorWizard/useNewVirtualContributorWizard.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes are looking good, thanks for optimizing the queries further.
Lazy is far better to track and understand rather than the 'skip' logic.
01b326a
to
dbd454d
Compare
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/main/topLevelPages/myDashboard/newVirtualContributorWizard/ExistingSpace.tsx (1)
36-59
: Recursive subspace handling
This logic meticulously pushes each subspace and sub-subspace into the result. Consider a fully recursive approach if deeper nesting is possible.src/main/topLevelPages/myDashboard/newVirtualContributorWizard/useNewVirtualContributorWizard.tsx (2)
103-104
: Auto-selecting the first space
Defaulting toaccount?.spaces?.[0]
might be confusing if multiple spaces exist. Consider prompting the user explicitly.
259-276
: Looping over parentRoleSetIds
Adding the VC to each parent role can be time-consuming. Consider whether parallel updates or partial failure handling is needed.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
src/core/apollo/generated/apollo-hooks.ts
is excluded by!**/generated/**
src/core/apollo/generated/graphql-schema.ts
is excluded by!**/generated/**
📒 Files selected for processing (5)
src/core/i18n/en/translation.en.json
(1 hunks)src/core/ui/forms/FormikAutocomplete.tsx
(2 hunks)src/main/topLevelPages/myDashboard/newVirtualContributorWizard/ExistingSpace.tsx
(4 hunks)src/main/topLevelPages/myDashboard/newVirtualContributorWizard/newVirtualContributorQueries.graphql
(1 hunks)src/main/topLevelPages/myDashboard/newVirtualContributorWizard/useNewVirtualContributorWizard.tsx
(5 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
src/core/ui/forms/FormikAutocomplete.tsx (1)
Pattern src/**/*.{ts,tsx,js}
: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Use the following code guide documentation in the codebase: 'docs/code-guidelines.md'.
Ensure sufficient error handling and logging is present, but note:
- We have a global error handler in place. So local
try/catch
blocks are not required unless they provide value beyond what the global error handler already covers. - Avoid flagging the absence of local error handling in cases where the global error handler suffices.
- Avoid flagging the absence of logging in cases where the global logger is already in place (graphql usage).
Inform about the recommendation of not using non-null assertion,
except on GraphQL queries where the variable is asserted non-null and followed by a
skip:
with the same variable.
Examples:
- Not Required: there's a skip
{
variables: { templateId: templateId! },
skip: !templateId,
}
Check for common security vulnerabilities such as:
- SQL Injection
- XSS (Cross-Site Scripting)
- CSRF (Cross-Site Request Forgery)
- Insecure dependencies
- Sensitive data exposure
src/main/topLevelPages/myDashboard/newVirtualContributorWizard/newVirtualContributorQueries.graphql (1)
Pattern src/**/*.{graphql,gql}
: Review the GraphQL schema and queries for best practices, potential bugs, and adherence to the project's GraphQL standards.
Ensure that the schema is well-defined and queries are optimized.
Check for security vulnerabilities.
src/main/topLevelPages/myDashboard/newVirtualContributorWizard/useNewVirtualContributorWizard.tsx (1)
Pattern src/**/*.{ts,tsx,js}
: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Use the following code guide documentation in the codebase: 'docs/code-guidelines.md'.
Ensure sufficient error handling and logging is present, but note:
- We have a global error handler in place. So local
try/catch
blocks are not required unless they provide value beyond what the global error handler already covers. - Avoid flagging the absence of local error handling in cases where the global error handler suffices.
- Avoid flagging the absence of logging in cases where the global logger is already in place (graphql usage).
Inform about the recommendation of not using non-null assertion,
except on GraphQL queries where the variable is asserted non-null and followed by a
skip:
with the same variable.
Examples:
- Not Required: there's a skip
{
variables: { templateId: templateId! },
skip: !templateId,
}
Check for common security vulnerabilities such as:
- SQL Injection
- XSS (Cross-Site Scripting)
- CSRF (Cross-Site Request Forgery)
- Insecure dependencies
- Sensitive data exposure
src/main/topLevelPages/myDashboard/newVirtualContributorWizard/ExistingSpace.tsx (1)
Pattern src/**/*.{ts,tsx,js}
: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Use the following code guide documentation in the codebase: 'docs/code-guidelines.md'.
Ensure sufficient error handling and logging is present, but note:
- We have a global error handler in place. So local
try/catch
blocks are not required unless they provide value beyond what the global error handler already covers. - Avoid flagging the absence of local error handling in cases where the global error handler suffices.
- Avoid flagging the absence of logging in cases where the global logger is already in place (graphql usage).
Inform about the recommendation of not using non-null assertion,
except on GraphQL queries where the variable is asserted non-null and followed by a
skip:
with the same variable.
Examples:
- Not Required: there's a skip
{
variables: { templateId: templateId! },
skip: !templateId,
}
Check for common security vulnerabilities such as:
- SQL Injection
- XSS (Cross-Site Scripting)
- CSRF (Cross-Site Request Forgery)
- Insecure dependencies
- Sensitive data exposure
src/core/i18n/en/translation.en.json (1)
Pattern src/**/*.json
: Review the JSON files for correct syntax and structure.
Ensure that the configuration and data are accurate and follow the project's standards.
Check for sensitive data exposure and ensure that the data is properly validated.
🔇 Additional comments (16)
src/core/ui/forms/FormikAutocomplete.tsx (2)
36-36
: Show errors only after the field is touched
This check prevents displaying errors prematurely and enhances user experience.
59-62
: Marking the field as touched onBlur
Callinghelpers.setTouched(true)
beforefield.onBlur(e)
ensures correct error highlighting and form state handling.src/main/topLevelPages/myDashboard/newVirtualContributorWizard/ExistingSpace.tsx (6)
1-1
: useMemo import
UsinguseMemo
for memoized computations can help optimize performance in complex data transformations.
10-11
: Replacing FormikSelect with FormikAutocomplete
Importing the new component aligns with the enhanced error handling approach.
13-18
: New interface for knowledge spaces
IntroducingSelectableKnowledgeSpace
broadens the structure to incorporate hierarchical parents. Make sure external references are updated consistently.
24-25
: onSubmit type signature updates
Accepting the revisedSelectableKnowledgeSpace
type ensures strong typing and consistent usage.
66-66
: Immediate lookup from listItems
FilteringlistItems
bysubspaceId
for onSubmit is straightforward. Ensure usage of a suitable fallback ifbok
is not found.
88-93
: FormikAutocomplete integration
Swapping toFormikAutocomplete
withdisablePortal={false}
helps present suggestions in the normal DOM flow.src/main/topLevelPages/myDashboard/newVirtualContributorWizard/useNewVirtualContributorWizard.tsx (5)
29-29
: Import ExistingSpace and SelectableKnowledgeSpace
The import is consistent with the refactored type definitions inExistingSpace.tsx
.
52-65
: New SelectableSpace type
Defining a clear structure matches the GraphQL fragment’s fields. Good for consistency.
277-299
: Fallback if no space selected
Properly shows an error message when neithercreatedSpaceId
norselectedExistingSpaceId
is present.
304-320
: Navigate to new space or fallback
Fetching the space URL on demand is a sound approach. Consider verifying the possibility of an empty or invalid response.
424-438
: Adding VC to community with knowledge
PassingselectedKnowledge.parentRoleSetIds
ensures the contributor is added to each parent space’s community as well. Make sure to handle potential mismatches in parent role sets.src/main/topLevelPages/myDashboard/newVirtualContributorWizard/newVirtualContributorQueries.graphql (2)
21-25
: Adopting the new VCSelectableSpace fragment
Referencing the fragment for each subspace simplifies and centralizes the field definitions.
34-52
: VCSelectableSpace fragment definition
Using a fragment increases maintainability and avoids repetition. Verify that all included fields (likeauthorization
) are necessary to keep payload size minimal.src/core/i18n/en/translation.en.json (1)
3232-3234
: LGTM! Clear and well-structured error message.The error message is concise, informative, and properly placed within the Virtual Contributor wizard section.
src/main/topLevelPages/myDashboard/newVirtualContributorWizard/ExistingSpace.tsx
Show resolved
Hide resolved
…#7381) * added new tabs to user + org admin pages; refactored how admin pages for users + orgs + vcs are managed; moved some global admin functionality out of domain down to platform admin; ... * updated generation to match api tidy ups related to set of preference types + ID passing for org mutations * fix compile errors related to dropping of separate UserPreferenceType enum * Synchronize icons, remove comments, make sure there are no redundant settings calls. * Links & Docs to BoK on VC creation (#7365) * VC documents and links BoK - refactor the AddContent * VC documents and links implementation without validation; * resolve rabbit comments --------- Co-authored-by: Petar Kolev <[email protected]> Co-authored-by: reactoholic <[email protected]> * Links and Docs - forgotten commit with Validation (#7377) * CalloutsSet entity (#7376) * codegen passing with updated api * fixed api + codegen passes * code compiling * pick up create callout privilege from the CalloutsSet * callouts showing up after creation * retrieving of callouts using only calloutsSet ID * moved code around to have notion of calloutsSet in tree * fix array dep breaking tool creation; small code optimizations; --------- Co-authored-by: bobbykolev <[email protected]> * VC knowledge base instead of subspace init * Space creation after VC creation, loading, code opt & reorganization * Fix docs uploading, code organization and documentation; * fix uploading of docs in case there's no space under the acc; remove misleading createdSpaceId usage; * useLoadingState instead of a new React State * Fix - set properly the persona type depending on the 3 steps; * Ability to select SpaceLevel2 on create VC (#7386) * VC Knowledge Base callouts dialog (#7388) * VC Knowledge Base callouts dialog - init. * Filter available callout types. * disable rich media on VC callout creation. * Description component with update functionality. * Update the Create Written Knowledge UI and initial state; Fix dialog titles in VC flow. * Reingest logic in the Knowledge dialog. * Remove the icon logic for CalloutVisibilityChangeDialog. * Use the account hostname for space created in the VC flow. * fix VC dialog not opening; remove outdated copy; * storage config for KnowledgeBase description --------- Co-authored-by: Neil Smyth <[email protected]> Co-authored-by: Petar Kolev <[email protected]> Co-authored-by: reactoholic <[email protected]> Co-authored-by: Neil Smyth <[email protected]> Co-authored-by: Carlos Cano <[email protected]>
Describe the background of your pull request
What does your pull request do? Does it solve a bug (which one?), add a feature?
Additional context
Add any other context
Governance
By submitting this pull request I confirm that:
https://github.com/alkem-io/Coordination/blob/master/LICENSE.
Summary by CodeRabbit
Release Notes
Localization
Form Improvements
Virtual Contributor Creation
Technical Enhancements