Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ describe(
dataSources.FillAuthAPIUrl();
dataSources.SaveDatasource();
apiPage.CreateApi("API" + uid, "GET", true);
agHelper.AssertElementAbsence(apiPage._saveAsDS);
apiPage.SelectPaneTab("Authentication");
agHelper.AssertElementEnabledDisabled(apiPage._saveAsDS, 0, false);
// Last one if present on the authentication tab.
agHelper.AssertElementEnabledDisabled(apiPage._saveAsDS, 1, false);
agHelper.AssertElementEnabledDisabled(apiPage._saveAsDS, 0, false);
});
});
},
Expand Down
1 change: 1 addition & 0 deletions app/client/cypress/e2e/Sanity/Datasources/GraphQL_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ describe(
variable: GRAPHQL_VARIABLES,
});
apiPage.RunAPI();
apiPage.SelectPaneTab("Authentication");
agHelper.GetNClick(locators._saveDatasource);
dataSources.AssertDataSourceInfo([
dataManager.dsValues[
Expand Down
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 @@ -15,23 +15,24 @@ import { datasourcesEditorIdURL } from "ee/RouteBuilder";
import { DatasourceComponentTypes } from "api/PluginApi";
import { getPluginActionDebuggerState } from "PluginActionEditor/store";
import { SchemaDisplayStatus, StatusDisplay } from "./StatusDisplay";
import DatasourceSelector from "./DatasourceSelector";
import { SchemaTables } from "./SchemaTables";
import { DatasourceTables } from "./DatasourceTables";
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 { useEditorType } from "ee/hooks";
import { useParentEntityInfo } from "ee/hooks/datasourceEditorHooks";
import DatasourceInfo from "./DatasourceInfo";

interface Props {
datasourceId: string;
datasourceName: string;
currentActionId: string;
}

const Schema = (props: Props) => {
const Datasource = (props: Props) => {
const dispatch = useDispatch();

const datasourceStructure = useSelector((state) =>
Expand All @@ -44,7 +45,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 +109,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 @@ -137,13 +139,12 @@ const Schema = (props: Props) => {
}

return (
<>
<Flex padding="spaces-3">
<DatasourceSelector
datasourceId={props.datasourceId}
datasourceName={props.datasourceName}
/>
</Flex>
<Flex flexDirection="column" padding="spaces-3">
<DatasourceInfo
datasourceId={props.datasourceId}
datasourceName={props.datasourceName}
showEditButton={!isLoading}
/>
<StatusDisplay
editDatasource={editDatasource}
errorMessage={
Expand All @@ -153,7 +154,7 @@ const Schema = (props: Props) => {
}
state={statusState}
/>
</>
</Flex>
);
};

Expand All @@ -164,7 +165,7 @@ const Schema = (props: Props) => {

return (
<Flex h="100%">
<SchemaTables
<DatasourceTables
currentActionId={props.currentActionId}
datasourceId={props.datasourceId}
datasourceName={props.datasourceName}
Expand Down Expand Up @@ -194,4 +195,4 @@ const Schema = (props: Props) => {
);
};

export { Schema };
export { Datasource };
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React from "react";
import { Button, Flex, Tooltip } from "@appsmith/ads";
import DatasourceSelector from "./DatasourceSelector";
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 { omit } from "lodash";
import { getQueryParams } from "utils/URLUtils";
import history from "utils/history";
import { useEditorType } from "ee/hooks";
import { useParentEntityInfo } from "ee/hooks/datasourceEditorHooks";

interface Props {
datasourceId: string;
datasourceName: string;
showEditButton: boolean;
}

const DatasourceInfo = ({
datasourceId,
datasourceName,
showEditButton,
}: Props) => {
const editorType = useEditorType(location.pathname);
const { parentEntityId } = useParentEntityInfo(editorType);

// 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,
});

history.push(url);
};

return (
<Flex alignItems={"center"} gap="spaces-2">
<DatasourceSelector
datasourceId={datasourceId}
datasourceName={datasourceName}
/>
{showEditButton && (
<Tooltip content={createMessage(EDIT_DS_CONFIG)} placement="top">
<Button
isIconButton
kind="tertiary"
onClick={editDatasource}
size="sm"
startIcon="datasource-config"
/>
</Tooltip>
)}
</Flex>
);
};

export default DatasourceInfo;
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,18 +20,17 @@ 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 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 { 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;
formName: string;
}

type Props = InjectedFormProps<Action, CustomProps> & CustomProps;
Expand All @@ -44,7 +43,11 @@ interface DATASOURCES_OPTIONS_TYPE {
onSelect?: (value: string) => void;
}

const DatasourceSelector = ({ datasourceId, datasourceName }: Props) => {
export const PluginDatasourceSelector = ({
datasourceId,
datasourceName,
formName,
}: Props) => {
const activeActionBaseId = useActiveActionBaseId();
const currentActionConfig = useSelector((state) =>
activeActionBaseId
Expand Down Expand Up @@ -118,7 +121,7 @@ const DatasourceSelector = ({ datasourceId, datasourceName }: Props) => {
<Flex>
<MenuField
className={"t--switch-datasource"}
formName={QUERY_EDITOR_FORM_NAME}
formName={formName}
name="datasource.id"
options={DATASOURCES_OPTIONS}
>
Expand All @@ -130,9 +133,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,31 @@
import React from "react";
import { UIComponentTypes } from "api/PluginApi";
import { usePluginActionContext } from "PluginActionEditor/PluginActionContext";
import ApiDatasourceSelector from "./ApiDatasourceSelector";
import QueryDatasourceSelector from "./QueryDatasourceSelector";
import {
API_EDITOR_FORM_NAME,
QUERY_EDITOR_FORM_NAME,
} from "ee/constants/forms";

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} formName={API_EDITOR_FORM_NAME} />
) : (
<QueryDatasourceSelector {...props} formName={QUERY_EDITOR_FORM_NAME} />
);
};

export default DatasourceSelector;
Loading