Skip to content

Conversation

@adityachoudhari26
Copy link
Contributor

@adityachoudhari26 adityachoudhari26 commented Mar 17, 2025

Summary by CodeRabbit

  • Refactor
    • Centralized URL generation across the application to ensure consistent navigation links for deployments, environments, policies, runbooks, resources, integrations, settings, and profile management.
    • Improved parameter handling for more reliable link construction and navigation throughout various sections of the app.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2025

Walkthrough

This pull request refactors URL generation across multiple components by centralizing the construction logic through the urls module. Inline string interpolations have been replaced with method chains that build URLs dynamically for deployments, environments, resources, settings, integrations, and more. Minor adjustments such as parameter destructuring and type signature updates support the new approach. The main urls.ts module has been expanded to include new functions for integrations, job agents, resources, and runbooks, ensuring a consistent and maintainable URL management strategy across the application.

Changes

File(s) Summary of Changes
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/.../TableCells.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/.../VariableTable.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/.../layout.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/.../PolicyTabs.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/.../DeploymentVersionChannels.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/.../variables/page.tsx
Refactored URL constructions by replacing inline templated strings with new constants (e.g., versionUrl, workspaceUrls) from the urls module. Updated parameter destructuring and ensured consistent chaining for deployment and environment components.
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(sidebar)/.../EnvironmentRow.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(sidebar)/policies/TargetFilterUniquenessIndicator.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(sidebar)/runbooks/RunbookGettingStarted.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(sidebar)/runbooks/page.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/_components/deployments/environment-cell/DeploymentEnvironmentCell.tsx
Centralized URL generation for sidebar and shared deployment components. Replaced hardcoded URLs with dynamically generated ones (e.g., environmentUrl, envResourcesUrl) for environments, resources, and runbooks.
apps/webservice/src/app/[workspaceSlug]/(app)/UserAvatarMenu.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/DeploymentVersionChannels.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/_components/resources/condition/ResourceList.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/_components/resources/drawer/ResourceDrawer.tsx
Updated user-related and resource components to use the centralized urls for generating profile, version channels, and resource visualization URLs. Type signature for URL parameters has been adjusted where needed.
apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx Updated the layout by introducing a workspaceUrls constant to dynamically generate sidebar navigation links (Resources, Insights, Settings) using the urls module.
apps/webservice/src/app/[workspaceSlug]/(app)/resources/(raw)/[resourceId]/layout.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/resources/(raw)/[resourceId]/variables/page.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/ResourceProvidersGettingStarted.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/page.tsx
Refactored resource pages to construct URLs via the urls module. Involved updating links for resource layouts, variable pages, and provider integrations to use dynamic URL generators.
apps/webservice/src/app/[workspaceSlug]/(app)/settings/page.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/settings/workspace/integrations/page.tsx
apps/webservice/src/app/[workspaceSlug]/(app)/settings/workspace/overview/page.tsx
Reworked settings pages so that redirects and integration links are generated using methods from urls.workspace(...) and associated objects, eliminating inline templating.
apps/webservice/src/app/urls.ts Expanded the urls module to add new functions: workspaceSettingsIntegrations, workspaceJobAgents, resource, and runbooks for modularized URL generation.
apps/webservice/src/components/form/job-agent/JobAgentSelector.tsx Modified the JobAgentSelector component to use urls.workspace(...).agents().integrations() for Link URL generation, replacing the earlier template-based approach.
apps/webservice/src/app/[workspaceSlug]/(app)/settings/account/profile/GithubRedirectButton.tsx Updated URL construction in GithubRedirectButton to use method calls instead of string concatenation for GitHub integration links.

Sequence Diagram(s)

sequenceDiagram
  participant C as Component
  participant U as urls Module
  participant L as Link Component

  C->>U: Call URL generation method (e.g., urls.workspace(slug).resources())
  U-->>C: Return constructed URL
  C->>L: Pass URL to Link's href attribute
Loading

Possibly related PRs

  • fix: Move systems to deploys #357: Involves similar modifications to URL construction using the urls utility within deployment components, indicating a shared focus on centralized URL management.

Suggested reviewers

  • jsbroks

Poem

Oh, how the code did hop and skip,
Refactoring URLs with one neat trick,
No more hardcoded strings in sight,
The urls module makes it all so light.
Bouncing through components with glee,
A rabbit cheers for clarity! 🐇
CodeRabbit Inc. leads the spree!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 843f3f4 and aaa7649.

📒 Files selected for processing (1)
  • apps/webservice/src/app/[workspaceSlug]/(app)/settings/account/profile/GithubRedirectButton.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{ts,tsx}`: **Note on Error Handling:** Avoid strict en...

**/*.{ts,tsx}: Note on Error Handling:
Avoid strict enforcement of try/catch blocks. Code may use early returns, Promise chains (.then().catch()), or other patterns for error handling. These are acceptable as long as they maintain clarity and predictability.

  • apps/webservice/src/app/[workspaceSlug]/(app)/settings/account/profile/GithubRedirectButton.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Typecheck
  • GitHub Check: build (linux/amd64)
  • GitHub Check: Lint
🔇 Additional comments (1)
apps/webservice/src/app/[workspaceSlug]/(app)/settings/account/profile/GithubRedirectButton.tsx (1)

24-24: Great use of the url library method chain!

This change improves the code by replacing string concatenation with a structured method call. Using urls.workspace(workspace.slug).settings().integrations().github() instead of template string concatenation makes the URL construction more type-safe, maintainable, and consistent with the broader refactoring effort across the application.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (5)
apps/webservice/src/app/[workspaceSlug]/(app)/resources/(raw)/[resourceId]/layout.tsx (1)

52-52: Link still uses hardcoded URL pattern.

While you've updated line 45 to use the url library, this Link component still uses string interpolation. For consistency, consider updating this as well.

-                <BreadcrumbLink href={`/${params.workspaceSlug}/resources`}>
+                <BreadcrumbLink href={resourcesUrl}>
apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/page.tsx (1)

45-45: Consider using the same import path pattern as other files.

Other files in this PR use the path ~/app/urls for importing the urls module, but this file uses a relative path. Consider standardizing the import path for consistency.

-import { urls } from "../../../../../urls";
+import { urls } from "~/app/urls";
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/runbooks/page.tsx (1)

9-9: Consider using a more concise import path for the urls module.

The import path is quite deep with many parent directory references. Consider aliasing this path or using a shorter path like ~/app/urls as done in other files.

-import { urls } from "../../../../../../../../urls";
+import { urls } from "~/app/urls";
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/channels/DeploymentVersionChannels.tsx (1)

18-18: Consider using a more concise import path for the urls module.

The import path is quite deep with many parent directory references. Consider aliasing this path or using a shorter path like ~/app/urls as done in other files.

-import { urls } from "../../../../../../../../../../../urls";
+import { urls } from "~/app/urls";
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableTable.tsx (1)

269-269: Consider using the url module's API for query parameters.

Instead of concatenating the URL with template strings, check if the urls module offers a method to handle query parameters more elegantly.

-href={`${workspaceUrls.resources().baseUrl()}?filter=${v.filterHash}`}
+href={workspaceUrls.resources().withQuery({ filter: v.filterHash }).baseUrl()}

(Note: This assumes the urls module has a withQuery method or similar. Verify this before implementation.)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc34d5a and 843f3f4.

📒 Files selected for processing (26)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/TableCells.tsx (2 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableTable.tsx (4 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/layout.tsx (5 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/PolicyTabs.tsx (2 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/channels/DeploymentVersionChannels.tsx (3 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/variables/page.tsx (3 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/environments/EnvironmentRow.tsx (2 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/TargetFilterUniquenessIndicator.tsx (3 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/runbooks/RunbookGettingStarted.tsx (1 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/runbooks/page.tsx (2 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(sidebar)/layout.tsx (1 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/_components/deployments/environment-cell/DeploymentEnvironmentCell.tsx (2 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/UserAvatarMenu.tsx (3 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/DeploymentVersionChannels.tsx (3 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/resources/condition/ResourceList.tsx (3 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/resources/drawer/ResourceDrawer.tsx (3 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx (4 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/resources/(raw)/[resourceId]/layout.tsx (2 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/resources/(raw)/[resourceId]/variables/page.tsx (2 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/ResourceProvidersGettingStarted.tsx (2 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/page.tsx (3 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/settings/page.tsx (2 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/settings/workspace/integrations/page.tsx (5 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/settings/workspace/overview/page.tsx (8 hunks)
  • apps/webservice/src/app/urls.ts (4 hunks)
  • apps/webservice/src/components/form/job-agent/JobAgentSelector.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{ts,tsx}`: **Note on Error Handling:** Avoid strict en...

**/*.{ts,tsx}: Note on Error Handling:
Avoid strict enforcement of try/catch blocks. Code may use early returns, Promise chains (.then().catch()), or other patterns for error handling. These are acceptable as long as they maintain clarity and predictability.

  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(sidebar)/layout.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/resources/(raw)/[resourceId]/layout.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/UserAvatarMenu.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/TargetFilterUniquenessIndicator.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/TableCells.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/ResourceProvidersGettingStarted.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/runbooks/page.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/resources/drawer/ResourceDrawer.tsx
  • apps/webservice/src/components/form/job-agent/JobAgentSelector.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/runbooks/RunbookGettingStarted.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/PolicyTabs.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/settings/page.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/environments/EnvironmentRow.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/resources/condition/ResourceList.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/_components/deployments/environment-cell/DeploymentEnvironmentCell.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableTable.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/page.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/resources/(raw)/[resourceId]/variables/page.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/variables/page.tsx
  • apps/webservice/src/app/urls.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/settings/workspace/overview/page.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/layout.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/channels/DeploymentVersionChannels.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/settings/workspace/integrations/page.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/DeploymentVersionChannels.tsx
🧠 Learnings (1)
apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx (2)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/EnvironmentDrawer.tsx:139-154
Timestamp: 2025-03-14T19:06:31.548Z
Learning: In `EnvironmentDrawer.tsx`, for the `EnvironmentDrawer` component, when there are only a few `TabButton` instances (e.g., 3), it's acceptable to define them individually without extracting them into a configuration to reduce repetition.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#183
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/EnvironmentDrawer.tsx:55-57
Timestamp: 2025-03-14T19:06:31.548Z
Learning: In `EnvironmentDrawer.tsx`, we prefer to fetch all data upfront and show a loading indicator until everything is fetched, unless performance becomes an issue.
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Typecheck
  • GitHub Check: Lint
  • GitHub Check: build (linux/amd64)
🔇 Additional comments (84)
apps/webservice/src/app/[workspaceSlug]/(app)/UserAvatarMenu.tsx (3)

17-18: Good addition of URLs module import

Adding the centralized URL construction module is a good practice for maintainability.


36-41: Well-structured URL construction

The method chain pattern creates a clear, readable URL construction that's more maintainable than string interpolation.


66-66: Proper implementation of the URL utility

Correctly replaced hardcoded URL string with the centralized URL utility.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/variables/page.tsx (3)

12-12: Consistent import of URLs module

Good practice to reuse the centralized URL construction module.


26-31: Clean URL construction implementation

The method chain pattern makes the URL construction readable and maintainable.


50-50: Effective URL composition

Good implementation of the URL utility while properly combining it with the query parameter.

apps/webservice/src/app/[workspaceSlug]/(app)/settings/page.tsx (2)

3-3: Consistent URL module adoption

The import maintains consistency with other files in this refactoring effort.


12-13: Improved redirect implementation

The redirect now uses the centralized URL construction, which is more maintainable than hardcoded paths.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/environments/EnvironmentRow.tsx (3)

14-14: Consistent URL module usage

Correctly imports the centralized URL utility.


83-88: Well-structured environment URL construction

The method chain provides a clean and readable way to construct the environment URL.


92-92: Proper URL implementation in Link component

Correctly replaced hardcoded URL with the centralized URL utility in the href attribute.

apps/webservice/src/app/[workspaceSlug]/(app)/resources/(raw)/[resourceId]/layout.tsx (3)

26-26: URL library import added.

The import of the urls module is consistent with the PR's objective to centralize URL generation.


37-40: Good use of URL builder pattern.

This correctly implements the url library pattern, creating a resource URL by chaining workspace, resources, and baseUrl methods.


45-45: Link href now uses url library.

The Link component appropriately uses the centralized URL instead of string interpolation.

apps/webservice/src/components/form/job-agent/JobAgentSelector.tsx (2)

17-18: URL library import added.

The import of the urls module is consistent with the PR's objective to centralize URL generation.


48-63: JobAgentSelector component refactored to use url library.

The Link component now properly uses the url builder pattern instead of string interpolation. This improves maintainability by centralizing URL generation logic.

apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx (3)

6-6: URL library import added.

The import of the urls module is consistent with the PR's objective to centralize URL generation.


22-22: Created workspace URL builder.

Good practice to create a single workspaceUrls instance that can be reused throughout the component, making the code more maintainable.


35-36: Updated navigation links to use url library.

All sidebar navigation links now correctly use the workspaceUrls builder instead of string interpolation, making URL management more maintainable and consistent.

Also applies to: 40-41, 51-52

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/TargetFilterUniquenessIndicator.tsx (3)

16-16: URL library import added.

The import of the urls module is consistent with the PR's objective to centralize URL generation.


100-100: Created resource URL using builder pattern.

Good use of the url library to create a reusable resourcesUrl constant.


164-164: Updated link to use url library.

The Link component correctly uses the centralized resourcesUrl with URLSearchParams for query parameters.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/PolicyTabs.tsx (2)

11-11: Import of urls module looks good.

The import of the centralized URL handling module follows the project's direction for unified URL management.


31-35: Good refactoring to use the urls utility.

Replacing string interpolation with a method chain approach is a good change that makes URL construction more maintainable and consistent across the application.

apps/webservice/src/app/[workspaceSlug]/(app)/settings/workspace/overview/page.tsx (8)

17-17: Import of urls module looks good.

The import of the centralized URL handling module follows the project's direction for unified URL management.


31-32: Good approach for URL reusability.

Creating a workspaceUrls variable to reuse the workspace context throughout the component improves code readability and maintainability.


60-61: Good refactoring to use the urls utility.

Replacing hardcoded URL strings with method chains from the urls utility improves maintainability.


88-88: Good refactoring to use the urls utility.

Consistent use of the workspaceUrls pattern across all links helps maintain a uniform approach to URL generation.


115-115: Good refactoring to use the urls utility.

Consistent use of the workspaceUrls pattern for system configuration links.


147-147: Good refactoring to use the urls utility.

Consistent use of the workspaceUrls pattern for integration settings.


165-165: Good refactoring to use the urls utility.

Consistent use of the workspaceUrls pattern for Google integration settings.


184-184: Good refactoring to use the urls utility.

Consistent use of the workspaceUrls pattern for AWS integration settings.

apps/webservice/src/app/[workspaceSlug]/(app)/resources/(raw)/[resourceId]/variables/page.tsx (2)

16-16: Import of urls module looks good.

The import of the centralized URL handling module follows the project's direction for unified URL management.


110-114: Good refactoring to use the urls utility.

Replacing string interpolation with a method chain approach improves URL construction maintainability and consistency. The chained methods clearly show the hierarchical structure of the URL.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/_components/deployments/environment-cell/DeploymentEnvironmentCell.tsx (3)

18-18: Import of urls module looks good.

The import of the centralized URL handling module follows the project's direction for unified URL management.


68-73: Good approach for URL creation.

Creating a dedicated constant for the environment resources URL improves code readability and follows the project's pattern for URL construction.


77-77: Good use of the created URL constant.

Using the envResourcesUrl constant in the Link href attribute ensures consistency with the URL construction pattern across the application.

apps/webservice/src/app/[workspaceSlug]/(app)/_components/resources/drawer/ResourceDrawer.tsx (3)

25-25: LGTM: Adopting centralized URL management.


55-59: Good implementation of URL generation using chained methods.

Using the url library's chained methods provides a cleaner and more maintainable approach to URL generation compared to string interpolation or hardcoded paths.


132-132: LGTM: Using the constructed URL variable.

Replacing hardcoded URL with the constructed variable enhances maintainability.

apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/ResourceProvidersGettingStarted.tsx (3)

9-10: LGTM: Consistent import of the URLs module.


13-18: Good implementation of URL construction.

The method chain clearly shows the URL structure hierarchy, making it easier to understand and maintain.


36-36: LGTM: Using the constructed URL variable.

apps/webservice/src/app/[workspaceSlug]/(app)/_components/resources/condition/ResourceList.tsx (3)

11-11: LGTM: Consistent import of the URLs module.


29-29: Good implementation of URL base construction.

The URL construction approach is consistent with other files in this PR.


51-55: LGTM: Combining the base URL with query parameters.

The approach of combining the base URL with URLSearchParams is clean and follows best practices for query parameter handling.

apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/page.tsx (2)

134-140: Good implementation of URL construction with method chaining.

The method chain clearly expresses the URL structure hierarchy, maintaining consistency with other files in this PR.


162-162: LGTM: Using the constructed URL variable.

apps/webservice/src/app/urls.ts (8)

16-20: Well-organized account URL structure.

Good job refactoring the workspaceSettings function to use a structured approach for account-related URLs. This provides better organization and clearer access paths to different account sections.


24-32: Great centralization of integration URLs.

The new workspaceSettingsIntegrations function effectively centralizes integration URL generation for various providers. This approach makes it easier to manage and maintain integration paths consistently across the application.


42-42: Good use of the new job agents URL structure.

The update to use the new workspaceJobAgents function aligns with the centralized URL management approach, improving consistency.


45-45: Good addition of resource-specific URL handling.

Adding the resource method allows for more granular URL generation for specific resources, enhancing the API's flexibility.


50-56: Well-structured job agents URL module.

The new workspaceJobAgents function creates a clean interface for job agent URLs, using the base path consistently and providing specialized methods for different job agent features.


66-75: Comprehensive resource URL structure.

The resource function provides a well-organized set of methods for resource-related actions. The use of a base path array keeps the code DRY and maintainable.


107-107: Good integration of runbooks into system URLs.

Adding the runbooks property to the system function enhances the URL structure with a logical placement for runbook-related paths.


111-118: Clean implementation of runbooks URL generation.

The runbooks function follows the established pattern of the codebase, providing a consistent API for generating runbook-related URLs.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(sidebar)/layout.tsx (1)

29-29: Proper usage of the URL library method chain.

Good job updating the agentsUrl to use the baseUrl() method. This change correctly leverages the new URL generation structure, ensuring consistency with the rest of the application.

apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/DeploymentVersionChannels.tsx (4)

16-16: Good import of the centralized URL library.

Adding the import for the urls module aligns with the project's effort to centralize URL management.


47-50: Type improvement for workspaceSlug parameter.

Changing workspaceSlug from optional to required is a good practice as it ensures this essential parameter is always provided, improving type safety.


56-61: Well-implemented URL generation using the library.

The new versionChannelsUrl constant demonstrates good use of method chaining with the urls library, creating a clear and maintainable way to generate the URL.


86-86: Consistent implementation of URL in href attribute.

Using the versionChannelsUrl in the Link component's href attribute is a good application of the centralized URL management approach.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/TableCells.tsx (3)

48-48: Proper import of URL utility.

Adding the import for the urls module is consistent with the application-wide approach to URL management.


195-201: Well-constructed URL using method chaining.

The versionUrl constant effectively uses method chaining to build a deployment-specific URL. This approach makes the code more readable and maintainable compared to string concatenation.


206-206: Appropriate usage of the generated URL.

Using the versionUrl in the Link component's href attribute ensures consistency with the centralized URL management approach.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/runbooks/page.tsx (1)

22-26: LGTM - Good refactoring of URL construction logic.

Creating a dedicated variable for the URL before using it in the JSX improves readability and follows the PR's objective of centralizing URL construction.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/runbooks/RunbookGettingStarted.tsx (2)

6-6: LGTM - Good import path.

Using the shorter alias path for urls is cleaner than using a deep relative path.


11-45: LGTM - Improved component syntax.

The refactoring to use an implicit return and the consistent use of the URLs module for link construction enhances readability and maintainability.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/channels/DeploymentVersionChannels.tsx (2)

47-49: LGTM - Type safety improvement.

Changing from optional to required parameters enhances type safety since these parameters are needed for URL construction.


55-60: LGTM - Good refactoring of URL construction logic.

Creating a dedicated variable for the URL before using it in the JSX improves readability and follows the PR's objective of centralizing URL construction.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableTable.tsx (2)

63-63: LGTM - Efficient URL handling approach.

Creating a reusable workspaceUrls variable is a good practice that reduces repetition in the code.


235-237: LGTM - Clean URL construction.

The method chain approach for URL construction is clean and readable.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/layout.tsx (6)

28-28: Good addition of centralized URL module.

Adding the urls import is a positive change that supports the URL centralization strategy.


40-41: Nice parameter destructuring improvement.

Direct destructuring of params from the awaited promise simplifies the code and makes it more readable.


53-54: Good URL construction refactoring.

Creating reusable URL objects through method chaining improves maintainability and readability. The hierarchical structure (workspacesystemenvironment) makes the URL relationships clearer.


63-65: Well refactored navigation link.

Using systemUrls.deployments() to generate the URL reduces string interpolation errors and improves consistency.


70-73: Properly updated breadcrumb link.

The breadcrumb link now uses the centralized URL structure, maintaining consistency with the rest of the application.


92-103: Excellent consistent URL pattern usage across sidebar links.

All sidebar links have been properly updated to use the environmentUrls methods, which ensures consistency and maintainability throughout the navigation system.

apps/webservice/src/app/[workspaceSlug]/(app)/settings/workspace/integrations/page.tsx (7)

10-10: Good addition of centralized URL module.

Adding the urls import is a positive change that supports the URL centralization strategy.


15-18: Good simplification of component props.

Replacing integration and workspaceSlug props with a single href prop improves component reusability and adheres to the single responsibility principle - the component no longer needs to know how to construct URLs.


20-20: Correctly updated Link component.

The Link component now correctly uses the href prop passed from the parent.


43-47: Good URL structure initialization using method chaining.

Creating the integrationsUrls object using method chaining creates a clear, readable hierarchy of URL construction while keeping URL generation logic centralized.


58-59: Well refactored integration card.

Updating the GitHub integration card to use the centralized URL generation improves maintainability.


72-73: Well refactored AWS integration card.

Properly updated to use the centralized URL generation pattern.


86-87: Well refactored Google integration card.

Correctly updated to use the centralized URL generation pattern, completing the consistent refactoring across all integration types.

@adityachoudhari26 adityachoudhari26 merged commit 5d7dc9c into main Mar 17, 2025
6 checks passed
@adityachoudhari26 adityachoudhari26 deleted the use-url-library branch March 17, 2025 05:47
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.

2 participants