From f90acb8296603a22cb698366835302b395151365 Mon Sep 17 00:00:00 2001
From: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com>
Date: Fri, 15 Nov 2024 08:29:56 +0530
Subject: [PATCH 01/17] fix: eslint warnings in schema
---
.../cypress/support/Pages/DataSources.ts | 2 +-
.../components/Schema.tsx | 64 +++++++++++--------
.../DatasourceViewModeSchema.tsx | 2 +-
.../DatasourceInfo/GoogleSheetSchema.tsx | 2 +-
4 files changed, 42 insertions(+), 28 deletions(-)
diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts
index b56ad7792f35..e9813ba0fe83 100644
--- a/app/client/cypress/support/Pages/DataSources.ts
+++ b/app/client/cypress/support/Pages/DataSources.ts
@@ -295,7 +295,7 @@ export class DataSources {
_imgFireStoreLogo = "//img[contains(@src, 'firestore.svg')]";
_dsVirtuosoElement = `div .t--schema-virtuoso-container`;
private _dsVirtuosoList = `[data-test-id="virtuoso-item-list"]`;
- private _dsSchemaContainer = `[data-testid="datasource-schema-container"]`;
+ private _dsSchemaContainer = `[data-testid="t--datasource-schema-container"]`;
private _dsVirtuosoElementTable = (targetTableName: string) =>
`${this._dsSchemaEntityItem}[data-testid='t--entity-item-${targetTableName}']`;
private _dsPageTabListItem = (buttonText: string) =>
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx
index 7305c7a13927..31473bcbaf7b 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx
@@ -74,31 +74,45 @@ const Schema = (props: Props) => {
getPluginDatasourceComponentFromId(state, pluginId || ""),
);
- useEffect(() => {
- setSelectedTable(undefined);
- }, [props.datasourceId]);
+ useEffect(
+ function resetSelectedTable() {
+ setSelectedTable(undefined);
+ },
+ [props.datasourceId],
+ );
+
+ useEffect(
+ function fetchDatasourceStructureEffect() {
+ function fetchStructure() {
+ if (
+ props.datasourceId &&
+ datasourceStructure === undefined &&
+ pluginDatasourceForm !==
+ DatasourceComponentTypes.RestAPIDatasourceForm
+ ) {
+ dispatch(
+ fetchDatasourceStructure(
+ props.datasourceId,
+ true,
+ DatasourceStructureContext.QUERY_EDITOR,
+ ),
+ );
+ }
+ }
- useEffect(() => {
- if (
- props.datasourceId &&
- datasourceStructure === undefined &&
- pluginDatasourceForm !== DatasourceComponentTypes.RestAPIDatasourceForm
- ) {
- dispatch(
- fetchDatasourceStructure(
- props.datasourceId,
- true,
- DatasourceStructureContext.QUERY_EDITOR,
- ),
- );
- }
- }, [props.datasourceId, datasourceStructure, dispatch, pluginDatasourceForm]);
-
- useEffect(() => {
- if (!selectedTable && datasourceStructure?.tables?.length && !isLoading) {
- setSelectedTable(datasourceStructure.tables[0].name);
- }
- }, [selectedTable, props.datasourceId, isLoading, datasourceStructure]);
+ fetchStructure();
+ },
+ [props.datasourceId, datasourceStructure, dispatch, pluginDatasourceForm],
+ );
+
+ useEffect(
+ function selectFirstTable() {
+ if (!selectedTable && datasourceStructure?.tables?.length && !isLoading) {
+ setSelectedTable(datasourceStructure.tables[0].name);
+ }
+ },
+ [selectedTable, props.datasourceId, isLoading, datasourceStructure],
+ );
const refreshStructure = useCallback(() => {
dispatch(
@@ -134,7 +148,7 @@ const Schema = (props: Props) => {
overflow="hidden"
>
{
return (
-
+
{props.datasource && (
-
+
{datasource && (
Date: Fri, 15 Nov 2024 08:31:18 +0530
Subject: [PATCH 02/17] fix: changed schema location
---
.../components/{Schema.tsx => Schema/index.tsx} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename app/client/src/PluginActionEditor/components/PluginActionResponse/components/{Schema.tsx => Schema/index.tsx} (100%)
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
similarity index 100%
rename from app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx
rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
From 6d77b2e2daa8e3a75bb7316f4522cedb62535daf Mon Sep 17 00:00:00 2001
From: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com>
Date: Fri, 15 Nov 2024 08:33:30 +0530
Subject: [PATCH 03/17] fix: import issue getPluginActionDevuggerState in
schema
---
.../components/PluginActionResponse/components/Schema/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
index 31473bcbaf7b..0bb205aef1a9 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
@@ -18,7 +18,6 @@ import DatasourceField from "pages/Editor/DatasourceInfo/DatasourceField";
import { find } from "lodash";
import type { AppState } from "ee/reducers";
import RenderInterimDataState from "pages/Editor/DatasourceInfo/RenderInterimDataState";
-import { getPluginActionDebuggerState } from "../../../store";
import {
fetchDatasourceStructure,
refreshDatasourceStructure,
@@ -28,6 +27,7 @@ import { datasourcesEditorIdURL } from "ee/RouteBuilder";
import { EntityIcon } from "pages/Editor/Explorer/ExplorerIcons";
import { getAssetUrl } from "ee/utils/airgapHelpers";
import { DatasourceComponentTypes } from "api/PluginApi";
+import { getPluginActionDebuggerState } from "PluginActionEditor/store";
interface Props {
datasourceId: string;
From 3f7e26b753800a820bc580a85904fbd99ee1e43a Mon Sep 17 00:00:00 2001
From: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com>
Date: Fri, 15 Nov 2024 12:39:52 +0530
Subject: [PATCH 04/17] fix: added status-display
---
.../components/Schema/StatusDisplay.tsx | 91 +++++++++++++++++++
.../components/Schema/index.tsx | 65 +++++++------
2 files changed, 128 insertions(+), 28 deletions(-)
create mode 100644 app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx
new file mode 100644
index 000000000000..47391e37fd32
--- /dev/null
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx
@@ -0,0 +1,91 @@
+import React, { type ReactNode } from "react";
+
+import { Flex, Spinner, Text } from "@appsmith/ads";
+
+import {
+ createMessage,
+ EMPTY_TABLE_MESSAGE_TEXT,
+ EMPTY_TABLE_TITLE_TEXT,
+ FAILED_RECORDS_MESSAGE_TEXT,
+ FAILED_RECORDS_TITLE_TEXT,
+ LOADING_RECORDS_MESSAGE_TEXT,
+ LOADING_RECORDS_TITLE_TEXT,
+ NO_COLUMNS_MESSAGE_TEXT,
+} from "ee/constants/messages";
+import { getAssetUrl } from "ee/utils/airgapHelpers";
+import { ASSETS_CDN_URL } from "constants/ThirdPartyConstants";
+
+type IStates = "LOADING" | "NODATA" | "FAILED" | "NOCOLUMNS";
+
+interface IProps {
+ state: IStates;
+ height?: string;
+}
+
+const StateData: Record<
+ IStates,
+ { title: string; message: string; image: string | ReactNode }
+> = {
+ LOADING: {
+ title: createMessage(LOADING_RECORDS_TITLE_TEXT),
+ message: createMessage(LOADING_RECORDS_MESSAGE_TEXT),
+ image: ,
+ },
+ NODATA: {
+ title: createMessage(EMPTY_TABLE_TITLE_TEXT),
+ message: createMessage(EMPTY_TABLE_MESSAGE_TEXT),
+ image: getAssetUrl(`${ASSETS_CDN_URL}/empty-state.svg`),
+ },
+ FAILED: {
+ title: createMessage(FAILED_RECORDS_TITLE_TEXT),
+ message: createMessage(FAILED_RECORDS_MESSAGE_TEXT),
+ image: getAssetUrl(`${ASSETS_CDN_URL}/failed-state.svg`),
+ },
+ NOCOLUMNS: {
+ title: createMessage(EMPTY_TABLE_TITLE_TEXT),
+ message: createMessage(NO_COLUMNS_MESSAGE_TEXT),
+ image: getAssetUrl(`${ASSETS_CDN_URL}/empty-state.svg`),
+ },
+};
+
+const StatusDisplay = ({ height, state }: IProps) => {
+ const { image, message, title } = StateData[state];
+
+ return (
+
+
+ {typeof image === "string" ? (
+
+ ) : (
+ image
+ )}
+
+ {title}
+ {message}
+
+
+
+ );
+};
+
+export { StatusDisplay };
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
index 0bb205aef1a9..d4ea109a244f 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
@@ -1,33 +1,34 @@
-import { Button, Flex, Link } from "@appsmith/ads";
-import React, { useCallback, useEffect, useState } from "react";
+import { Flex } from "@appsmith/ads";
+import React, { useEffect, useState } from "react";
import {
DatasourceStructureContext,
type DatasourceColumns,
type DatasourceKeys,
} from "entities/Datasource";
-import { DatasourceStructureContainer as DatasourceStructureList } from "pages/Editor/DatasourceInfo/DatasourceStructureContainer";
+// import { DatasourceStructureContainer as DatasourceStructureList } from "pages/Editor/DatasourceInfo/DatasourceStructureContainer";
import { useDispatch, useSelector } from "react-redux";
import {
getDatasourceStructureById,
getIsFetchingDatasourceStructure,
- getPluginImages,
+ // getPluginImages,
getPluginIdFromDatasourceId,
getPluginDatasourceComponentFromId,
} from "ee/selectors/entitiesSelector";
-import DatasourceField from "pages/Editor/DatasourceInfo/DatasourceField";
+// import DatasourceField from "pages/Editor/DatasourceInfo/DatasourceField";
import { find } from "lodash";
import type { AppState } from "ee/reducers";
import RenderInterimDataState from "pages/Editor/DatasourceInfo/RenderInterimDataState";
import {
fetchDatasourceStructure,
- refreshDatasourceStructure,
+ // refreshDatasourceStructure,
} from "actions/datasourceActions";
-import history from "utils/history";
-import { datasourcesEditorIdURL } from "ee/RouteBuilder";
-import { EntityIcon } from "pages/Editor/Explorer/ExplorerIcons";
-import { getAssetUrl } from "ee/utils/airgapHelpers";
+// import history from "utils/history";
+// import { datasourcesEditorIdURL } from "ee/RouteBuilder";
+// import { EntityIcon } from "pages/Editor/Explorer/ExplorerIcons";
+// import { getAssetUrl } from "ee/utils/airgapHelpers";
import { DatasourceComponentTypes } from "api/PluginApi";
import { getPluginActionDebuggerState } from "PluginActionEditor/store";
+import { StatusDisplay } from "./StatusDisplay";
interface Props {
datasourceId: string;
@@ -46,8 +47,8 @@ const Schema = (props: Props) => {
const pluginId = useSelector((state) =>
getPluginIdFromDatasourceId(state, props.datasourceId),
);
- const pluginImages = useSelector((state) => getPluginImages(state));
- const datasourceIcon = pluginId ? pluginImages[pluginId] : undefined;
+ // const pluginImages = useSelector((state) => getPluginImages(state));
+ // const datasourceIcon = pluginId ? pluginImages[pluginId] : undefined;
const [selectedTable, setSelectedTable] = useState();
@@ -63,8 +64,8 @@ const Schema = (props: Props) => {
columnsAndKeys.push(...selectedTableItems.columns);
}
- const columns =
- find(datasourceStructure?.tables, ["name", selectedTable])?.columns || [];
+ // const columns =
+ // find(datasourceStructure?.tables, ["name", selectedTable])?.columns || [];
const isLoading = useSelector((state: AppState) =>
getIsFetchingDatasourceStructure(state, props.datasourceId),
@@ -114,18 +115,18 @@ const Schema = (props: Props) => {
[selectedTable, props.datasourceId, isLoading, datasourceStructure],
);
- const refreshStructure = useCallback(() => {
- dispatch(
- refreshDatasourceStructure(
- props.datasourceId,
- DatasourceStructureContext.QUERY_EDITOR,
- ),
- );
- }, [dispatch, props.datasourceId]);
+ // const refreshStructure = useCallback(() => {
+ // dispatch(
+ // refreshDatasourceStructure(
+ // props.datasourceId,
+ // DatasourceStructureContext.QUERY_EDITOR,
+ // ),
+ // );
+ // }, [dispatch, props.datasourceId]);
- const goToDatasource = useCallback(() => {
- history.push(datasourcesEditorIdURL({ datasourceId: props.datasourceId }));
- }, [props.datasourceId]);
+ // const goToDatasource = useCallback(() => {
+ // history.push(datasourcesEditorIdURL({ datasourceId: props.datasourceId }));
+ // }, [props.datasourceId]);
if (!datasourceStructure) {
return (
@@ -139,15 +140,23 @@ const Schema = (props: Props) => {
);
}
+ const renderContent = () => {
+ // if (isLoading) {
+ return (
+
+ );
+ // }
+ };
+
return (
- {
/>
);
})}
-
+ */}
);
};
From c58f5d93618b320d02e876c7c3e48d8ece671fa1 Mon Sep 17 00:00:00 2001
From: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com>
Date: Mon, 18 Nov 2024 12:08:50 +0530
Subject: [PATCH 05/17] fix: New changes to schema UI
---
.../components/Schema/CurrentDataSource.tsx | 51 +++++
.../components/Schema/DatasourceSelector.tsx | 185 +++++++++++++++
.../components/Schema/SchemaTables.tsx | 93 ++++++++
.../components/Schema/StatusDisplay.tsx | 81 ++++---
.../components/Schema/TableColumns.tsx | 69 ++++++
.../components/Schema/index.tsx | 210 +++++++-----------
app/client/src/ce/constants/messages.ts | 9 +-
.../Editor/DatasourceInfo/DatasourceField.tsx | 33 +--
.../DatasourceStructureNotFound.tsx | 1 +
9 files changed, 557 insertions(+), 175 deletions(-)
create mode 100644 app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/CurrentDataSource.tsx
create mode 100644 app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/DatasourceSelector.tsx
create mode 100644 app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/SchemaTables.tsx
create mode 100644 app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/TableColumns.tsx
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/CurrentDataSource.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/CurrentDataSource.tsx
new file mode 100644
index 000000000000..f01d40e6aec2
--- /dev/null
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/CurrentDataSource.tsx
@@ -0,0 +1,51 @@
+import React, { useCallback } from "react";
+import { Flex, Link } from "@appsmith/ads";
+import { getAssetUrl } from "ee/utils/airgapHelpers";
+import { EntityIcon } from "pages/Editor/Explorer/ExplorerIcons";
+import history from "utils/history";
+import { datasourcesEditorIdURL } from "ee/RouteBuilder";
+import { useSelector } from "react-redux";
+import {
+ getPluginIdFromDatasourceId,
+ getPluginImages,
+} from "ee/selectors/entitiesSelector";
+
+interface iProps {
+ type: "link" | "trigger";
+ datasourceId: string;
+ datasourceName: string;
+}
+
+const CurrentDataSource = ({ datasourceId, datasourceName, type }: iProps) => {
+ const { pluginId, pluginImages } = useSelector((state) => ({
+ pluginId: getPluginIdFromDatasourceId(state, datasourceId),
+ pluginImages: getPluginImages(state),
+ }));
+
+ const goToDatasource = useCallback(() => {
+ history.push(datasourcesEditorIdURL({ datasourceId }));
+ }, [datasourceId]);
+
+ const datasourceIcon = pluginId ? pluginImages?.[pluginId] : undefined;
+
+ const content = (
+
+
+
+
+ {datasourceName}
+
+ );
+
+ return type === "link" ? (
+ {content}
+ ) : (
+ content
+ );
+};
+
+export { CurrentDataSource };
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/DatasourceSelector.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/DatasourceSelector.tsx
new file mode 100644
index 000000000000..b102716a27ff
--- /dev/null
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/DatasourceSelector.tsx
@@ -0,0 +1,185 @@
+import React, { useCallback } from "react";
+import { useSelector } from "react-redux";
+import {
+ Button,
+ Flex,
+ Icon,
+ Menu,
+ MenuContent,
+ MenuGroup,
+ MenuGroupName,
+ MenuItem,
+ MenuTrigger,
+ Text,
+} from "@appsmith/ads";
+import {
+ CREATE_NEW_DATASOURCE,
+ createMessage,
+ DATASOURCE_SWITCHER_MENU_GROUP_NAME,
+} from "ee/constants/messages";
+import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
+import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
+import {
+ getHasCreateDatasourcePermission,
+ getHasManageActionPermission,
+} from "ee/utils/BusinessFeatures/permissionPageHelpers";
+import { doesPluginRequireDatasource } from "ee/entities/Engine/actionHelpers";
+import {
+ getActionByBaseId,
+ getDatasourceByPluginId,
+ getPlugin,
+ getPluginImages,
+} from "ee/selectors/entitiesSelector";
+import type { Datasource } from "entities/Datasource";
+import type { AppState } from "ee/reducers";
+import { getCurrentAppWorkspace } from "ee/selectors/selectedWorkspaceSelectors";
+import { CurrentDataSource } from "./CurrentDataSource";
+import { useActiveActionBaseId } from "ee/pages/Editor/Explorer/hooks";
+import history from "utils/history";
+import { integrationEditorURL } from "ee/RouteBuilder";
+import { INTEGRATION_TABS } from "constants/routes";
+import { DatasourceCreateEntryPoints } from "constants/Datasource";
+import AnalyticsUtil from "ee/utils/AnalyticsUtil";
+import { getAssetUrl } from "ee/utils/airgapHelpers";
+
+interface Props {
+ datasourceId: string;
+ datasourceName: string;
+}
+
+interface DATASOURCES_OPTIONS_TYPE {
+ label: string;
+ value: string;
+ image: string;
+}
+
+const DatasourceSelector = ({ datasourceId, datasourceName }: Props) => {
+ const [open, setIsOpen] = React.useState(false);
+ const activeActionBaseId = useActiveActionBaseId();
+ const currentActionConfig = useSelector((state) =>
+ activeActionBaseId
+ ? getActionByBaseId(state, activeActionBaseId)
+ : undefined,
+ );
+ const plugin = useSelector((state: AppState) =>
+ getPlugin(state, currentActionConfig?.pluginId || ""),
+ );
+
+ const dataSources = useSelector((state: AppState) =>
+ getDatasourceByPluginId(state, currentActionConfig?.pluginId || ""),
+ );
+
+ const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
+ const userWorkspacePermissions = useSelector(
+ (state: AppState) => getCurrentAppWorkspace(state).userPermissions ?? [],
+ );
+ const isChangePermitted = getHasManageActionPermission(
+ isFeatureEnabled,
+ currentActionConfig?.userPermissions,
+ );
+ const canCreateDatasource = getHasCreateDatasourcePermission(
+ isFeatureEnabled,
+ userWorkspacePermissions,
+ );
+ const showDatasourceSelector = doesPluginRequireDatasource(plugin);
+ const pluginImages = useSelector(getPluginImages);
+
+ const onCreateDatasourceClick = useCallback(() => {
+ history.push(
+ integrationEditorURL({
+ basePageId: currentActionConfig?.pageId,
+ selectedTab: INTEGRATION_TABS.NEW,
+ }),
+ );
+ // Event for datasource creation click
+ const entryPoint = DatasourceCreateEntryPoints.QUERY_EDITOR;
+
+ AnalyticsUtil.logEvent("NAVIGATE_TO_CREATE_NEW_DATASOURCE_PAGE", {
+ entryPoint,
+ });
+ }, [currentActionConfig?.pageId]);
+
+ const DATASOURCES_OPTIONS: Array =
+ dataSources.reduce(
+ (acc: Array, dataSource: Datasource) => {
+ if (dataSource.pluginId === plugin?.id) {
+ acc.push({
+ label: dataSource.name,
+ value: dataSource.id,
+ image: pluginImages[dataSource.pluginId],
+ });
+ }
+
+ return acc;
+ },
+ [],
+ );
+
+ // eslint-disable-next-line no-console
+ console.log(`AB -> showDatasourceSelector = ${showDatasourceSelector}`);
+
+ if (!showDatasourceSelector || !isChangePermitted) {
+ return (
+
+ );
+ }
+
+ const onOpenChange = (newOpen: boolean) => {
+ setIsOpen(newOpen);
+ };
+
+ return (
+
+
+
+ );
+};
+
+export { DatasourceSelector };
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/SchemaTables.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/SchemaTables.tsx
new file mode 100644
index 000000000000..2b7a3c63615d
--- /dev/null
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/SchemaTables.tsx
@@ -0,0 +1,93 @@
+import { Flex, Button } from "@appsmith/ads";
+import {
+ DatasourceStructureContext,
+ type DatasourceStructure,
+} from "entities/Datasource";
+import { DatasourceStructureContainer as DatasourceStructureList } from "pages/Editor/DatasourceInfo/DatasourceStructureContainer";
+import React, { useCallback } from "react";
+import { DatasourceSelector } from "./DatasourceSelector";
+import { refreshDatasourceStructure } from "actions/datasourceActions";
+import { useDispatch } from "react-redux";
+import styled from "styled-components";
+
+interface Props {
+ datasourceId: string;
+ datasourceName: string;
+ currentActionId: string;
+ datasourceStructure: DatasourceStructure;
+ setSelectedTable: (table: string) => void;
+ selectedTable: string | undefined;
+}
+
+const StyledFlex = styled(Flex)`
+ & .t--entity-item {
+ height: 28px;
+ grid-template-columns: 0 auto 1fr auto auto auto auto auto;
+
+ .entity-icon > .ads-v2-icon {
+ display: none;
+ }
+ }
+`;
+
+const SchemaTables = ({
+ currentActionId,
+ datasourceId,
+ datasourceName,
+ datasourceStructure,
+ selectedTable,
+ setSelectedTable,
+}: Props) => {
+ const dispatch = useDispatch();
+
+ const refreshStructure = useCallback(() => {
+ dispatch(
+ refreshDatasourceStructure(
+ datasourceId,
+ DatasourceStructureContext.QUERY_EDITOR,
+ ),
+ );
+ }, [dispatch, datasourceId]);
+
+ return (
+
+
+
+
+
+
+
+ );
+};
+
+export { SchemaTables };
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx
index 47391e37fd32..85070e5d5f70 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx
@@ -1,6 +1,6 @@
import React, { type ReactNode } from "react";
-import { Flex, Spinner, Text } from "@appsmith/ads";
+import { Button, Flex, Spinner, Text } from "@appsmith/ads";
import {
createMessage,
@@ -9,28 +9,48 @@ import {
FAILED_RECORDS_MESSAGE_TEXT,
FAILED_RECORDS_TITLE_TEXT,
LOADING_RECORDS_MESSAGE_TEXT,
- LOADING_RECORDS_TITLE_TEXT,
+ LOADING_SCHEMA_TITLE_TEXT,
NO_COLUMNS_MESSAGE_TEXT,
+ EMPTY_SCHEMA_TITLE_TEXT,
+ EMPTY_SCHEMA_MESSAGE_TEXT,
+ EDIT_DATASOURCE,
+ LOADING_RECORDS_TITLE_TEXT,
} from "ee/constants/messages";
import { getAssetUrl } from "ee/utils/airgapHelpers";
import { ASSETS_CDN_URL } from "constants/ThirdPartyConstants";
-type IStates = "LOADING" | "NODATA" | "FAILED" | "NOCOLUMNS";
+type IStates =
+ | "SCHEMA_LOADING"
+ | "LOADING"
+ | "NOSCHEMA"
+ | "NODATA"
+ | "FAILED"
+ | "NOCOLUMNS";
interface IProps {
state: IStates;
- height?: string;
+ editDatasource?: () => void;
}
const StateData: Record<
IStates,
- { title: string; message: string; image: string | ReactNode }
+ { title: string; message?: string; image: string | ReactNode }
> = {
+ SCHEMA_LOADING: {
+ title: createMessage(LOADING_SCHEMA_TITLE_TEXT),
+ message: createMessage(LOADING_RECORDS_MESSAGE_TEXT),
+ image: ,
+ },
LOADING: {
title: createMessage(LOADING_RECORDS_TITLE_TEXT),
message: createMessage(LOADING_RECORDS_MESSAGE_TEXT),
image: ,
},
+ NOSCHEMA: {
+ title: createMessage(EMPTY_SCHEMA_TITLE_TEXT),
+ message: createMessage(EMPTY_SCHEMA_MESSAGE_TEXT),
+ image: getAssetUrl(`${ASSETS_CDN_URL}/empty-state.svg`),
+ },
NODATA: {
title: createMessage(EMPTY_TABLE_TITLE_TEXT),
message: createMessage(EMPTY_TABLE_MESSAGE_TEXT),
@@ -48,41 +68,46 @@ const StateData: Record<
},
};
-const StatusDisplay = ({ height, state }: IProps) => {
+const StatusDisplay = ({ editDatasource, state }: IProps) => {
const { image, message, title } = StateData[state];
return (
+ {typeof image === "string" ? (
+
+
+
+ ) : (
+ image
+ )}
- {typeof image === "string" ? (
-
- ) : (
- image
+ {title}
+ {message}
+ {state === "FAILED" && (
+
)}
-
- {title}
- {message}
-
);
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/TableColumns.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/TableColumns.tsx
new file mode 100644
index 000000000000..9ea22e21f941
--- /dev/null
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/TableColumns.tsx
@@ -0,0 +1,69 @@
+import React from "react";
+import { Flex } from "@appsmith/ads";
+import { find } from "lodash";
+
+import type {
+ DatasourceColumns,
+ DatasourceKeys,
+ DatasourceStructure,
+} from "entities/Datasource";
+import { StatusDisplay } from "./StatusDisplay";
+import DatasourceField from "pages/Editor/DatasourceInfo/DatasourceField";
+
+interface Props {
+ isLoading: boolean;
+ datasourceStructure: DatasourceStructure;
+ selectedTable: string | undefined;
+}
+
+const TableColumns = ({
+ datasourceStructure,
+ isLoading,
+ selectedTable,
+}: Props) => {
+ const columns =
+ find(datasourceStructure?.tables, ["name", selectedTable])?.columns || [];
+
+ const selectedTableItems = find(datasourceStructure?.tables, [
+ "name",
+ selectedTable,
+ ]);
+
+ const columnsAndKeys: Array = [];
+
+ if (selectedTableItems) {
+ columnsAndKeys.push(...selectedTableItems.keys);
+ columnsAndKeys.push(...selectedTableItems.columns);
+ }
+
+ return (
+
+ {isLoading ? : null}
+ {!isLoading && columns.length === 0 ? (
+
+ ) : null}
+ {!isLoading &&
+ columnsAndKeys.map((field, index) => {
+ return (
+
+ );
+ })}
+
+ );
+};
+
+export { TableColumns };
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
index d4ea109a244f..b45dbd9f307c 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
@@ -1,34 +1,28 @@
import { Flex } from "@appsmith/ads";
import React, { useEffect, useState } from "react";
-import {
- DatasourceStructureContext,
- type DatasourceColumns,
- type DatasourceKeys,
-} from "entities/Datasource";
-// import { DatasourceStructureContainer as DatasourceStructureList } from "pages/Editor/DatasourceInfo/DatasourceStructureContainer";
+import { DatasourceStructureContext } from "entities/Datasource";
import { useDispatch, useSelector } from "react-redux";
import {
getDatasourceStructureById,
getIsFetchingDatasourceStructure,
- // getPluginImages,
getPluginIdFromDatasourceId,
getPluginDatasourceComponentFromId,
} from "ee/selectors/entitiesSelector";
-// import DatasourceField from "pages/Editor/DatasourceInfo/DatasourceField";
-import { find } from "lodash";
import type { AppState } from "ee/reducers";
-import RenderInterimDataState from "pages/Editor/DatasourceInfo/RenderInterimDataState";
-import {
- fetchDatasourceStructure,
- // refreshDatasourceStructure,
-} from "actions/datasourceActions";
-// import history from "utils/history";
-// import { datasourcesEditorIdURL } from "ee/RouteBuilder";
-// import { EntityIcon } from "pages/Editor/Explorer/ExplorerIcons";
-// import { getAssetUrl } from "ee/utils/airgapHelpers";
+import { fetchDatasourceStructure } from "actions/datasourceActions";
+import history from "utils/history";
+import { datasourcesEditorIdURL } from "ee/RouteBuilder";
import { DatasourceComponentTypes } from "api/PluginApi";
import { getPluginActionDebuggerState } from "PluginActionEditor/store";
import { StatusDisplay } from "./StatusDisplay";
+import { DatasourceSelector } from "./DatasourceSelector";
+import { SchemaTables } from "./SchemaTables";
+import { DatasourceEditEntryPoints } from "constants/Datasource";
+import AnalyticsUtil from "ee/utils/AnalyticsUtil";
+import { omit } from "lodash";
+import { getQueryParams } from "utils/URLUtils";
+import { getCurrentPageId } from "selectors/editorSelectors";
+import { TableColumns } from "./TableColumns";
interface Props {
datasourceId: string;
@@ -42,30 +36,16 @@ const Schema = (props: Props) => {
const datasourceStructure = useSelector((state) =>
getDatasourceStructureById(state, props.datasourceId),
);
+
const { responseTabHeight } = useSelector(getPluginActionDebuggerState);
const pluginId = useSelector((state) =>
getPluginIdFromDatasourceId(state, props.datasourceId),
);
- // const pluginImages = useSelector((state) => getPluginImages(state));
- // const datasourceIcon = pluginId ? pluginImages[pluginId] : undefined;
-
- const [selectedTable, setSelectedTable] = useState();
- const selectedTableItems = find(datasourceStructure?.tables, [
- "name",
- selectedTable,
- ]);
+ const currentPageId = useSelector(getCurrentPageId);
- const columnsAndKeys: Array = [];
-
- if (selectedTableItems) {
- columnsAndKeys.push(...selectedTableItems.keys);
- columnsAndKeys.push(...selectedTableItems.columns);
- }
-
- // const columns =
- // find(datasourceStructure?.tables, ["name", selectedTable])?.columns || [];
+ const [selectedTable, setSelectedTable] = useState();
const isLoading = useSelector((state: AppState) =>
getIsFetchingDatasourceStructure(state, props.datasourceId),
@@ -115,117 +95,89 @@ const Schema = (props: Props) => {
[selectedTable, props.datasourceId, isLoading, datasourceStructure],
);
- // const refreshStructure = useCallback(() => {
- // dispatch(
- // refreshDatasourceStructure(
- // props.datasourceId,
- // DatasourceStructureContext.QUERY_EDITOR,
- // ),
- // );
- // }, [dispatch, props.datasourceId]);
+ // eslint-disable-next-line react-perf/jsx-no-new-function-as-prop
+ const editDatasource = () => {
+ const entryPoint = DatasourceEditEntryPoints.QUERY_EDITOR_DATASOURCE_SCHEMA;
+
+ AnalyticsUtil.logEvent("EDIT_DATASOURCE_CLICK", {
+ datasourceId: props.datasourceId,
+ pluginName: "",
+ entryPoint: entryPoint,
+ });
+
+ const url = datasourcesEditorIdURL({
+ basePageId: currentPageId,
+ datasourceId: props.datasourceId,
+ params: { ...omit(getQueryParams(), "viewMode"), viewMode: false },
+ generateEditorPath: true,
+ });
+
+ history.push(url);
+ };
+
+ const getStatusState = () => {
+ if (isLoading) return "SCHEMA_LOADING";
+
+ if (!datasourceStructure) return "NOSCHEMA";
+
+ if (datasourceStructure && "error" in datasourceStructure) return "FAILED";
+
+ return null;
+ };
+
+ const statusState = getStatusState();
- // const goToDatasource = useCallback(() => {
- // history.push(datasourcesEditorIdURL({ datasourceId: props.datasourceId }));
- // }, [props.datasourceId]);
+ const renderStatus = () => {
+ if (!statusState) {
+ return null;
+ }
- if (!datasourceStructure) {
return (
-
- {isLoading ? (
-
- ) : (
-
- )}
-
+ <>
+
+
+
+
+ >
);
- }
+ };
const renderContent = () => {
- // if (isLoading) {
+ if (statusState) {
+ return null;
+ }
+
return (
-
+
+
+
+
);
- // }
};
return (
+ {renderStatus()}
{renderContent()}
- {/*
-
-
-
-
-
-
- {props.datasourceName}
-
-
-
-
-
-
-
- {isLoading ? : null}
- {!isLoading && columns.length === 0 ? (
-
- ) : null}
- {!isLoading &&
- columnsAndKeys.map((field, index) => {
- return (
-
- );
- })}
- */}
);
};
diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts
index b5a102028ede..ff5ca6f652b6 100644
--- a/app/client/src/ce/constants/messages.ts
+++ b/app/client/src/ce/constants/messages.ts
@@ -365,7 +365,7 @@ export const DATASOURCE_UPDATE = (dsName: string) =>
`${dsName} datasource updated successfully`;
export const DATASOURCE_VALID = (dsName: string) =>
`${dsName} datasource is valid`;
-export const EDIT_DATASOURCE = () => "Edit";
+export const EDIT_DATASOURCE = () => "Edit configuration";
export const SAVE_DATASOURCE = () => "Save URL";
export const EDIT_DATASOURCE_TOOLTIP = () => "Edit datasource";
export const SAVE_DATASOURCE_TOOLTIP = () => "Save URL as a datasource";
@@ -2267,14 +2267,19 @@ export const COMMUNITY_TEMPLATES = {
// Interim data state info
export const EMPTY_TABLE_TITLE_TEXT = () => "Empty table";
+export const EMPTY_SCHEMA_TITLE_TEXT = () => "Empty schema";
export const EMPTY_TABLE_MESSAGE_TEXT = () =>
"There are no data records to show";
+export const EMPTY_SCHEMA_MESSAGE_TEXT = () =>
+ "There are no schema records to show";
export const NO_COLUMNS_MESSAGE_TEXT = () => "There are no columns to show";
export const LOADING_RECORDS_TITLE_TEXT = () => "Loading records";
+export const LOADING_SCHEMA_TITLE_TEXT = () => "Loading schema";
export const LOADING_RECORDS_MESSAGE_TEXT = () => "This may take a few seconds";
export const FAILED_RECORDS_TITLE_TEXT = () => "Failed to load";
export const FAILED_RECORDS_MESSAGE_TEXT = () =>
- "There was an error connecting to the datasource. Please check the datasource configuration and retry. If the issue persists, review the datasource settings.";
+ "There was an error connecting to the datasource. Please check the datasource configuration and retry.";
+export const DATASOURCE_SWITCHER_MENU_GROUP_NAME = () => "Select a datasource";
export const DATA_PANE_TITLE = () => "Datasources in your workspace";
export const DATASOURCE_LIST_BLANK_DESCRIPTION = () =>
diff --git a/app/client/src/pages/Editor/DatasourceInfo/DatasourceField.tsx b/app/client/src/pages/Editor/DatasourceInfo/DatasourceField.tsx
index ec9fd5e23d0e..26df6c1d9868 100644
--- a/app/client/src/pages/Editor/DatasourceInfo/DatasourceField.tsx
+++ b/app/client/src/pages/Editor/DatasourceInfo/DatasourceField.tsx
@@ -1,11 +1,8 @@
import React, { useRef } from "react";
-import {
- DATASOURCE_FIELD_ICONS_MAP,
- datasourceColumnIcon,
-} from "../Explorer/ExplorerIcons";
+import { DATASOURCE_FIELD_ICONS_MAP } from "../Explorer/ExplorerIcons";
import styled from "styled-components";
import type { DatasourceColumns, DatasourceKeys } from "entities/Datasource";
-import { Tooltip } from "@appsmith/ads";
+import { Tooltip, Tag, Flex } from "@appsmith/ads";
import { isEllipsisActive } from "utils/helpers";
const Wrapper = styled.div<{ step: number }>`
@@ -21,29 +18,25 @@ const Wrapper = styled.div<{ step: number }>`
const FieldName = styled.div`
color: var(--ads-v2-color-fg);
- flex: 1;
- font-size: 12px;
+ font-size: 14px;
white-space: nowrap;
overflow: hidden;
- line-height: 13px;
text-overflow: ellipsis;
- padding-right: 30px;
`;
const FieldValue = styled.div`
+ color: var(--ads-v2-color-fg-subtle);
text-align: right;
- font-size: 10px;
- line-height: 12px;
+ font-size: 14px;
font-weight: 300;
`;
const Content = styled.div`
margin: 0px 4px;
- flex: 1;
flex-direction: row;
min-width: 0;
display: flex;
- justify-content: space-between;
+ gap: var(--ads-v2-spaces-2);
`;
interface DatabaseFieldProps {
@@ -55,12 +48,11 @@ export function DatabaseColumns(props: DatabaseFieldProps) {
const field = props.field;
const fieldName = field.name;
const fieldType = field.type;
- const icon = DATASOURCE_FIELD_ICONS_MAP[fieldType] || datasourceColumnIcon;
+ const icon = DATASOURCE_FIELD_ICONS_MAP[fieldType];
const nameRef = useRef(null);
return (
- {icon}
{fieldName}
- {fieldType}
+ {icon ? (
+
+
+ {icon}
+ {fieldType}
+
+
+ ) : (
+ {fieldType}
+ )}
);
diff --git a/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureNotFound.tsx b/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureNotFound.tsx
index 35512803cf19..91a6bb1cd3ab 100644
--- a/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureNotFound.tsx
+++ b/app/client/src/pages/Editor/DatasourceInfo/DatasourceStructureNotFound.tsx
@@ -42,6 +42,7 @@ const DatasourceStructureNotFound = (props: Props) => {
const basePageId = useSelector(getCurrentBasePageId);
+ // eslint-disable-next-line react-perf/jsx-no-new-function-as-prop
const editDatasource = () => {
let entryPoint = DatasourceEditEntryPoints.QUERY_EDITOR_DATASOURCE_SCHEMA;
From 2c66b803ad71894226dbabe92fa3a519628ca467 Mon Sep 17 00:00:00 2001
From: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com>
Date: Mon, 18 Nov 2024 13:14:46 +0530
Subject: [PATCH 06/17] feat: added cant show UI for schema tab
---
.../components/Schema/StatusDisplay.tsx | 10 ++++++++--
.../PluginActionResponse/components/Schema/index.tsx | 4 +++-
app/client/src/ce/constants/messages.ts | 2 ++
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx
index 85070e5d5f70..f308e178b678 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/StatusDisplay.tsx
@@ -15,6 +15,7 @@ import {
EMPTY_SCHEMA_MESSAGE_TEXT,
EDIT_DATASOURCE,
LOADING_RECORDS_TITLE_TEXT,
+ CANT_SHOW_SCHEMA,
} from "ee/constants/messages";
import { getAssetUrl } from "ee/utils/airgapHelpers";
import { ASSETS_CDN_URL } from "constants/ThirdPartyConstants";
@@ -25,7 +26,8 @@ type IStates =
| "NOSCHEMA"
| "NODATA"
| "FAILED"
- | "NOCOLUMNS";
+ | "NOCOLUMNS"
+ | "CANTSHOW";
interface IProps {
state: IStates;
@@ -34,7 +36,7 @@ interface IProps {
const StateData: Record<
IStates,
- { title: string; message?: string; image: string | ReactNode }
+ { title?: string; message?: string; image: string | ReactNode }
> = {
SCHEMA_LOADING: {
title: createMessage(LOADING_SCHEMA_TITLE_TEXT),
@@ -66,6 +68,10 @@ const StateData: Record<
message: createMessage(NO_COLUMNS_MESSAGE_TEXT),
image: getAssetUrl(`${ASSETS_CDN_URL}/empty-state.svg`),
},
+ CANTSHOW: {
+ message: createMessage(CANT_SHOW_SCHEMA),
+ image: getAssetUrl(`${ASSETS_CDN_URL}/empty-state.svg`),
+ },
};
const StatusDisplay = ({ editDatasource, state }: IProps) => {
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
index b45dbd9f307c..1eaf555dbf81 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/index.tsx
@@ -19,7 +19,7 @@ import { DatasourceSelector } from "./DatasourceSelector";
import { SchemaTables } from "./SchemaTables";
import { DatasourceEditEntryPoints } from "constants/Datasource";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
-import { omit } from "lodash";
+import { isEmpty, omit } from "lodash";
import { getQueryParams } from "utils/URLUtils";
import { getCurrentPageId } from "selectors/editorSelectors";
import { TableColumns } from "./TableColumns";
@@ -122,6 +122,8 @@ const Schema = (props: Props) => {
if (datasourceStructure && "error" in datasourceStructure) return "FAILED";
+ if (isEmpty(datasourceStructure)) return "CANTSHOW";
+
return null;
};
diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts
index ff5ca6f652b6..7ecc30de905b 100644
--- a/app/client/src/ce/constants/messages.ts
+++ b/app/client/src/ce/constants/messages.ts
@@ -2280,6 +2280,8 @@ export const FAILED_RECORDS_TITLE_TEXT = () => "Failed to load";
export const FAILED_RECORDS_MESSAGE_TEXT = () =>
"There was an error connecting to the datasource. Please check the datasource configuration and retry.";
export const DATASOURCE_SWITCHER_MENU_GROUP_NAME = () => "Select a datasource";
+export const CANT_SHOW_SCHEMA = () =>
+ "We can’t show the schema for this datasource";
export const DATA_PANE_TITLE = () => "Datasources in your workspace";
export const DATASOURCE_LIST_BLANK_DESCRIPTION = () =>
From 28c3d2f3e5a68b7bbd63ae677b36cb59e85da93d Mon Sep 17 00:00:00 2001
From: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com>
Date: Mon, 18 Nov 2024 23:52:34 +0530
Subject: [PATCH 07/17] fix: datasource selector change created
---
.../components/Schema/DatasourceSelector.tsx | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/DatasourceSelector.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/DatasourceSelector.tsx
index b102716a27ff..876896d15335 100644
--- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/DatasourceSelector.tsx
+++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema/DatasourceSelector.tsx
@@ -41,6 +41,9 @@ import { INTEGRATION_TABS } from "constants/routes";
import { DatasourceCreateEntryPoints } from "constants/Datasource";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { getAssetUrl } from "ee/utils/airgapHelpers";
+import { change } from "redux-form";
+import { useDispatch } from "react-redux";
+import { QUERY_EDITOR_FORM_NAME } from "ee/constants/forms";
interface Props {
datasourceId: string;
@@ -54,6 +57,7 @@ interface DATASOURCES_OPTIONS_TYPE {
}
const DatasourceSelector = ({ datasourceId, datasourceName }: Props) => {
+ const dispatch = useDispatch();
const [open, setIsOpen] = React.useState(false);
const activeActionBaseId = useActiveActionBaseId();
const currentActionConfig = useSelector((state) =>
@@ -115,9 +119,6 @@ const DatasourceSelector = ({ datasourceId, datasourceName }: Props) => {
[],
);
- // eslint-disable-next-line no-console
- console.log(`AB -> showDatasourceSelector = ${showDatasourceSelector}`);
-
if (!showDatasourceSelector || !isChangePermitted) {
return (
{
);
}
+ // eslint-disable-next-line react-perf/jsx-no-new-function-as-prop
const onOpenChange = (newOpen: boolean) => {
setIsOpen(newOpen);
};
+ const handleMenuSelect = (value: string) => {
+ dispatch(change(QUERY_EDITOR_FORM_NAME, "datasource.id", value));
+ };
+
return (