Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Enhance FSign component and form field handling for vault conditions

Muhammad Hamza Khan57cdf2d3af2b
diff --git a/packages/app/src/builder-ui/components/FSign.class.ts b/packages/app/src/builder-ui/components/FSign.class.ts
index 35879078..ca013624 100644
--- a/packages/app/src/builder-ui/components/FSign.class.ts
+++ b/packages/app/src/builder-ui/components/FSign.class.ts
@@ -24,6 +24,7 @@ export class FSign extends FunctionComponent {
},
key: {
type: 'textarea',
+ expandable: true,
label: 'Key / Secret',
attributes: { 'data-template-vars': 'true', 'data-vault': `APICall,ALL_NON_GLOBAL_KEYS` },
help: 'Provide the signing secret or private key; store in <a href="/vault" target="_blank" class="text-blue-600 hover:text-blue-800">Vault</a>, not in code.',
diff --git a/packages/app/src/builder-ui/ui/form/createFormField.ts b/packages/app/src/builder-ui/ui/form/createFormField.ts
index 5b574640..496f7ecc 100644
--- a/packages/app/src/builder-ui/ui/form/createFormField.ts
+++ b/packages/app/src/builder-ui/ui/form/createFormField.ts
@@ -144,20 +144,27 @@ export default function createFormField(entry, displayType = 'block', entryIndex
contentType = currentComponent?.data?.contentType || '';
}
- // Create dynamic vault condition for content type
- const vaultCondition = {
- property: 'contentType',
- value: 'application/json',
- getValue: () => {
- try {
- const select = document.querySelector('#contentType') as HTMLSelectElement;
- return select?.value || '';
- } catch {
- const currentComponent = (window as any).Component?.curComponentSettings;
- return currentComponent?.data?.contentType || '';
+ // Only create vault condition for the 'body' field in APICall component
+ // The contentType is bound to the body field, while other fields are independent
+ let vaultCondition = undefined;
+ const isBodyField = entry.name === 'body' || entry.id === 'body';
+
+ if (isBodyField) {
+ vaultCondition = {
+ property: 'contentType',
+ value: 'application/json',
+ getValue: () => {
+ try {
+ const select = document.querySelector('#contentType') as HTMLSelectElement;
+ return select?.value || '';
+ } catch {
+ const currentComponent = (window as any).Component?.curComponentSettings;
+ return currentComponent?.data?.contentType || '';
+ }
}
- }
- };
+ };
+ }
+ // For other fields with data-vault attribute, vault button will show by default
const textareaResult = createTextArea({
...entry,
diff --git a/packages/app/src/builder-ui/ui/form/fields.ts b/packages/app/src/builder-ui/ui/form/fields.ts
index 33c13872..cdba03b1 100644
--- a/packages/app/src/builder-ui/ui/form/fields.ts
+++ b/packages/app/src/builder-ui/ui/form/fields.ts
@@ -1017,9 +1017,16 @@ async function handleExpandTextarea(
}, 1000);
});
- // Show/hide vault button based on condition (e.g., content type)
- // Only show the vault button when the appropriate conditions are met
- const shouldShowVault = shouldShowVaultButton(vaultCondition, contentType);
+ // Show/hide vault button based on condition
+ // If there's a vaultCondition, check it; otherwise show the button by default
+ // since the field explicitly has data-vault attribute
+ let shouldShowVault = true;
+
+ // Only apply condition check if a vaultCondition was explicitly provided
+ if (vaultCondition) {
+ shouldShowVault = shouldShowVaultButton(vaultCondition, contentType);
+ }
+
if (shouldShowVault) {
newVaultButton.style.display = 'inline-block';
} else {