diff --git a/CHANGELOG.md b/CHANGELOG.md index c1918de03e..745e8294ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ and this project adheres to ### Added +- Add workflow template publishing to collaborative editor + [#3921](https://github.com/OpenFn/lightning/issues/3921) + ### Changed - Enable usage limit checks across the whole application diff --git a/assets/js/collaborative-editor/components/WorkflowEditor.tsx b/assets/js/collaborative-editor/components/WorkflowEditor.tsx index a43d17bd6b..9a6b1967ac 100644 --- a/assets/js/collaborative-editor/components/WorkflowEditor.tsx +++ b/assets/js/collaborative-editor/components/WorkflowEditor.tsx @@ -203,6 +203,7 @@ export function WorkflowEditor({ const showInspector = searchParams.get('panel') === 'settings' || searchParams.get('panel') === 'code' || + searchParams.get('panel') === 'publish-template' || Boolean(currentNode.node); const handleMethodChange = (method: 'template' | 'import' | 'ai' | null) => { diff --git a/assets/js/collaborative-editor/components/form/index.tsx b/assets/js/collaborative-editor/components/form/index.tsx index fb0f1506d1..b60a7915ee 100644 --- a/assets/js/collaborative-editor/components/form/index.tsx +++ b/assets/js/collaborative-editor/components/form/index.tsx @@ -6,6 +6,7 @@ import { useValidation } from '#/collaborative-editor/hooks/useValidation'; import { NumberField } from './number-field'; import { SelectField } from './select-field'; import { TextField } from './text-field'; +import { TextAreaField } from './textarea-field'; import { ToggleField } from './toggle-field'; export const { fieldContext, formContext, useFieldContext } = @@ -17,6 +18,7 @@ const { useAppForm: useBaseAppForm } = createFormHook({ formContext, fieldComponents: { TextField, + TextAreaField, SelectField, ToggleField, NumberField, diff --git a/assets/js/collaborative-editor/components/form/text-field.tsx b/assets/js/collaborative-editor/components/form/text-field.tsx index bbd4b5b5ce..6afbf49db2 100644 --- a/assets/js/collaborative-editor/components/form/text-field.tsx +++ b/assets/js/collaborative-editor/components/form/text-field.tsx @@ -5,9 +5,11 @@ import { useFieldContext } from '.'; export function TextField({ label, disabled = false, + placeholder, }: { label: string; disabled?: boolean; + placeholder?: string; }) { const field = useFieldContext(); return ( @@ -18,6 +20,7 @@ export function TextField({ value={field.state.value || ''} onChange={e => field.handleChange(e.target.value)} disabled={disabled} + placeholder={placeholder} className={INPUT_CLASSES} /> diff --git a/assets/js/collaborative-editor/components/form/textarea-field.tsx b/assets/js/collaborative-editor/components/form/textarea-field.tsx new file mode 100644 index 0000000000..6b2a019726 --- /dev/null +++ b/assets/js/collaborative-editor/components/form/textarea-field.tsx @@ -0,0 +1,30 @@ +import { FormField, INPUT_CLASSES } from './form-field'; + +import { useFieldContext } from '.'; + +export function TextAreaField({ + label, + disabled = false, + placeholder, + rows = 4, +}: { + label: string; + disabled?: boolean; + placeholder?: string; + rows?: number; +}) { + const field = useFieldContext(); + return ( + +