Skip to content

Conversation

@ayushjain17
Copy link
Collaborator

@ayushjain17 ayushjain17 commented Jan 31, 2026

ChangeLog

  1. Changed create and edit default config drawers into full-fledged pages with continued support for prefix auto fill for create
  2. Using {resource}/action/create path for create pages for different resources to allow the resources to have an entity called create

Summary by CodeRabbit

  • New Features

    • Added dedicated create and edit pages for default configuration management with improved form handling and navigation.
  • Bug Fixes & Improvements

    • Reorganized create and edit routes to use standardized /action/create and /{entity}/edit URL patterns.
    • Enhanced form cancellation by replacing callbacks with direct URL navigation for better user experience.
    • Updated dimension and function form layouts with improved UI structure and inline controls.
  • Refactor

    • Consolidated default configuration API operations into a centralized module for improved consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

@ayushjain17 ayushjain17 requested a review from a team as a code owner January 31, 2026 18:38
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jan 31, 2026

@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

Walkthrough

This PR reorganizes the frontend API surface by consolidating default-config operations into a dedicated default_configs module with get/delete/fetch functions, expands public exports across dimensions/workspaces/variables/experiment_groups modules, updates routing to use action-based paths, and refactors UI components to use the new API structure with updated navigation patterns.

Changes

Cohort / File(s) Summary
API Module Reorganization
crates/frontend/src/api.rs
Introduced new default_configs module with CRUD functions (get, delete, fetch). Restructured and expanded public exports for dimensions, workspaces, variables, and experiment_groups modules, moving types from top-level to module-specific visibility.
Application Routing
crates/frontend/src/app.rs
Updated route paths from /create to /action/create for dimensions, functions, and default-config. Added new default-config action routes (create and edit) and grouped default_config imports with new CreateDefaultConfig and EditDefaultConfig components.
Form Components
crates/frontend/src/components/default_config_form.rs, dimension_form.rs, function_form.rs
Refactored DefaultConfigForm to use URL-based cancel navigation instead of callbacks; updated DimensionForm with new form sections (derived-from dropdown, Monaco editor for type schema, position validation); simplified FunctionForm cancel button navigation path.
Default Config Pages
crates/frontend/src/pages/default_config.rs, default_config_list.rs, default_config_list/types.rs
Replaced inline drawer-based edit/create flows with dedicated EditDefaultConfig and CreateDefaultConfig components. Introduced CreatePageParams type with QueryParam derive. Updated fetch calls from individual functions to default_configs::fetch module path. Implemented From conversion for CreatePageParams.
Page API Updates
crates/frontend/src/pages/context_override.rs, experiment.rs, experiment_list.rs
Updated API calls from fetch_default_config to default_configs::fetch. Added org_id parameter to experiment.rs fetch call, aligning with new module signature.
Navigation Updates
crates/frontend/src/pages/dimension.rs, dimensions.rs, function/function_list.rs
Updated href targets: CreateDimension cancel path adjusted, dimensions create button changed from create to action/create, function_list create button changed from create to action/create.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

UI

Suggested reviewers

  • knutties

Poem

🐰 A hop through the API, routes rearranged with care,
Default configs bundled neat in modules everywhere,
Forms refined with Monaco and buttons freshly placed,
Navigation flows now guided—what a well-structured space! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 59.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: converting default config create/edit drawers into standalone pages, which is the primary objective of this PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch standalone-default-config-action

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@crates/frontend/src/components/default_config_form.rs`:
- Around line 195-196: The call to use_navigate() must be moved out of the async
context: capture the navigate function by calling use_navigate() before entering
the spawn_local async block (e.g., let navigate = use_navigate();), then inside
the spawn_local closure invoke navigate(&redirect_url, Default::default());
ensure you remove any nested use_navigate() calls and use the captured navigate
variable within the async task so the Leptos reactive runtime is accessed from
the correct context.
🧹 Nitpick comments (1)
crates/frontend/src/components/dimension_form.rs (1)

468-475: Unreachable code branch in monaco_margin calculation.

The monaco_margin variable checks for DimensionTypeOptions::LocalCohort, but this code is inside the Regular | RemoteCohort match arm (line 448-449), so the condition will always be false and monaco_margin will always be "mt-3".

♻️ Suggested simplification
-                                                let monaco_margin = if matches!(
-                                                    dimension_type_rs.get(),
-                                                    DimensionTypeOptions::LocalCohort
-                                                ) {
-                                                    ""
-                                                } else {
-                                                    "mt-3"
-                                                };
+                                                let monaco_margin = "mt-3";

Comment on lines +195 to +196
let navigate = use_navigate();
navigate(&redirect_url, Default::default());
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Move use_navigate() outside the async block.

Calling use_navigate() inside spawn_local may cause issues because Leptos hooks typically require access to the reactive runtime context, which may not be available inside async blocks. Consider capturing the navigate function before entering the async context.

🔧 Proposed fix

Capture navigate before spawn_local:

     let on_submit = Callback::new(move |_| {
         req_inprogress_ws.set(true);
         let key_name = config_key_rs.get_untracked();
         // ... other local variables ...
         let redirect_url = format!(
             "/admin/{}/{}/default-config/{}",
             org.0, workspace.0, key_name
         );
+        let navigate = use_navigate();

         let is_edit = edit;

         spawn_local(async move {
             // ... async logic ...
             match result {
                 Ok(ResponseType::UpdatePrecheck) => (),
                 Ok(ResponseType::Response) => {
-                    let navigate = use_navigate();
                     navigate(&redirect_url, Default::default());
                     // ... rest of success handling
                 }
                 // ...
             }
         });
     });
🤖 Prompt for AI Agents
In `@crates/frontend/src/components/default_config_form.rs` around lines 195 -
196, The call to use_navigate() must be moved out of the async context: capture
the navigate function by calling use_navigate() before entering the spawn_local
async block (e.g., let navigate = use_navigate();), then inside the spawn_local
closure invoke navigate(&redirect_url, Default::default()); ensure you remove
any nested use_navigate() calls and use the captured navigate variable within
the async task so the Leptos reactive runtime is accessed from the correct
context.

@ayushjain17 ayushjain17 added enhancement New feature or request UI things relating to the UI labels Feb 1, 2026
Ok(())
}

pub async fn fetch(
Copy link
Collaborator

@knutties knutties Feb 1, 2026

Choose a reason for hiding this comment

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

Minor nit: list or getAll or fetchAll is a better name ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fair point, was just following the previous convention which we were following
we can rename them

@ayushjain17 ayushjain17 requested a review from knutties February 1, 2026 14:51
workspace.get().0,
)
}
href="../../../function"
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is a little flaky ? will it always be three ../../../ ? or should directly point to function page like it was originally ?

Copy link
Collaborator Author

@ayushjain17 ayushjain17 Feb 1, 2026

Choose a reason for hiding this comment

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

From create page its always 3 sets of ../ only

});

let cancel_url = format!(
"../../../default-config?{}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment as above.

<Route ssr=SsrMode::Async path="dimensions/create" view=CreateDimension />
<Route
ssr=SsrMode::Async
path="dimensions/action/create"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use something else other than action for path segment - kind of clashes with a dimension/default-config/function named action ? just -new- might suffice as a special case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It wont be colliding though, right ?
As the next argument in the path has to be create which wont be there

I chose action so that we can extend it further if we will have anything in future

@ayushjain17 ayushjain17 requested a review from knutties February 2, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request UI things relating to the UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants