Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d09966f
fixing the switch UI for JS objects function popover & updating query…
ankitakinger Dec 4, 2024
ff52c5f
updating the schema tab to datasource tab
ankitakinger Dec 4, 2024
1ddf9ca
adding background to query status bar in response pane to avoid text …
ankitakinger Dec 4, 2024
cb3688f
updating locators
ankitakinger Dec 4, 2024
12bc4fc
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Dec 5, 2024
0baa8af
removing the edit datasource button for saved APIs next to the URL
ankitakinger Dec 6, 2024
a6f06fd
adding the datasource selector and datasource tab for APIs
ankitakinger Dec 6, 2024
059cd8f
Migration to add documentation link to rest api plugin
trishaanand Dec 6, 2024
aeebee2
Merge branch 'chore/actions-redesign-fixes' of github.com:appsmithorg…
trishaanand Dec 6, 2024
5c0d7cb
hiding the edit config icon button when schema is loading
ankitakinger Dec 6, 2024
9b15718
Merge branch 'chore/actions-redesign-fixes' of https://github.com/app…
ankitakinger Dec 6, 2024
077835c
updating icon
ankitakinger Dec 6, 2024
cd89c1f
adding no access state for datasource tab
ankitakinger Dec 6, 2024
e2f4937
addressing review comments
ankitakinger Dec 6, 2024
3ac69bf
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Dec 6, 2024
adc124b
Merge branch 'release' into chore/actions-redesign-fixes
hetunandu Dec 9, 2024
b295ed9
fixing tests
ankitakinger Dec 9, 2024
1b0c9db
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Dec 9, 2024
925369c
fixing unit test
ankitakinger Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/client/cypress/support/Pages/DataSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class DataSources {
".t--datasource-name:contains('" + dsName + "')";
_mandatoryMark = "//span[text()='*']";
_deleteDSHostPort = ".t--delete-field";
_dsTabSchema = "[data-testid='t--tab-SCHEMA_TAB']";
_dsTabSchema = "[data-testid='t--tab-DATASOURCE_TAB']";
private _pageSelectionMenu = "[data-testid='t--page-selection']";

private _pageSelectMenuItem = ".ads-v2-menu__menu-item";
Expand Down Expand Up @@ -1891,7 +1891,9 @@ export class DataSources {
cy.intercept("GET", "/api/v1/datasources/*/structure?ignoreCache=*").as(
`getDatasourceStructureUpdated_${ds_entity_name}`,
);
cy.get("[data-testid=t--tab-SCHEMA_TAB]").first().click({ force: true });
cy.get("[data-testid=t--tab-DATASOURCE_TAB]")
.first()
.click({ force: true });
this.RefreshDatasourceSchema();
this.assertHelper
.WaitForNetworkCall(`@getDatasourceStructureUpdated_${ds_entity_name}`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,10 @@ const DashboardLineIcon = importSvg(
async () => import("../__assets__/icons/ads/dashboard-line.svg"),
);

const DatasourceConfigIcon = importSvg(
async () => import("../__assets__/icons/ads/datasource-config.svg"),
);

// v3 icons
const JsSquareV3Icon = importSvg(
async () => import("../__assets__/icons/ads/js-square-v3-icon.svg"),
Expand Down Expand Up @@ -1173,6 +1177,7 @@ const ICON_LOOKUP = {
"cut-control": CutIcon,
"dashboard-line": DashboardLineIcon,
"database-2-line": Database2Line,
"datasource-config": DatasourceConfigIcon,
"datasource-v3": DatasourceV3Icon,
"datasources-2": Datasources2,
"decrease-control": DecreaseIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const StyledSwitchLabel = styled(Text)<{
justify-content: space-between;
min-width: 9rem;
cursor: pointer;
word-break: break-all;

${({ isDisabled }) =>
isDisabled &&
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ class EmbeddedDatasourcePathComponent extends React.Component<
</Text>
</StyledTooltip>
)}
{displayValue && (
{displayValue && shouldSave && (
<StoreAsDatasource
datasourceId={
datasourceObject && "id" in datasourceObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function PluginActionResponse() {
dispatch(
setPluginActionEditorDebuggerState({
open: true,
selectedTab: DEBUGGER_TAB_KEYS.SCHEMA_TAB,
selectedTab: DEBUGGER_TAB_KEYS.DATASOURCE_TAB,
}),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export const StatusBar = styled.div`
display: flex;
justify-content: space-between;
height: ${TAB_BAR_HEIGHT}px;
padding: 8px;
padding: 8px 8px 8px 12px;
border-bottom: 1px solid var(--ads-v2-color-border);
z-index: var(--ads-v2-z-index-1);
background: var(--ads-v2-color-bg);
Comment thread
ankitakinger marked this conversation as resolved.
`;

export const StatusBarInfo = styled.div`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { API_EDITOR_FORM_NAME } from "ee/constants/forms";
import { type Action } from "entities/Action";
import { reduxForm } from "redux-form";
import {
PluginDatasourceSelector,
type CustomProps,
} from "./PluginDatasourceSelector";

export default reduxForm<Action, CustomProps>({
form: API_EDITOR_FORM_NAME,
destroyOnUnmount: false,
enableReinitialize: true,
})(PluginDatasourceSelector);
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ import type { AppState } from "ee/reducers";
import { getCurrentAppWorkspace } from "ee/selectors/selectedWorkspaceSelectors";
import { useActiveActionBaseId } from "ee/pages/Editor/Explorer/hooks";
import { INTEGRATION_TABS } from "constants/routes";
import { QUERY_EDITOR_FORM_NAME } from "ee/constants/forms";
import {
API_EDITOR_FORM_NAME,
QUERY_EDITOR_FORM_NAME,
} from "ee/constants/forms";
import MenuField from "components/editorComponents/form/fields/MenuField";
import type { InjectedFormProps } from "redux-form";
import { reduxForm } from "redux-form";
import type { Action } from "entities/Action";
import { CurrentDataSourceLink } from "./CurrentDataSourceLink";
import { CurrentDataSource } from "./CurrentDataSource";
import { PluginType, type Action } from "entities/Action";
import { CurrentDataSourceLink } from "../CurrentDataSourceLink";
import { CurrentDataSource } from "../CurrentDataSource";
import { useCreateDatasource } from "ee/PluginActionEditor/hooks/useCreateDatasource";

interface CustomProps {
export interface CustomProps {
datasourceId: string;
datasourceName: string;
}
Expand All @@ -44,7 +46,10 @@ interface DATASOURCES_OPTIONS_TYPE {
onSelect?: (value: string) => void;
}

const DatasourceSelector = ({ datasourceId, datasourceName }: Props) => {
export const PluginDatasourceSelector = ({
datasourceId,
datasourceName,
}: Props) => {
const activeActionBaseId = useActiveActionBaseId();
const currentActionConfig = useSelector((state) =>
activeActionBaseId
Expand Down Expand Up @@ -118,7 +123,11 @@ const DatasourceSelector = ({ datasourceId, datasourceName }: Props) => {
<Flex>
<MenuField
className={"t--switch-datasource"}
formName={QUERY_EDITOR_FORM_NAME}
formName={
plugin?.type === PluginType.API
? API_EDITOR_FORM_NAME
: QUERY_EDITOR_FORM_NAME
Comment thread
ankitakinger marked this conversation as resolved.
Outdated
}
name="datasource.id"
options={DATASOURCES_OPTIONS}
>
Expand All @@ -130,9 +139,3 @@ const DatasourceSelector = ({ datasourceId, datasourceName }: Props) => {
</Flex>
);
};

export default reduxForm<Action, CustomProps>({
form: QUERY_EDITOR_FORM_NAME,
destroyOnUnmount: false,
enableReinitialize: true,
})(DatasourceSelector);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { QUERY_EDITOR_FORM_NAME } from "ee/constants/forms";
import { type Action } from "entities/Action";
import { reduxForm } from "redux-form";
import {
PluginDatasourceSelector,
type CustomProps,
} from "./PluginDatasourceSelector";

export default reduxForm<Action, CustomProps>({
form: QUERY_EDITOR_FORM_NAME,
destroyOnUnmount: false,
enableReinitialize: true,
})(PluginDatasourceSelector);
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from "react";
import { UIComponentTypes } from "api/PluginApi";
import { usePluginActionContext } from "PluginActionEditor/PluginActionContext";
import ApiDatasourceSelector from "./ApiDatasourceSelector";
import QueryDatasourceSelector from "./QueryDatasourceSelector";

const API_FORM_COMPONENTS = [
UIComponentTypes.ApiEditorForm,
UIComponentTypes.GraphQLEditorForm,
];

export interface DatasourceProps {
datasourceId: string;
datasourceName: string;
}

const DatasourceSelector = (props: DatasourceProps) => {
const { plugin } = usePluginActionContext();

return API_FORM_COMPONENTS.includes(plugin.uiComponent) ? (
<ApiDatasourceSelector {...props} />
) : (
<QueryDatasourceSelector {...props} />
Comment thread
ankitakinger marked this conversation as resolved.
Outdated
);
};

export default DatasourceSelector;
Comment thread
ankitakinger marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flex } from "@appsmith/ads";
import { Button, Flex, Tooltip } from "@appsmith/ads";
import React, { useEffect, useState } from "react";
import { DatasourceStructureContext } from "entities/Datasource";
import { useDispatch, useSelector } from "react-redux";
Expand All @@ -21,9 +21,11 @@ import { DatasourceEditEntryPoints } from "constants/Datasource";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { isEmpty, omit } from "lodash";
import { getQueryParams } from "utils/URLUtils";
import { getCurrentPageId } from "selectors/editorSelectors";
import { TableColumns } from "./TableColumns";
import { BOTTOMBAR_HEIGHT } from "./constants";
import { createMessage, EDIT_DS_CONFIG } from "ee/constants/messages";
import { useEditorType } from "ee/hooks";
import { useParentEntityInfo } from "ee/hooks/datasourceEditorHooks";

interface Props {
datasourceId: string;
Expand All @@ -44,7 +46,8 @@ const Schema = (props: Props) => {
getPluginIdFromDatasourceId(state, props.datasourceId),
);

const currentPageId = useSelector(getCurrentPageId);
const editorType = useEditorType(location.pathname);
const { parentEntityId } = useParentEntityInfo(editorType);

const [selectedTable, setSelectedTable] = useState<string>();

Expand Down Expand Up @@ -107,7 +110,7 @@ const Schema = (props: Props) => {
});

const url = datasourcesEditorIdURL({
basePageId: currentPageId,
baseParentEntityId: parentEntityId,
datasourceId: props.datasourceId,
params: { ...omit(getQueryParams(), "viewMode"), viewMode: false },
generateEditorPath: true,
Expand Down Expand Up @@ -143,6 +146,15 @@ const Schema = (props: Props) => {
datasourceId={props.datasourceId}
datasourceName={props.datasourceName}
/>
<Tooltip content={createMessage(EDIT_DS_CONFIG)} placement="top">
<Button
isIconButton
kind="tertiary"
onClick={editDatasource}
size="sm"
startIcon="datasource-config"
/>
</Tooltip>
Comment thread
ankitakinger marked this conversation as resolved.
Outdated
</Flex>
<StatusDisplay
editDatasource={editDatasource}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flex, Button } from "@appsmith/ads";
import { Flex, Button, Tooltip } from "@appsmith/ads";
import {
DatasourceStructureContext,
type DatasourceStructure,
Expand All @@ -9,6 +9,15 @@ import DatasourceSelector from "./DatasourceSelector";
import { refreshDatasourceStructure } from "actions/datasourceActions";
import { useDispatch } from "react-redux";
import { SchemaTableContainer } from "./styles";
import { createMessage, EDIT_DS_CONFIG } from "ee/constants/messages";
import { DatasourceEditEntryPoints } from "constants/Datasource";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { datasourcesEditorIdURL } from "ee/RouteBuilder";
import history from "utils/history";
import { omit } from "lodash";
import { getQueryParams } from "utils/URLUtils";
import { useEditorType } from "ee/hooks";
import { useParentEntityInfo } from "ee/hooks/datasourceEditorHooks";

interface Props {
datasourceId: string;
Expand All @@ -28,6 +37,8 @@ const SchemaTables = ({
setSelectedTable,
}: Props) => {
const dispatch = useDispatch();
const editorType = useEditorType(location.pathname);
const { parentEntityId } = useParentEntityInfo(editorType);

const refreshStructure = useCallback(() => {
dispatch(
Expand All @@ -38,6 +49,26 @@ const SchemaTables = ({
);
}, [dispatch, 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: datasourceId,
pluginName: "",
entryPoint: entryPoint,
});

const url = datasourcesEditorIdURL({
baseParentEntityId: parentEntityId,
datasourceId: datasourceId,
params: { ...omit(getQueryParams(), "viewMode"), viewMode: false },
generateEditorPath: true,
});
Comment thread
ankitakinger marked this conversation as resolved.
Outdated

history.push(url);
};
Comment thread
ankitakinger marked this conversation as resolved.
Outdated

return (
<SchemaTableContainer
data-testid="t--datasource-schema-container"
Expand All @@ -53,10 +84,21 @@ const SchemaTables = ({
gap="spaces-2"
justifyContent={"space-between"}
>
<DatasourceSelector
datasourceId={datasourceId}
datasourceName={datasourceName}
/>
<Flex alignItems={"center"} gap="spaces-2">
<DatasourceSelector
datasourceId={datasourceId}
datasourceName={datasourceName}
/>
<Tooltip content={createMessage(EDIT_DS_CONFIG)} placement="top">
<Button
isIconButton
kind="tertiary"
onClick={editDatasource}
size="sm"
startIcon="datasource-config"
/>
</Tooltip>
</Flex>
Comment thread
ankitakinger marked this conversation as resolved.
Outdated
<Button
className="datasourceStructure-refresh"
isIconButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ function usePluginActionResponseTabs() {
};

if (plugin.type === PluginType.API) {
if (datasource && "id" in datasource) {
tabs.push({
key: DEBUGGER_TAB_KEYS.DATASOURCE_TAB,
title: "Datasource",
panelComponent: (
<Schema
currentActionId={action.id}
datasourceId={datasource?.id || ""}
datasourceName={datasource?.name || ""}
/>
),
});
}

tabs.push(
{
key: DEBUGGER_TAB_KEYS.RESPONSE_TAB,
Expand Down Expand Up @@ -111,8 +125,8 @@ function usePluginActionResponseTabs() {

if (showSchema) {
tabs.push({
key: DEBUGGER_TAB_KEYS.SCHEMA_TAB,
title: "Schema",
key: DEBUGGER_TAB_KEYS.DATASOURCE_TAB,
title: "Datasource",
panelComponent: (
<Schema
currentActionId={action.id}
Expand Down
1 change: 1 addition & 0 deletions app/client/src/ce/constants/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ export const CREATE_NEW_DATASOURCE_DATABASE_HEADER = () => "Databases";
export const CREATE_NEW_DATASOURCE_MOST_POPULAR_HEADER = () => "Most popular";
export const CREATE_NEW_DATASOURCE_REST_API = () => "REST API";
export const SAMPLE_DATASOURCES = () => "Sample datasources";
export const EDIT_DS_CONFIG = () => "Edit datasource configuration";

export const ERROR_EVAL_ERROR_GENERIC = () =>
`Unexpected error occurred while evaluating the application`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function DebuggerTabs() {
const shouldRender = !(
selectedTab === DEBUGGER_TAB_KEYS.RESPONSE_TAB ||
selectedTab === DEBUGGER_TAB_KEYS.HEADER_TAB ||
selectedTab === DEBUGGER_TAB_KEYS.SCHEMA_TAB
selectedTab === DEBUGGER_TAB_KEYS.DATASOURCE_TAB
);

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export enum DEBUGGER_TAB_KEYS {
SCHEMA_TAB = "SCHEMA_TAB",
DATASOURCE_TAB = "DATASOURCE_TAB",
Comment thread
ankitakinger marked this conversation as resolved.
RESPONSE_TAB = "RESPONSE_TAB",
HEADER_TAB = "HEADERS_TAB",
ERROR_TAB = "ERROR_TAB",
Expand Down
Loading