diff --git a/app/client/src/ce/selectors/entitiesSelector.ts b/app/client/src/ce/selectors/entitiesSelector.ts index eb16e38109..27ecd96ee7 100644 --- a/app/client/src/ce/selectors/entitiesSelector.ts +++ b/app/client/src/ce/selectors/entitiesSelector.ts @@ -46,6 +46,7 @@ import { getFormValues } from "redux-form"; import { TEMP_DATASOURCE_ID } from "constants/Datasource"; import { MAX_DATASOURCE_SUGGESTIONS } from "pages/Editor/Explorer/hooks"; import type { Module } from "@appsmith/constants/ModuleConstants"; +import type { Plugin } from "api/PluginApi"; export const getEntities = (state: AppState): AppState["entities"] => state.entities; @@ -393,15 +394,33 @@ export const getDBPlugins = createSelector(getPlugins, (plugins) => // Most popular datasources are hardcoded right now to include these 4 plugins and REST API // Going forward we may want to have separate list for each instance based on usage -export const getMostPopularPlugins = createSelector(getPlugins, (plugins) => - plugins.filter( - (plugin) => - plugin.packageName === PluginPackageName.POSTGRES || - plugin.packageName === PluginPackageName.MY_SQL || - plugin.packageName === PluginPackageName.MONGO || - plugin.packageName === PluginPackageName.GOOGLE_SHEETS, - ), -); +export const getMostPopularPlugins = createSelector(getPlugins, (plugins) => { + const popularPlugins: Plugin[] = []; + + const gsheetPlugin = plugins.find( + (plugin) => plugin.packageName === PluginPackageName.GOOGLE_SHEETS, + ); + const restPlugin = plugins.find( + (plugin) => plugin.packageName === PluginPackageName.REST_API, + ); + const postgresPlugin = plugins.find( + (plugin) => plugin.packageName === PluginPackageName.POSTGRES, + ); + const mysqlPlugin = plugins.find( + (plugin) => plugin.packageName === PluginPackageName.MY_SQL, + ); + const mongoPlugin = plugins.find( + (plugin) => plugin.packageName === PluginPackageName.MONGO, + ); + + gsheetPlugin && popularPlugins.push(gsheetPlugin); + restPlugin && popularPlugins.push(restPlugin); + postgresPlugin && popularPlugins.push(postgresPlugin); + mysqlPlugin && popularPlugins.push(mysqlPlugin); + mongoPlugin && popularPlugins.push(mongoPlugin); + + return popularPlugins; +}); export const getDBAndRemotePlugins = createSelector(getPlugins, (plugins) => plugins.filter( diff --git a/app/client/src/pages/Editor/IntegrationEditor/CreateNewDatasourceTab.tsx b/app/client/src/pages/Editor/IntegrationEditor/CreateNewDatasourceTab.tsx index c2d9252059..ec85cfd280 100644 --- a/app/client/src/pages/Editor/IntegrationEditor/CreateNewDatasourceTab.tsx +++ b/app/client/src/pages/Editor/IntegrationEditor/CreateNewDatasourceTab.tsx @@ -258,19 +258,25 @@ class CreateNewDatasourceTab extends React.Component< !this.props.currentApplicationIdForCreateNewApp && ( )} - {dataSources.length === 0 && - this.props.mockDatasources.length > 0 && - mockDataSection} + {dataSources.length === 0 && this.props.mockDatasources.length > 0 && ( + <> + {mockDataSection} + + > + )} {isEnabledForStartWithData && ( - + <> + + + > )} { {plugins.map((plugin, idx) => { - return ( + return plugin.type === PluginType.API ? ( + !!showMostPopularPlugins ? ( + this.handleOnClick()} + > + + + + {createMessage(CREATE_NEW_DATASOURCE_REST_API)} + + + {isCreating && } + + ) : null + ) : ( { ); })} - {!!showMostPopularPlugins ? ( - this.handleOnClick()} - > - - - - {createMessage(CREATE_NEW_DATASOURCE_REST_API)} - - - {isCreating && } - - ) : null} );
+ {createMessage(CREATE_NEW_DATASOURCE_REST_API)} +
- {createMessage(CREATE_NEW_DATASOURCE_REST_API)} -