Skip to content

Commit

Permalink
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
Browse files Browse the repository at this point in the history
…external-contribution-35985
  • Loading branch information
AmanAgarwal041 committed Oct 3, 2024
2 parents 7342984 + 0e5f5f7 commit 4682913
Show file tree
Hide file tree
Showing 51 changed files with 780 additions and 486 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci-test-custom-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,22 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: app/client/package.json

- name: Check DB URL
if: steps.run_result.outputs.run_result != 'success'
run: |
db_url=$(grep -oP 'APPSMITH_DB_URL=\K[^ ]+' cicontainerlocal/stacks/configuration/docker.env || echo "")
if [[ -z "$db_url" ]]; then
echo "::error::APPSMITH_DB_URL not found in the environment file"
exit 1
fi
if [[ $db_url == "postgresql"* ]]; then
echo "Database type: Postgres. Ensure PostgreSQL-specific configurations are in place."
elif [[ $db_url == "mongo"* ]]; then
echo "Database type: MongoDB. Verify MongoDB connection settings if issues arise."
else
echo "::warning::Unknown database type. Please verify the database configuration."
fi
# actions/setup-node@v4 doesn’t work properly with Yarn 3
# when the project lives in a subdirectory: https://github.com/actions/setup-node/issues/488
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/server-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ jobs:

- name: Figure out the PR number
run: echo ${{ inputs.pr }}

- name: Default database URL
run: echo "Is this a PG build? ${{ inputs.is-pg-build }}"

- name: Print the Github event
run: echo ${{ github.event_name }}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ describe(
});

it("5. Verify Api binding", () => {
apiPage.CreateAndFillApi("https://mock-api.appsmith.com/users");
apiPage.CreateAndFillApi(
"http://host.docker.internal:5001/v1/dynamicrecords/getrecordsArray",
);
apiPage.RunAPI();
EditorNavigation.SelectEntityByName(
"TreeSelect1",
Expand All @@ -181,7 +183,7 @@ describe(
propPane.MoveToTab("Content");
propPane.UpdatePropertyFieldValue(
"Options",
`{{Api1.data.users.map((s)=>{return{"label":s.name,"value":s.name}})}}`,
`{{JSON.parse(Api1.data).map((item) => {return {"label":item.value, "value":item.abbr};})}}`,
);
agHelper.GetNClick(
`${locators._widgetInDeployed("singleselecttreewidget")}`,
Expand Down Expand Up @@ -308,7 +310,7 @@ describe(
propPane.ToggleJSMode("onOptionChange", true);
propPane.UpdatePropertyFieldValue(
"onOptionChange",
`{{download('http://host.docker.internal:4200/kiwi.svg', 'kiwi.svg', 'image/svg+xml').then(() => {
`{{download('http://host.docker.internal:4200/photo-1503469432756-4aae2e18d881.jpeg', 'flower.svg', 'image/svg+xml').then(() => {
showAlert('Download Success', '');
});}}`,
);
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/fixtures/gitImport.json
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@
"userPermissions": [],
"name": "DEFAULT_REST_DATASOURCE",
"pluginId": "restapi-plugin",
"datasourceConfiguration": { "url": "hhttp://host.docker.internal:5001/v1/mock-api" },
"datasourceConfiguration": { "url": "http://host.docker.internal:5001/v1/mock-api" },
"invalids": [],
"messages": [],
"isValid": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,3 @@ export const ToastBody = styled(Text)`
export const StyledButton = styled(Button)`
align-self: center;
`;

export const StyledPre = styled.pre`
font: inherit;
`;
9 changes: 2 additions & 7 deletions app/client/packages/design-system/ads/src/Toast/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import { Slide, toast as toastifyToast } from "react-toastify";
import "react-toastify/dist/ReactToastify.min.css";

import type { ToastProps } from "./Toast.types";
import {
StyledButton,
StyledPre,
StyledToast,
ToastBody,
} from "./Toast.styles";
import { StyledButton, StyledToast, ToastBody } from "./Toast.styles";
import { getIconByKind } from "../Icon/getIconByKind";

/**
Expand Down Expand Up @@ -45,7 +40,7 @@ const toast = {

return toastifyToast(
<ToastBody kind="body-m">
<StyledPre> {content}</StyledPre>
{content}
{actionText && (
<StyledButton
kind="tertiary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"userDensityRatio": 2.25
},
"innerSpacing": {
"V": 1.4,
"V": 1.2,
"R": 2.25,
"N": 2,
"stepsUp": 8,
"stepsDown": 0,
"userSizingRatio": 0.5,
"userSizingRatio": 1.35,
"userDensityRatio": 2.5
},
"typography": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ import { Flex } from "@appsmith/ads";
import { useChangeActionCall } from "./hooks/useChangeActionCall";
import { usePluginActionContext } from "../../PluginActionContext";
import { UIComponentTypes } from "api/PluginApi";
import GraphQLEditorForm from "./components/GraphQLEditor/GraphQLEditorForm";

const PluginActionForm = () => {
useChangeActionCall();
const { plugin } = usePluginActionContext();

return (
<Flex p="spaces-2" w="100%">
{plugin.uiComponent === UIComponentTypes.ApiEditorForm ? (
{plugin.uiComponent === UIComponentTypes.ApiEditorForm && (
<APIEditorForm />
) : null}
)}
{plugin.uiComponent === UIComponentTypes.GraphQLEditorForm && (
<GraphQLEditorForm />
)}
</Flex>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function useGetFormActionValues() {
// return empty values to avoid form ui issues
if (!formValues || !isAPIAction(formValues)) {
return {
actionConfigurationBody: "",
actionHeaders: [],
actionParams: [],
autoGeneratedHeaders: [],
Expand All @@ -28,6 +29,12 @@ function useGetFormActionValues() {
};
}

const actionConfigurationBody = get(
formValues,
"actionConfiguration.body",
"",
) as string;

const actionHeaders = get(
formValues,
"actionConfiguration.headers",
Expand Down Expand Up @@ -67,6 +74,7 @@ function useGetFormActionValues() {
) as Property[];

return {
actionConfigurationBody,
actionHeaders,
autoGeneratedHeaders,
actionParams,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from "react";
import { reduxForm } from "redux-form";
import { API_EDITOR_FORM_NAME } from "ee/constants/forms";
import CommonEditorForm from "../CommonEditorForm";
import Pagination from "pages/Editor/APIEditor/GraphQL/Pagination";
import { GRAPHQL_HTTP_METHOD_OPTIONS } from "constants/ApiEditorConstants/GraphQLEditorConstants";
import PostBodyData from "./PostBodyData";
import { usePluginActionContext } from "PluginActionEditor";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { getHasManageActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
import { noop } from "lodash";
import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
import useGetFormActionValues from "../CommonEditorForm/hooks/useGetFormActionValues";

const FORM_NAME = API_EDITOR_FORM_NAME;

function GraphQLEditorForm() {
const { action } = usePluginActionContext();
const theme = EditorTheme.LIGHT;

const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
const isChangePermitted = getHasManageActionPermission(
isFeatureEnabled,
action.userPermissions,
);

const { actionConfigurationBody } = useGetFormActionValues();

return (
<CommonEditorForm
action={action}
bodyUIComponent={<PostBodyData actionName={action.name} />}
formName={FORM_NAME}
httpMethodOptions={GRAPHQL_HTTP_METHOD_OPTIONS}
isChangePermitted={isChangePermitted}
paginationUiComponent={
<Pagination
actionName={action.name}
formName={FORM_NAME}
onTestClick={noop}
paginationType={action.actionConfiguration.paginationType}
query={actionConfigurationBody}
theme={theme}
/>
}
/>
);
}

export default reduxForm({ form: FORM_NAME, enableReinitialize: true })(
GraphQLEditorForm,
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import React, { useCallback, useRef } from "react";
import styled from "styled-components";
import QueryEditor from "pages/Editor/APIEditor/GraphQL/QueryEditor";
import VariableEditor from "pages/Editor/APIEditor/GraphQL/VariableEditor";
import useHorizontalResize from "utils/hooks/useHorizontalResize";
import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
import classNames from "classnames";
import { tailwindLayers } from "constants/Layers";

const ResizableDiv = styled.div`
display: flex;
height: 100%;
flex-shrink: 0;
`;

const PostBodyContainer = styled.div`
display: flex;
height: 100%;
overflow: hidden;
&&&& .CodeMirror {
height: 100%;
border-top: 1px solid var(--ads-v2-color-border);
border-bottom: 1px solid var(--ads-v2-color-border);
border-radius: 0;
padding: 0;
}
& .CodeMirror-scroll {
margin: 0px;
padding: 0px;
overflow: auto !important;
}
`;

const ResizerHandler = styled.div<{ resizing: boolean }>`
width: 6px;
height: 100%;
margin-left: 2px;
border-right: 1px solid var(--ads-v2-color-border);
background: ${(props) =>
props.resizing ? "var(--ads-v2-color-border)" : "transparent"};
&:hover {
background: var(--ads-v2-color-border);
border-color: transparent;
}
`;

const DEFAULT_GRAPHQL_VARIABLE_WIDTH = 300;

interface Props {
actionName: string;
}

function PostBodyData(props: Props) {
const { actionName } = props;
const theme = EditorTheme.LIGHT;
const resizeableRef = useRef<HTMLDivElement>(null);
const [variableEditorWidth, setVariableEditorWidth] = React.useState(
DEFAULT_GRAPHQL_VARIABLE_WIDTH,
);
/**
* Variable Editor's resizeable handler for the changing of width
*/
const onVariableEditorWidthChange = useCallback((newWidth) => {
setVariableEditorWidth(newWidth);
}, []);

const { onMouseDown, onMouseUp, onTouchStart, resizing } =
useHorizontalResize(
resizeableRef,
onVariableEditorWidthChange,
undefined,
true,
);

return (
<PostBodyContainer>
<QueryEditor
dataTreePath={`${actionName}.config.body`}
height="100%"
name="actionConfiguration.body"
theme={theme}
/>
<div
className={`w-2 h-full -ml-2 group cursor-ew-resize ${tailwindLayers.resizer}`}
onMouseDown={onMouseDown}
onTouchEnd={onMouseUp}
onTouchStart={onTouchStart}
>
<ResizerHandler
className={classNames({
"transform transition": true,
})}
resizing={resizing}
/>
</div>
<ResizableDiv
ref={resizeableRef}
style={{
width: `${variableEditorWidth}px`,
paddingRight: "2px",
}}
>
<VariableEditor actionName={actionName} theme={theme} />
</ResizableDiv>
</PostBodyContainer>
);
}

export default PostBodyData;
1 change: 1 addition & 0 deletions app/client/src/api/PluginApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export enum UIComponentTypes {
UQIDbEditorForm = "UQIDbEditorForm",
ApiEditorForm = "ApiEditorForm",
JsEditorForm = "JsEditorForm",
GraphQLEditorForm = "GraphQLEditorForm",
}

export enum DatasourceComponentTypes {
Expand Down
4 changes: 0 additions & 4 deletions app/client/src/pages/Editor/APIEditor/ApiEditorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ interface ApiEditorContextContextProps {
saveActionName: (
params: SaveActionNameParams,
) => ReduxAction<SaveActionNameParams>;
closeEditorLink?: React.ReactNode;
showRightPaneTabbedSection?: boolean;
actionRightPaneAdditionSections?: React.ReactNode;
notification?: React.ReactNode | string;
Expand All @@ -31,7 +30,6 @@ export function ApiEditorContextProvider({
actionRightPaneAdditionSections,
actionRightPaneBackLink,
children,
closeEditorLink,
handleDeleteClick,
handleRunClick,
moreActionsMenu,
Expand All @@ -44,7 +42,6 @@ export function ApiEditorContextProvider({
() => ({
actionRightPaneAdditionSections,
actionRightPaneBackLink,
closeEditorLink,
handleDeleteClick,
showRightPaneTabbedSection,
handleRunClick,
Expand All @@ -56,7 +53,6 @@ export function ApiEditorContextProvider({
[
actionRightPaneBackLink,
actionRightPaneAdditionSections,
closeEditorLink,
handleDeleteClick,
showRightPaneTabbedSection,
handleRunClick,
Expand Down
Loading

0 comments on commit 4682913

Please sign in to comment.