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
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ const FormRender = (props: Props) => {
<FieldWrapper
className="uqi-form-wrapper"
key={`${configProperty}_${idx}`}
style={{ ...(section.zoneCustomStyle || {}) }}
>
<FormControl config={modifiedSection} formName={formName} />
</FieldWrapper>
Expand Down Expand Up @@ -221,7 +222,11 @@ const FormRender = (props: Props) => {
? "single_column"
: "double_column";

return <Zone layout={layout}>{children}</Zone>;
return (
<Zone layout={layout} style={{ ...(section.zoneCustomStyle || {}) }}>
{children}
</Zone>
);
}
default:
return children;
Expand Down
59 changes: 59 additions & 0 deletions app/client/src/components/formControls/DatasourceLinkControl.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React, { useCallback } from "react";
import omit from "lodash/omit";
import history from "utils/history";
import { Button, type ButtonProps } from "@appsmith/ads";
import type { ControlType } from "constants/PropertyControlConstants";

import BaseControl from "./BaseControl";
import type { ControlProps } from "./BaseControl";
import { useParentEntityInfo } from "ee/IDE/hooks/useParentEntityInfo";
import { getIDETypeByUrl } from "ee/entities/IDE/utils";
import { datasourcesEditorIdURL } from "ee/RouteBuilder";
import { getQueryParams } from "utils/URLUtils";

export interface DatasourceLinkControlProps extends ControlProps {
href: string;
text: string;
size?: ButtonProps["size"];
kind?: ButtonProps["kind"];
icon?: ButtonProps["startIcon"];
}
Comment on lines +14 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Missing property in interface definition

The datasourceId property is used in the component implementation but not defined in the DatasourceLinkControlProps interface.

export interface DatasourceLinkControlProps extends ControlProps {
  href: string;
  text: string;
  size?: ButtonProps["size"];
  kind?: ButtonProps["kind"];
  icon?: ButtonProps["startIcon"];
+  datasourceId?: string;
}

Also applies to: 39-39


class DatasourceLinkControl extends BaseControl<DatasourceLinkControlProps> {
getControlType(): ControlType {
return "DATASOURCE_LINK";
}
render() {
return <DatasourceLink {...this.props} />;
}
}

function DatasourceLink(props: DatasourceLinkControlProps) {
const { icon, kind = "secondary", size = "sm", text } = props;
const ideType = getIDETypeByUrl(location.pathname);
const { parentEntityId } = useParentEntityInfo(ideType);

const onPress = useCallback(() => {
const url = datasourcesEditorIdURL({
baseParentEntityId: parentEntityId,
datasourceId: props.datasourceId as string,
params: { ...omit(getQueryParams(), "viewMode"), viewMode: false },
});

history.push(url);
}, [parentEntityId, props.datasourceId]);

return (
<Button
UNSAFE_width="110px"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Avoid using UNSAFE_ prefixed props

The UNSAFE_width prop suggests it might be deprecated or not recommended for general use. Consider using a more standard approach for setting width.


🌐 Web query:

Is UNSAFE_width a deprecated property in Appsmith Button component?

💡 Result:

Based on the provided documentation and resources, there is no evidence that UNSAFE_width is a documented or supported property for Appsmith's Button component[1][10]. The term "UNSAFE_width" doesn't appear in any official Appsmith widget documentation or recent GitHub issues regarding button components.

For width control in Button widgets, Appsmith provides these official methods:

  • Layout properties: Standard width configuration through property pane settings[1][12]
  • Dynamic styling: Programmatic control using JavaScript via setColor() method[1]
  • Theme alignment: Style buttons using theme properties (appsmith.theme)[4]
  • CSS overrides: Custom widget styling through CSS-in-JS patterns[6][11]

The "UNSAFE_" prefix typically indicates internal/experimental React APIs, but Appsmith's component API doesn't use this pattern for its widget properties[1][2]. For width modifications, use the standard width property or CSS-based approaches through Custom widgets[6][11].

For reference, here are the supported width-related patterns for buttons:

Approach Implementation Use Case
Property Pane Direct width adjustment in widget settings Basic layout control
JS Methods setColor() combined with icon positioning[7] Dynamic styling
Custom CSS Using Custom widget's CSS variables[6] Brand-specific designs
Theme Sync appsmith.theme properties for consistency[4] App-wide styling

Citations:


Action: Remove UNSAFE_width Prop for Consistency
The use of the UNSAFE_width prop in DatasourceLinkControl.tsx (line 48) isn’t supported by official Appsmith documentation. Since it doesn’t appear to be a documented or reliable property, please remove it and use a standard width configuration (e.g., via CSS or the widget’s property pane).

  • Remove UNSAFE_width="110px" on line 48.
  • Adopt one of the documented methods for width control as recommended in the Appsmith documentation.

kind={kind}
onClick={onPress}
size={size}
startIcon={icon}
>
{text}
</Button>
);
}

export { DatasourceLinkControl };
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const FunctionCallingConfigForm = ({
</div>

<Button
UNSAFE_width="110px"
kind="secondary"
onClick={handleAddFunctionButtonClick}
startIcon="plus"
Expand Down
14 changes: 14 additions & 0 deletions app/client/src/utils/formControl/FormControlRegistry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ import {
} from "components/formControls/SliderControl";
import { HybridSearchControl } from "components/formControls/HybridSearch";
import FunctionCallingConfigControl from "components/formControls/FunctionCallingConfigControl";
import {
DatasourceLinkControl,
type DatasourceLinkControlProps,
} from "components/formControls/DatasourceLinkControl";

/**
* NOTE: If you are adding a component that uses FormControl
Expand Down Expand Up @@ -240,6 +244,16 @@ class FormControlRegistry {
},
},
);
FormControlFactory.registerControlBuilder(
formControlTypes.DATASOURCE_LINK,
{
buildPropertyControl(
controlProps: DatasourceLinkControlProps,
): JSX.Element {
return <DatasourceLinkControl {...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 @@ -24,4 +24,5 @@ export default {
RAG_DOCUMENTS_SELECTOR: "RAG_DOCUMENTS_SELECTOR",
HYBRID_SEARCH: "HYBRID_SEARCH",
FUNCTION_CALLING_CONFIG_FORM: "FUNCTION_CALLING_CONFIG_FORM",
DATASOURCE_LINK: "DATASOURCE_LINK",
};
Loading