From 76fe730c8ab483eb80ffbabd0e6ed20a8176db60 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Tue, 17 Dec 2024 17:02:33 +0530 Subject: [PATCH 1/7] reverting a test change --- .../IDE/EditorPane/Query/QueryRender.test.tsx | 41 ++----------------- 1 file changed, 4 insertions(+), 37 deletions(-) diff --git a/app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx b/app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx index 17d0a6a958be..65314ae7a727 100644 --- a/app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx +++ b/app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx @@ -14,9 +14,6 @@ import { getIDETestState } from "test/factories/AppIDEFactoryUtils"; import { PageFactory } from "test/factories/PageFactory"; import { screen, waitFor } from "@testing-library/react"; import { GoogleSheetFactory } from "test/factories/Actions/GoogleSheetFactory"; -import { PluginActionContextProvider } from "PluginActionEditor"; -import { PluginPackageName, PluginType } from "entities/Action"; -import { DatasourceComponentTypes, UIComponentTypes } from "api/PluginApi"; const FeatureFlags = { rollout_side_by_side_enabled: true, @@ -329,17 +326,6 @@ describe("IDE URL rendering of Queries", () => { }); describe("Postgres Routes", () => { - const mockPlugin = { - id: "plugin_id", - name: "Postgres", - packageName: PluginPackageName.POSTGRES, - type: PluginType.DB, - uiComponent: UIComponentTypes.UQIDbEditorForm, - datasourceComponent: DatasourceComponentTypes.AutoForm, - templates: {}, - requiresDatasource: true, - }; - it("Renders Postgres routes in Full Screen", async () => { const page = PageFactory.build(); const anQuery = PostgresFactory.build({ @@ -358,9 +344,7 @@ describe("IDE URL rendering of Queries", () => { const { getAllByText, getByRole, getByTestId } = render( - - - + , { url: `/app/applicationSlug/pageSlug-${page.basePageId}/edit/queries/${anQuery.baseId}`, @@ -418,9 +402,7 @@ describe("IDE URL rendering of Queries", () => { const { getAllByText, getByRole, getByTestId } = render( - - - + , { url: `/app/applicationSlug/pageSlug-${page.basePageId}/edit/queries/${anQuery.baseId}`, @@ -551,17 +533,6 @@ describe("IDE URL rendering of Queries", () => { }); describe("Google Sheets Routes", () => { - const mockPlugin = { - id: "plugin_id", - name: "Google Sheets", - packageName: PluginPackageName.GOOGLE_SHEETS, - type: PluginType.DB, - uiComponent: UIComponentTypes.GraphQLEditorForm, - datasourceComponent: DatasourceComponentTypes.RestAPIDatasourceForm, - templates: {}, - requiresDatasource: false, - }; - it("Renders Google Sheets routes in Full Screen", async () => { const page = PageFactory.build(); const anQuery = GoogleSheetFactory.build({ @@ -581,9 +552,7 @@ describe("IDE URL rendering of Queries", () => { const { getAllByText, getByRole, getByTestId } = render( - - - + , { url: `/app/applicationSlug/pageSlug-${page.basePageId}/edit/saas/google-sheets-plugin/api/${anQuery.baseId}`, @@ -634,9 +603,7 @@ describe("IDE URL rendering of Queries", () => { const { container, getAllByText, getByRole, getByTestId } = render( - - - + , { url: `/app/applicationSlug/pageSlug-${page.basePageId}/edit/saas/google-sheets-plugin/api/${anQuery.baseId}`, From 19d2ec2d98a92c18d2bce5bdb0cb56f7271e6405 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Fri, 20 Dec 2024 09:15:48 +0530 Subject: [PATCH 2/7] adding no access state for the datasource tab --- .../DatasourceTab/CurrentDataSource.tsx | 11 +++- .../DatasourceTab/DatasourceInfo.tsx | 2 +- .../PluginDatasourceSelector.tsx | 17 +++++- .../DatasourceSelector/index.tsx | 11 ++-- .../{Datasource.tsx => DatasourceTab.tsx} | 59 +++++++++++++------ .../components/DatasourceTab/index.tsx | 2 +- .../hooks/usePluginActionResponseTabs.tsx | 6 +- app/client/src/ce/constants/messages.ts | 2 + .../src/ce/selectors/appIDESelectors.ts | 8 +-- 9 files changed, 80 insertions(+), 38 deletions(-) rename app/client/src/PluginActionEditor/components/PluginActionResponse/components/DatasourceTab/{Datasource.tsx => DatasourceTab.tsx} (76%) diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/DatasourceTab/CurrentDataSource.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/DatasourceTab/CurrentDataSource.tsx index e2ed7ece141d..f2b1df70e00b 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/DatasourceTab/CurrentDataSource.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/DatasourceTab/CurrentDataSource.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { Flex } from "@appsmith/ads"; +import { Flex, Icon } from "@appsmith/ads"; import { getAssetUrl } from "ee/utils/airgapHelpers"; import { EntityIcon } from "pages/Editor/Explorer/ExplorerIcons"; import { useSelector } from "react-redux"; @@ -7,6 +7,7 @@ import { getPluginIdFromDatasourceId, getPluginImages, } from "ee/selectors/entitiesSelector"; +import { createMessage, SELECT_DATASOURCE } from "ee/constants/messages"; interface Props { datasourceId: string; @@ -24,9 +25,13 @@ const CurrentDataSource = ({ datasourceId, datasourceName }: Props) => { return ( - entityIcon + {datasourceIcon ? ( + entityIcon + ) : ( + + )} - {datasourceName} + {datasourceName || createMessage(SELECT_DATASOURCE)} ); }; diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/DatasourceTab/DatasourceInfo.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/DatasourceTab/DatasourceInfo.tsx index acfa33571870..6c4dac8e1c68 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/DatasourceTab/DatasourceInfo.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/DatasourceTab/DatasourceInfo.tsx @@ -55,7 +55,7 @@ const DatasourceInfo = ({ datasourceName={datasourceName} plugin={plugin} /> - {showEditButton && ( + {showEditButton && datasourceName && (