Skip to content
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
23 changes: 12 additions & 11 deletions app/client/src/components/editorComponents/ErrorBoundry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { ReactNode, CSSProperties } from "react";
interface Props {
children: ReactNode;
style?: CSSProperties;
fallback?: ReactNode;
}
interface State {
hasError: boolean;
Expand Down Expand Up @@ -47,17 +48,17 @@ class ErrorBoundary extends React.Component<Props, State> {
className="error-boundary"
style={this.props.style}
>
{this.state.hasError ? (
<p>
Oops, Something went wrong.
<br />
<RetryLink onClick={() => this.setState({ hasError: false })}>
Click here to retry
</RetryLink>
</p>
) : (
this.props.children
)}
{this.state.hasError
? this.props.fallback || (
<p>
Oops, Something went wrong.
<br />
<RetryLink onClick={() => this.setState({ hasError: false })}>
Click here to retry
</RetryLink>
</p>
)
: this.props.children}
</ErrorBoundaryContainer>
);
}
Expand Down
1 change: 1 addition & 0 deletions app/client/src/components/formControls/BaseControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export interface ControlData {
validator?: (value: string) => { isValid: boolean; message: string };
isSecretExistsPath?: string;
addMoreButtonLabel?: string;
datasourceId?: string;
}
export type FormConfigType = Omit<ControlData, "configProperty"> & {
configProperty?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { ControlProps } from "../../../../components/formControls/BaseControl";

export interface CarbonButtonProps extends ControlProps {}

export const CarbonButton = () => {
return null;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./CarbonButton";
5 changes: 4 additions & 1 deletion app/client/src/pages/Editor/FormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ function FormControl(props: FormControlProps) {

const FormControlRenderMethod = (config = props.config) => {
return FormControlFactory.createControl(
config,
{
...config,
datasourceId: dsId,
},
props.formName,
props?.multipleConfig,
);
Expand Down
7 changes: 7 additions & 0 deletions app/client/src/utils/formControl/FormControlRegistry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import MultiFilePickerControl from "components/formControls/MultiFilePickerContr
import type { MultipleFilePickerControlProps } from "components/formControls/MultiFilePickerControl";
import type { RadioButtonControlProps } from "components/formControls/RadioButtonControl";
import RadioButtonControl from "components/formControls/RadioButtonControl";
import type { CarbonButtonProps } from "ee/components/formControls/CarbonButton";
import { CarbonButton } from "ee/components/formControls/CarbonButton";

/**
* NOTE: If you are adding a component that uses FormControl
Expand Down Expand Up @@ -190,6 +192,11 @@ class FormControlRegistry {
return <RadioButtonControl {...controlProps} />;
},
});
FormControlFactory.registerControlBuilder(formControlTypes.CARBON_BUTTON, {
buildPropertyControl(controlProps: CarbonButtonProps): JSX.Element {
return <CarbonButton {...controlProps} />;
},
});
}
}

Expand Down
1 change: 1 addition & 0 deletions app/client/src/utils/formControl/formControlTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export default {
FORM_TEMPLATE: "FORM_TEMPLATE",
MULTIPLE_FILE_PICKER: "MULTIPLE_FILE_PICKER",
RADIO_BUTTON: "RADIO_BUTTON",
CARBON_BUTTON: "CARBON_BUTTON",
};