Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [Plugin Action Editor] Defer plugin config checks #37655

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions app/client/src/PluginActionEditor/PluginActionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import type { ActionResponse } from "api/ActionAPI";
interface PluginActionContextType {
action: Action;
actionResponse?: ActionResponse;
editorConfig: unknown[];
settingsConfig: unknown[];
editorConfig?: unknown[];
settingsConfig?: unknown[];
plugin: Plugin;
datasource?: EmbeddedRestDatasource | Datasource;
}
Expand Down
10 changes: 0 additions & 10 deletions app/client/src/PluginActionEditor/PluginActionEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ const PluginActionEditor = (props: ChildrenProps) => {
);
}

if (!settingsConfig || !editorConfig) {
return (
<CenteredWrapper>
<Text color="var(--ads-v2-color-fg-error)" kind="heading-m">
Editor config not found!
</Text>
</CenteredWrapper>
);
}

const actionResponse = actionResponses[action.id];

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import React from "react";
import { Flex } from "@appsmith/ads";
import { Flex, Text } from "@appsmith/ads";
import { useChangeActionCall } from "./hooks/useChangeActionCall";
import { usePluginActionContext } from "../../PluginActionContext";
import { UIComponentTypes } from "api/PluginApi";
import APIEditorForm from "./components/ApiEditor";
import GraphQLEditorForm from "./components/GraphQLEditor";
import UQIEditorForm from "./components/UQIEditor";
import CenteredWrapper from "components/designSystems/appsmith/CenteredWrapper";
import { createMessage, UNEXPECTED_ERROR } from "ee/constants/messages";

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

if (!editorConfig) {
return (
<CenteredWrapper>
<Text color="var(--ads-v2-color-fg-error)" kind="heading-m">
{createMessage(UNEXPECTED_ERROR)}
</Text>
</CenteredWrapper>
);
}

return (
<Flex flex="1" overflow="hidden" p="spaces-4" w="100%">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {
import { isValidFormConfig } from "reducers/evaluationReducers/formEvaluationReducer";
import FormControl from "pages/Editor/FormControl";
import type { ControlProps } from "components/formControls/BaseControl";
import { Spinner } from "@appsmith/ads";
import { Spinner, Text } from "@appsmith/ads";
import CenteredWrapper from "components/designSystems/appsmith/CenteredWrapper";
import type { QueryAction, SaaSAction } from "entities/Action";
import { Section, Zone } from "../ActionForm";

Expand Down Expand Up @@ -265,7 +266,13 @@ const FormRender = (props: Props) => {
};

if (!editorConfig || editorConfig.length < 0) {
return <ErrorComponent errorMessage={createMessage(UNEXPECTED_ERROR)} />;
return (
<CenteredWrapper>
<Text color="var(--ads-v2-color-fg-error)" kind="heading-m">
{createMessage(UNEXPECTED_ERROR)}
</Text>
</CenteredWrapper>
);
}

return renderConfig();
Expand Down
9 changes: 6 additions & 3 deletions app/client/src/pages/Editor/ActionSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import log from "loglevel";
import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
import styled from "styled-components";
import { Text } from "@appsmith/ads";
import CenteredWrapper from "../../components/designSystems/appsmith/CenteredWrapper";

interface ActionSettingsProps {
// TODO: Fix this the next time the file is edited
Expand Down Expand Up @@ -43,9 +44,11 @@ function ActionSettings(props: ActionSettingsProps): JSX.Element {
return (
<ActionSettingsWrapper>
{!props.actionSettingsConfig ? (
<Text color="var(--ads-v2-color-fg-error)" kind="heading-m">
Error: No settings config found
</Text>
<CenteredWrapper>
<Text color="var(--ads-v2-color-fg-error)" kind="heading-m">
Error: No settings config found
</Text>
</CenteredWrapper>
) : (
/* TODO: Fix this the next time the file is edited */
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
Expand Down
Loading