8000 feat: Remove hardcoding of upcoming integrations from client codebase #40047 by vivek-appsmith · Pull Request #40271 · appsmithorg/appsmith · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Remove hardcoding of upcoming integrations from client codebase #40047 #40271

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 18 commits into from
Apr 17, 2025

Conversation

vivek-appsmith
Copy link
Contributor
@vivek-appsmith vivek-appsmith commented Apr 16, 2025

Premium Integrations Refactoring

Problem

The existing implementation for handling premium integrations had several issues:

  • Transformation logic was duplicated between Constants.ts and PluginApi.ts
  • Hardcoded fallback integrations were defined in the Constants file
  • PREMIUM_INTEGRATIONS was a mutable variable instead of a constant
  • Error handling was silent, making debugging difficult

Solution

This PR refactors the premium integrations handling to:

  1. Move all transformation logic to the appropriate API layer (PluginApi.ts)
  2. Convert PREMIUM_INTEGRATIONS to a constant array with proper update methods
  3. Remove hardcoded default values and use an empty array as fallback
  4. Add proper error logging for failed API requests

Key Changes

In app/client/src/api/PluginApi.ts:

  • Created the PremiumIntegration interface to define the structure for premium integrations
  • Added a new method fetchPremiumIntegrations() that:
    • Fetches data from the upstream API
    • Transforms the response into the PremiumIntegration format
    • Returns either the transformed integrations or default fallback integrations if the API fails

In app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/Constants.ts:

  • Removed hardcoded default integrations (DEFAULT_PREMIUM_INTEGRATIONS)
  • Changed PREMIUM_INTEGRATIONS from a variable to a constant array
  • Updated array update logic to work with a constant (using .length = 0 and .push() instead of reassignment)
  • Added proper error logging using loglevel
  • Removed unused imports

Testing

The changes maintain the existing functionality while improving code organization:

  • The PREMIUM_INTEGRATIONS array is still populated from the API
  • The getFilteredPremiumIntegrations function works as before
  • API failures are handled gracefully but now with proper logging

Impact Areas

  • Premium datasource integration listing in the integration editor
  • Error handling and logging for premium integrations

Type of Change

  • Code refactoring without functionality changes
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Further Improvements

In the future, we could consider:

  • Adding unit tests for the premium integrations functionality
  • Implementing cached responses to improve performance
  • Adding better typings for the API response

Fixes #40047

/ok-to-test tags="@tag.All"

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14516648891
Commit: 79bd56d
Cypress dashboard.
Tags: @tag.All
Spec:


Thu, 17 Apr 2025 14:38:39 UTC

Summary by CodeRabbit

  • New Features
    • Introduced support for displaying upcoming plugin integrations, including fetching and managing a list of upcoming plugins within the app.
    • Added selectors and UI updates to surface upcoming integrations in relevant sections.
  • Bug Fixes
    • None.
  • Tests
    • Added tests to verify fetching and error handling for upcoming plugin integrations.
  • Refactor
    • Replaced references to "premium" integrations with "upcoming" integrations throughout the app.
    • Updated filtering logic and component props to use the new upcoming integrations structure.

Copy link
Contributor
coderabbitai bot commented Apr 16, 2025

Walkthrough

This change removes hardcoded definitions for upcoming integrations from the client codebase and migrates the logic to fetch these integrations from a backend API. It introduces a new Redux action, reducer state, and saga to manage upcoming plugins, adds a selector for accessing them, and updates components and utilities to use the dynamic list instead of static constants. The API layer is extended with a new method to retrieve upcoming integrations, and corresponding tests are added. All references to "premium" integrations are replaced with "upcoming" integrations, and the filtering logic is updated to operate on the API-driven data.

Changes

Files/Paths Change Summary
app/client/src/actions/pluginActions.ts, app/client/src/ce/constants/ReduxActionConstants.tsx Added Redux action creator and new action type constants for fetching upcoming plugins.
app/client/src/api/PluginApi.ts, app/client/src/api/__tests__/PluginApi.test.ts Added API method to fetch upcoming integrations and corresponding unit tests.
app/client/src/ce/selectors/entitiesSelector.ts Added selector to retrieve upcoming plugins from the Redux state.
app/client/src/entities/Plugin/index.ts Introduced new UpcomingIntegration interface.
app/client/src/reducers/entityReducers/pluginsReducer.ts Added upcomingPlugins slice to the reducer with loading and list state, and handlers for new actions.
app/client/src/sagas/PluginSagas.ts Added saga to handle fetching upcoming plugins from the API and dispatching success/error actions.
app/client/src/ce/entities/Engine/actionHelpers.ts Included fetchUpcomingPlugins in initialization actions for page dependencies.
app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/Constants.ts Removed hardcoded premium integrations and related interface; added dynamic filtering utility for upcoming integrations.
app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/index.tsx Updated prop types and logic to use UpcomingIntegration instead of PremiumIntegration.
app/client/src/pages/Editor/IntegrationEditor/APIOrSaasPlugins.tsx, .../EmptySearchedPlugins.tsx Updated logic and props to use upcoming integrations and new selectors/utilities for filtering and display.
app/client/src/ce/pages/Applications/CreateNewAppsOption.test.tsx Extended mock state to include upcomingPlugins for test coverage.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant Redux
    participant Saga
    participant PluginsApi
    participant Backend

    UI->>Redux: dispatch(fetchUpcomingPlugins)
    Redux->>Saga: GET_UPCOMING_PLUGINS_REQUEST
    Saga->>PluginsApi: fetchUpcomingIntegrations()
    PluginsApi->>Backend: GET /upcoming-integrations
    Backend-->>PluginsApi: [UpcomingIntegration[]]
    PluginsApi-->>Saga: Promise resolves with data
    Saga->>Redux: dispatch(GET_UPCOMING_PLUGINS_SUCCESS)
    Redux-->>UI: State updated with upcoming plugins list
Loading

Assessment against linked issues

Objective Addressed Explanation
Remove hardcoding of upcoming integrations from client codebase (#40047)

Possibly related PRs

  • appsmithorg/appsmith#40256: Adds client-side support for fetching upcoming plugins, directly related to the new server endpoint for upcoming integrations.

Suggested labels

IDE Product

Poem

🚀 Out with the static, in with the flow,
Integrations now fetched, not hardcoded below.
Redux and sagas, selectors in line,
The API delivers, the plugins now shine!
Dynamic and nimble, the code marches on—
The future of plugins, from config, is drawn!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between ae321e1 and 79bd56d.

📒 Files selected for processing (2)
  • app/client/src/pages/Editor/IntegrationEditor/APIOrSaasPlugins.tsx (9 hunks)
  • app/client/src/reducers/entityReducers/pluginsReducer.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/client/src/reducers/entityReducers/pluginsReducer.ts
  • app/client/src/pages/Editor/IntegrationEditor/APIOrSaasPlugins.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check

🪧 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 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.

@vivek-appsmith vivek-appsmith changed the title refactor: simplify premium integrations handling feat: Remove hardcoding of upcoming integrations from client codebase #40047 Apr 16, 2025
@github-actions github-actions bot added the Enhancement New feature or request label Apr 16, 2025
@vivek-appsmith vivek-appsmith force-pushed the feat/upcoming-integrations-api branch from 0e0fd40 to 844ca77 Compare April 16, 2025 10:56
@vivek-appsmith vivek-appsmith added the ok-to-test Required label for CI label Apr 16, 2025
@vivek-appsmith vivek-appsmith self-assigned this Apr 16, 2025
@vivek-appsmith
Copy link
Contributor Author

/ok-to-test

Copy link

Whoops! Looks like you're using an outdated method of running the Cypress suite.
Please check this doc to learn how to correct this!

@AmanAgarwal041
Copy link
Contributor

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/14492238539.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 40271.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-40271.dp.appsmith.com

@github-actions github-actions bot added Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Task A simple Todo labels Apr 17, 2025
@AmanAgarwal041
Copy link
Contributor

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/14511714648.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 40271.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-40271.dp.appsmith.com

@NilanshBansal NilanshBansal marked this pull request as ready for review April 17, 2025 11:14
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: 3

🔭 Outside diff range comments (1)
app/client/src/pages/Editor/IntegrationEditor/APIOrSaasPlugins.tsx (1)

265-265: 🛠️ Refactor suggestion

References to premiumPlugins should be updated

These lines still reference premiumPlugins when they should reference upcomingPlugins to maintain naming consistency throughout the codebase.

Update all occurrences with a consistent name:

-  if (
-    props.premiumPlugins.length === 0 &&
+  if (
+    props.upcomingPlugins.length === 0 &&
     props.plugins.length === 0 &&
     !props.restAPIVisible &&
     !props.graphQLAPIVisible
   )
     return null;

And:

-  {props.premiumPlugins.length > 0 && props.isIntegrationsEnabledForPaid ? (
+  {props.upcomingPlugins.length > 0 && props.isIntegrationsEnabledForPaid ? (
     <DatasourceSection id="upcoming-saas-integrations">
       <DatasourceSectionHeading kind="heading-m">
         {createMessage(UPCOMING_SAAS_INTEGRATIONS)}
       </DatasourceSectionHeading>
       <DatasourceContainer data-testid="upcoming-datasource-card-container">
         <PremiumDatasources
           isIntegrationsEnabledForPaid
-          plugins={props.premiumPlugins}
+          plugins={props.upcomingPlugins}
         />
       </DatasourceContainer>
     </DatasourceSection>
   ) : null}

Also applies to: 283-292

🧹 Nitpick comments (5)
app/client/src/api/__tests__/PluginApi.test.ts (1)

1-74: Well-structured tests for new API method

Good implementation of tests for the fetchUpcomingIntegrations method. The tests verify both successful API calls and error handling.

One minor improvement suggestion:

Consider refactoring the Api mock implementation to use simple functions instead of a class with static members:

- jest.mock("api/Api", () => {
-   return {
-     // Export a class that can be extended
-     __esModule: true,
-     default: class MockApi {
-       static get: jest.Mock = jest.fn();
-     },
-   };
- });

+ jest.mock("api/Api", () => ({
+   __esModule: true,
+   default: {
+     get: jest.fn()
+   }
+ }));

This provides the same functionality with a simpler implementation that avoids the linter warning about classes with only static members.

🧰 Tools
🪛 Biome (1.9.4)

[error] 10-12: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

app/client/src/sagas/PluginSagas.ts (1)

313-329: Consider adding response validation for upcoming plugins saga.

The new saga correctly handles the API call and dispatches appropriate success/error actions. However, unlike other sagas in this file (like getDefaultPluginsSaga), it doesn't use the validateResponse helper to verify the API response.

function* getUpcomingPluginsSaga() {
  try {
    const response: ApiResponse<UpcomingIntegration[]> = yield call(
      PluginsApi.fetchUpcomingIntegrations,
    );
+   const isValid: boolean = yield validateResponse(response);
    
-   yield put({
+   if (isValid) {
+     yield put({
        type: ReduxActionTypes.GET_UPCOMING_PLUGINS_SUCCESS,
        payload: response.data || [],
      });
+   }
  } catch (error) {
    yield put({
      type: ReduxActionErrorTypes.GET_UPCOMING_PLUGINS_ERROR,
      payload: { error },
    });
  }
}
app/client/src/pages/Editor/IntegrationEditor/APIOrSaasPlugins.tsx (1)

236-238: Update PremiumDatasources component usage

This component is still named PremiumDatasources but works with upcoming plugins. This creates ambiguity.

Consider renaming the PremiumDatasources component to UpcomingDatasources for consistency, or update the property reference:

   {!props.isIntegrationsEnabledForPaid && (
-    <PremiumDatasources plugins={props.premiumPlugins} />
+    <PremiumDatasources plugins={props.upcomingPlugins} />
   )}
app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/Constants.ts (2)

24-29: Consider renaming constants for consistency

The file and function have been updated to use "upcoming" terminology, but constants like PREMIUM_INTEGRATION_CONTACT_FORM still use "premium". For naming consistency, consider updating these constants.

-export const PREMIUM_INTEGRATION_CONTACT_FORM =
-  "PREMIUM_INTEGRATION_CONTACT_FORM";
+export const UPCOMING_INTEGRATION_CONTACT_FORM =
+  "UPCOMING_INTEGRATION_CONTACT_FORM";

1-29: Inconsistent file naming

The file is still named "PremiumDatasources/Constants.ts" but primarily contains functionality for "Upcoming" integrations. Consider moving this file to a more appropriately named directory or updating the directory name.

Consider renaming the directory from "PremiumDatasources" to "UpcomingDatasources" to maintain naming consistency with the updated terminology.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 14c7a41 and ae321e1.

📒 Files selected for processing (14)
  • app/client/src/actions/pluginActions.ts (1 hunks)
  • app/client/src/api/PluginApi.ts (3 hunks)
  • app/client/src/api/__tests__/PluginApi.test.ts (1 hunks)
  • app/client/src/ce/constants/ReduxActionConstants.tsx (1 hunks)
  • app/client/src/ce/entities/Engine/actionHelpers.ts (2 hunks)
  • app/client/src/ce/pages/Applications/CreateNewAppsOption.test.tsx (1 hunks)
  • app/client/src/ce/selectors/entitiesSelector.ts (1 hunks)
  • app/client/src/entities/Plugin/index.ts (1 hunks)
  • app/client/src/pages/Editor/IntegrationEditor/APIOrSaasPlugins.tsx (5 hunks)
  • app/client/src/pages/Editor/IntegrationEditor/EmptySearchedPlugins.tsx (3 hunks)
  • app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/Constants.ts (1 hunks)
  • app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/index.tsx (3 hunks)
  • app/client/src/reducers/entityReducers/pluginsReducer.ts (4 hunks)
  • app/client/src/sagas/PluginSagas.ts (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (9)
app/client/src/ce/selectors/entitiesSelector.ts (1)
app/client/src/ce/reducers/index.tsx (1)
  • AppState (98-191)
app/client/src/api/PluginApi.ts (2)
app/client/src/api/types.ts (1)
  • ApiResponse (14-18)
app/client/src/entities/Plugin/index.ts (1)
  • UpcomingIntegration (95-98)
app/client/src/ce/entities/Engine/actionHelpers.ts (1)
app/client/src/actions/pluginActions.ts (1)
  • fetchUpcomingPlugins (88-90)
app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/index.tsx (1)
app/client/src/entities/Plugin/index.ts (1)
  • UpcomingIntegration (95-98)
app/client/src/pages/Editor/IntegrationEditor/APIOrSaasPlugins.tsx (3)
app/client/src/entities/Plugin/index.ts (1)
  • UpcomingIntegration (95-98)
app/client/src/ce/selectors/entitiesSelector.ts (1)
  • getUpcomingPlugins (1803-1806)
app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/Constants.ts (1)
  • getFilteredUpcomingIntegrations (11-22)
app/client/src/pages/Editor/IntegrationEditor/EmptySearchedPlugins.tsx (2)
app/client/src/ce/selectors/entitiesSelector.ts (1)
  • getUpcomingPlugins (1803-1806)
app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/Constants.ts (1)
  • getFilteredUpcomingIntegrations (11-22)
app/client/src/sagas/PluginSagas.ts (3)
app/client/src/api/types.ts (1)
  • ApiResponse (14-18)
app/client/src/entities/Plugin/index.ts (1)
  • UpcomingIntegration (95-98)
app/client/src/ce/constants/ReduxActionConstants.tsx (2)
  • ReduxActionTypes (1282-1325)
  • ReduxActionErrorTypes (1327-1354)
app/client/src/api/__tests__/PluginApi.test.ts (1)
app/client/src/entities/Plugin/index.ts (1)
  • UpcomingIntegration (95-98)
app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/Constants.ts (1)
app/client/src/entities/Plugin/index.ts (1)
  • UpcomingIntegration (95-98)
🪛 Biome (1.9.4)
app/client/src/api/__tests__/PluginApi.test.ts

[error] 10-12: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (26)
app/client/src/entities/Plugin/index.ts (1)

95-98: Good addition of the UpcomingIntegration interface.

The interface is well-defined with clear property names. This will provide proper type safety for the upcoming integrations feature across the application.

app/client/src/ce/pages/Applications/CreateNewAppsOption.test.tsx (1)

25-28: Test state properly updated for the new feature.

The mock store now includes the upcomingPlugins state slice with appropriate default values, ensuring tests will work correctly with components that depend on this state.

app/client/src/ce/selectors/entitiesSelector.ts (1)

1803-1806: Well-implemented selector for upcoming plugins.

Good use of createSelector for memoization, which will prevent unnecessary re-renders when the state is accessed multiple times without changes. The selector correctly extracts just the list from the state object.

app/client/src/actions/pluginActions.ts (1)

88-90: Action creator properly implemented.

The fetchUpcomingPlugins action creator follows the established pattern in this file, creating an action without payload that will trigger the request to fetch upcoming plugins.

app/client/src/ce/entities/Engine/actionHelpers.ts (2)

11-11: Added import for fetchUpcomingPlugins action

The import statement has been updated to include the fetchUpcomingPlugins action creator alongside the existing fetchPlugins function.


40-40: Added upcoming plugins fetch to initialization flow

The fetchUpcomingPlugins() action has been added to the initialization actions array. Good that you've included a comment explaining why it doesn't have corresponding success and error actions in the arrays below.

app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/index.tsx (3)

10-10: Switched to centralized interface definition

Changed from using a locally defined PremiumIntegration type to the centralized UpcomingIntegration interface from the entities module.


29-29: Updated prop type to use UpcomingIntegration

The props type has been updated to use the imported UpcomingIntegration interface, maintaining type safety after the refactoring.


52-52: Updated property access for icon URL

Changed from using integration.icon to integration.iconLocation to match the property name in the new UpcomingIntegration interface.

app/client/src/ce/constants/ReduxActionConstants.tsx (2)

754-755: Added action types for upcoming plugins request and success

Added the necessary Redux action types for requesting and successfully fetching upcoming plugins.


762-762: Added error action type for upcoming plugins

Added the Redux error action type for handling failures when fetching upcoming plugins.

app/client/src/pages/Editor/IntegrationEditor/EmptySearchedPlugins.tsx (1)

13-14: Implementation correctly uses dynamic upcoming plugins.

The changes appropriately migrate from hardcoded premium integrations to dynamically fetched upcoming integrations:

  1. Updated imports to use getUpcomingPlugins selector and getFilteredUpcomingIntegrations function
  2. Added Redux selector hook to retrieve upcoming plugins from state
  3. Updated the filter function call to use the dynamically fetched plugins

This aligns with the PR objective to centralize transformation logic and remove hardcoded values.

Also applies to: 37-38, 64-68

app/client/src/api/PluginApi.ts (3)

6-11: Import statements correctly organized.

Imports have been properly structured to include the UpcomingIntegration type and the objectKeys utility function which will be used in the file.


63-67: Well-implemented API method for fetching upcoming integrations.

The new fetchUpcomingIntegrations method follows the existing API pattern and structure:

  • Returns appropriate Promise type with UpcomingIntegration[] as the generic parameter
  • Uses the correct endpoint path format consistent with other API methods
  • Properly leverages the existing API utility methods

This implementation effectively supports the PR goal of moving integration data fetching to the API layer.


84-86: Improved object key iteration with utility function.

Replacing Object.keys with the objectKeys utility function provides more consistent behavior across environments and better type safety.

app/client/src/sagas/PluginSagas.ts (2)

34-39: Import statements correctly updated.

The imports are properly organized to include the UpcomingIntegration type needed for the new saga functionality.


346-349: Correctly wired up saga to action type.

The saga is properly connected to the Redux action type using takeEvery, consistent with the pattern used for other sagas in this file.

app/client/src/reducers/entityReducers/pluginsReducer.ts (2)

7-11: Import statements correctly updated.

The imports are properly organized to include the UpcomingIntegration type needed for the state interface.


37-40: Well-structured state for upcoming plugins.

The state structure for upcoming plugins follows the existing patterns in the reducer:

  • Properly typed with UpcomingIntegration[] for the list
  • Includes loading state for tracking API call status
  • Initial state correctly initialized with empty array and loading flag set to false

This implementation provides a solid foundation for managing upcoming plugins in the Redux store.

Also applies to: 54-57

app/client/src/pages/Editor/IntegrationEditor/APIOrSaasPlugins.tsx (4)

14-14: Type import updated to UpcomingIntegration

The type import has been updated from PremiumIntegration to UpcomingIntegration, aligning with the new naming convention throughout the application.


20-20: Selector updated to getUpcomingPlugins

The selector import has been updated from a premium plugins selector to getUpcomingPlugins, maintaining consistency with the type renaming.


48-48: Updated utility import to getFilteredUpcomingIntegrations

The import has been updated to use getFilteredUpcomingIntegrations instead of the previous premium integration filtering utility.


312-313: Updated to use the new upcomingPlugins selector

The code now correctly retrieves upcoming plugins from the Redux state using the getUpcomingPlugins selector.

app/client/src/pages/Editor/IntegrationEditor/PremiumDatasources/Constants.ts (3)

1-1: Updated import to UpcomingIntegration

The import has been updated from PremiumIntegration to UpcomingIntegration, aligning with the new naming convention.


3-10: Added clear JSDoc documentation

Good addition of comprehensive JSDoc comments explaining the function's purpose, parameters, and return value.


6D40

11-22: Refactored integration filtering with dynamic data source

The function has been updated to accept upcomingPlugins as a parameter instead of using a hardcoded array. This is a good improvement that:

  1. Removes hardcoded values
  2. Makes the function more testable
  3. Centralizes the filtering logic

The filtering logic itself remains sound - it filters out plugins that are already installed when external SaaS is enabled.

@AmanAgarwal041
Copy link
Contributor

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/14517298286.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 40271.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-40271.dp.appsmith.com

Copy link
Contributor
@AmanAgarwal041 AmanAgarwal041 left a comment

Choose a reason for hiding this comment

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

Tested and fixed.

@AmanAgarwal041 AmanAgarwal041 merged commit c8a132f into release Apr 17, 2025
85 checks passed
@AmanAgarwal041 AmanAgarwal041 deleted the feat/upcoming-integrations-api branch April 17, 2025 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration ok-to-test Required label for CI Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove hardcoding of upcoming integrations from client codebase
3 participants
0