Skip to content

Commit

Permalink
Merge branch 'release' of https://github.com/PrasadMadine/appsmith in…
Browse files Browse the repository at this point in the history
…to fix/bug-alert-shows-twice-for-select-widget-26696
  • Loading branch information
PrasadMadine committed Sep 25, 2024
2 parents ef0011c + 1210104 commit c0fde14
Show file tree
Hide file tree
Showing 511 changed files with 29,111 additions and 1,700 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ jobs:
run: |
scripts/generate_info_json.sh
- name: Place server artifacts-es
run: |
if [[ -f scripts/prepare_server_artifacts.sh ]]; then
scripts/prepare_server_artifacts.sh
fi
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test-build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,12 @@ jobs:
scripts/generate_info_json.sh
fi
- name: Place server artifacts-es
run: |
if [[ -f scripts/prepare_server_artifacts.sh ]]; then
scripts/prepare_server_artifacts.sh
fi
- name: Set up Depot CLI
uses: depot/setup-action@v1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ describe(
},
function () {
it("Check if autocommit progress bar is visible and network requests are properly called", function () {
featureFlagIntercept({
release_git_autocommit_feature_enabled: true,
});
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
wsName = "GitAC-" + uid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,16 @@ describe("Canvas context Property Pane", { tags: ["@tag.IDE"] }, function () {
propertySectionState = {
basic: false,
general: true,
validation: false,
formsettings: true,
};

if (!Cypress.env("AIRGAPPED")) {
propertySectionState = {
...propertySectionState,
validation: false,
formsettings: true,
};
}

verifyPropertyPaneContext(
() => {
setPropertyPaneSectionState(propertySectionState);
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/Pages/Anvil/Locators/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MAIN_CONTAINER_WIDGET_ID } from "../../../../../src/constants/WidgetConstants";
import { getAnvilCanvasId } from "../../../../../src/layoutSystems/anvil/viewer/canvas/utils";
import { AnvilDataAttributes } from "../../../../../src/widgets/wds/constants";
import { AnvilDataAttributes } from "../../../../../src/modules/ui-builder/ui/wds/constants";

// anvil widget based selectors
const anvilWidgetSelector = "[data-testid=t--anvil-widget-wrapper]";
Expand Down
6 changes: 4 additions & 2 deletions app/client/src/PluginActionEditor/PluginActionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import React, {
} from "react";
import type { Action } from "entities/Action";
import type { Plugin } from "api/PluginApi";
import type { Datasource } from "entities/Datasource";
import type { Datasource, EmbeddedRestDatasource } from "entities/Datasource";
import type { ActionResponse } from "api/ActionAPI";

interface PluginActionContextType {
action: Action;
actionResponse?: ActionResponse;
editorConfig: unknown[];
settingsConfig: unknown[];
plugin: Plugin;
datasource?: Datasource;
datasource?: EmbeddedRestDatasource | Datasource;
}

// No need to export this context to use it. Use the hook defined below instead
Expand Down
6 changes: 6 additions & 0 deletions app/client/src/PluginActionEditor/PluginActionEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { identifyEntityFromPath } from "../navigation/FocusEntity";
import { useSelector } from "react-redux";
import {
getActionByBaseId,
getActionResponses,
getDatasource,
getEditorConfig,
getPlugin,
Expand Down Expand Up @@ -39,6 +40,8 @@ const PluginActionEditor = (props: ChildrenProps) => {

const editorConfig = useSelector((state) => getEditorConfig(state, pluginId));

const actionResponses = useSelector(getActionResponses);

if (!isEditorInitialized) {
return (
<CenteredWrapper>
Expand Down Expand Up @@ -71,9 +74,12 @@ const PluginActionEditor = (props: ChildrenProps) => {
);
}

const actionResponse = actionResponses[action.id];

return (
<PluginActionContextProvider
action={action}
actionResponse={actionResponse}
datasource={datasource}
editorConfig={editorConfig}
plugin={plugin}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const APIEditorForm = () => {
/>
}
formName={FORM_NAME}
headersCount={0}
httpMethodOptions={HTTP_METHOD_OPTIONS}
isChangePermitted={isChangePermitted}
paginationUiComponent={
Expand All @@ -45,7 +44,6 @@ const APIEditorForm = () => {
theme={theme}
/>
}
paramsCount={0}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from "react";
import { type Action } from "entities/Action";
import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
import type { AutoGeneratedHeader } from "pages/Editor/APIEditor/helpers";
import { InfoFields } from "./InfoFields";
import { RequestTabs } from "./RequestTabs";
import { HintMessages } from "./HintMessages";
import { Flex } from "@appsmith/ads";
import useGetFormActionValues from "./hooks/useGetFormActionValues";

interface Props {
httpMethodOptions: { value: string }[];
Expand All @@ -14,27 +14,19 @@ interface Props {
isChangePermitted: boolean;
bodyUIComponent: React.ReactNode;
paginationUiComponent: React.ReactNode;
headersCount: number;
paramsCount: number;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
datasourceHeaders?: any;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
datasourceParams?: any;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
actionConfigurationHeaders?: any;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
actionConfigurationParams?: any;
autoGeneratedActionConfigHeaders?: AutoGeneratedHeader[];
}

const CommonEditorForm = (props: Props) => {
const { action } = props;
const hintMessages = action.messages || [];
const theme = EditorTheme.LIGHT;
const {
actionHeaders,
actionParams,
autoGeneratedHeaders,
datasourceHeaders,
datasourceParams,
} = useGetFormActionValues();

return (
<Flex flexDirection="column" gap="spaces-3" w="100%">
Expand All @@ -48,17 +40,15 @@ const CommonEditorForm = (props: Props) => {
/>
<HintMessages hintMessages={hintMessages} />
<RequestTabs
actionConfigurationHeaders={props.actionConfigurationHeaders}
actionConfigurationParams={props.actionConfigurationParams}
actionConfigurationHeaders={actionHeaders}
actionConfigurationParams={actionParams}
actionName={action.name}
autogeneratedHeaders={props.autoGeneratedActionConfigHeaders}
autogeneratedHeaders={autoGeneratedHeaders}
bodyUIComponent={props.bodyUIComponent}
datasourceHeaders={props.datasourceHeaders}
datasourceParams={props.datasourceParams}
datasourceHeaders={datasourceHeaders}
datasourceParams={datasourceParams}
formName={props.formName}
headersCount={props.headersCount}
paginationUiComponent={props.paginationUiComponent}
paramsCount={props.paramsCount}
pushFields={props.isChangePermitted}
showSettings={false}
theme={theme}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import ApiAuthentication from "pages/Editor/APIEditor/ApiAuthentication";
import ActionSettings from "pages/Editor/ActionSettings";
import { API_EDITOR_TAB_TITLES, createMessage } from "ee/constants/messages";
import { useSelectedFormTab } from "./hooks/useSelectedFormTab";
import { getHeadersCount, getParamsCount } from "./utils";
import type { Property } from "entities/Action";

const SettingsWrapper = styled.div`
padding: var(--ads-v2-spaces-4) 0;
Expand All @@ -31,23 +33,13 @@ const StyledTabPanel = styled(TabPanel)`

export function RequestTabs(props: {
autogeneratedHeaders: AutoGeneratedHeader[] | undefined;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
datasourceHeaders: any;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
actionConfigurationHeaders: any;
headersCount: number;
datasourceHeaders: Property[];
actionConfigurationHeaders: Property[];
actionName: string;
pushFields: boolean;
theme: EditorTheme.LIGHT;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
datasourceParams: any;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
actionConfigurationParams: any;
paramsCount: number;
datasourceParams: Property[];
actionConfigurationParams: Property[];
bodyUIComponent: React.ReactNode;
paginationUiComponent: React.ReactNode;
formName: string;
Expand All @@ -57,27 +49,41 @@ export function RequestTabs(props: {
actionSettingsConfig?: any;
}) {
const [value, onValueChange] = useSelectedFormTab();
const headersCount = getHeadersCount(
props.actionConfigurationHeaders,
props.datasourceHeaders,
props.autogeneratedHeaders,
);

const paramsCount = getParamsCount(
props.actionConfigurationParams,
props.datasourceHeaders,
);

return (
<Tabs className="h-full" onValueChange={onValueChange} value={value}>
<TabsListWrapper>
<TabsList>
{Object.values(API_EDITOR_TABS).map((tab) => (
<Tab
data-testid={`t--api-editor-${tab}`}
key={tab}
notificationCount={
tab == "HEADERS"
? props.headersCount
: tab == "PARAMS"
? props.paramsCount
: undefined
}
value={tab}
>
{createMessage(API_EDITOR_TAB_TITLES[tab])}
</Tab>
))}
{Object.values(API_EDITOR_TABS)
.filter((tab) => {
return !(!props.showSettings && tab === API_EDITOR_TABS.SETTINGS);
})
.map((tab) => (
<Tab
data-testid={`t--api-editor-${tab}`}
key={tab}
notificationCount={
tab == "HEADERS"
? headersCount
: tab == "PARAMS"
? paramsCount
: undefined
}
value={tab}
>
{createMessage(API_EDITOR_TAB_TITLES[tab])}
</Tab>
))}
</TabsList>
</TabsListWrapper>
<StyledTabPanel value={API_EDITOR_TABS.HEADERS}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from "styled-components";
import FormRow from "../../../../../../components/editorComponents/FormRow";
import FormLabel from "../../../../../../components/editorComponents/FormLabel";
import FormRow from "components/editorComponents/FormRow";
import FormLabel from "components/editorComponents/FormLabel";
import { Button, Icon, Text, Tooltip } from "@appsmith/ads";
import {
API_PANE_AUTO_GENERATED_HEADER,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { getFormValues } from "redux-form";
import { API_EDITOR_FORM_NAME } from "ee/constants/forms";
import { getCurrentEnvironmentId } from "ee/selectors/environmentSelectors";
import get from "lodash/get";
import { useSelector } from "react-redux";
import {
type Action,
type ApiAction,
isAPIAction,
type Property,
} from "entities/Action";
import { getDatasources } from "ee/selectors/entitiesSelector";

function useGetFormActionValues() {
const formValues = useSelector(getFormValues(API_EDITOR_FORM_NAME)) as Action;
const datasources = useSelector(getDatasources);
const currentEnvironment = useSelector(getCurrentEnvironmentId);

// In an unlikely scenario where form is not initialised,
// return empty values to avoid form ui issues
if (!isAPIAction(formValues)) {
return {
actionHeaders: [],
actionParams: [],
autoGeneratedHeaders: [],
datasourceParams: [],
datasourceHeaders: [],
};
}

const actionHeaders = get(
formValues,
"actionConfiguration.headers",
[],
) as Property[];

const autoGeneratedHeaders: ApiAction["actionConfiguration"]["autoGeneratedHeaders"] =
get(formValues, "actionConfiguration.autoGeneratedHeaders", []);

const actionParams = get(
formValues,
"actionConfiguration.queryParameters",
[],
) as Property[];

let datasourceFromAction: Action["datasource"] | undefined = get(
formValues,
"datasource",
);

if (datasourceFromAction && Object.hasOwn(datasourceFromAction, "id")) {
datasourceFromAction = datasources.find(
(d) => d.id === datasourceFromAction?.id,
);
}

const datasourceHeaders = get(
datasourceFromAction,
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.headers`,
[],
) as Property[];

const datasourceParams = get(
datasourceFromAction,
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.queryParameters`,
[],
) as Property[];

return {
actionHeaders,
autoGeneratedHeaders,
actionParams,
datasourceHeaders,
datasourceParams,
};
}

export default useGetFormActionValues;
Loading

0 comments on commit c0fde14

Please sign in to comment.