Skip to content
Open
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 @@ -175,7 +175,10 @@ const DashboardLayout = async ({
let childRegex = '';
let children: ExtendedMenuItems = [];

if (automationSettings.task_editor?.active !== false) {
if (
msConfig.PROCEED_PUBLIC_PROCESS_AUTOMATION_TASK_EDITOR_ACTIVE &&
automationSettings.task_editor?.active !== false
) {
childRegex = '/tasks($|/)';
children.push({
key: 'task-editor',
Expand All @@ -195,7 +198,7 @@ const DashboardLayout = async ({
icon: <CheckSquareOutlined />,
selectedRegex: '/tasklist($|/)',
openRegex: childRegex,
children,
children: children.length ? children : undefined,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ const FormEditor: React.FC<FormViewProps> = ({ data }) => {
}
};

const { variables, updateVariables } = useEditorStateStore((state) => state);
const { variables, updateVariables, setEditingEnabled } = useEditorStateStore((state) => state);

useEffect(() => {
// initialize the variables in the editor
updateVariables(data.variables);
setEditingEnabled(true);
}, []);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ type DocumentationLayoutProps = {
params: { environmentId: string };
} & React.PropsWithChildren;

const DocumentationLayout: React.FC<DocumentationLayoutProps> = async ({ params, children }) => {
const TaskEditorLayout: React.FC<DocumentationLayoutProps> = async ({ params, children }) => {
const msConfig = await getMSConfig();
if (!msConfig.PROCEED_PUBLIC_PROCESS_AUTOMATION_ACTIVE) {
if (!msConfig.PROCEED_PUBLIC_PROCESS_AUTOMATION_TASK_EDITOR_ACTIVE) {
return notFound();
}

Expand All @@ -28,4 +28,4 @@ const DocumentationLayout: React.FC<DocumentationLayoutProps> = async ({ params,
return <>{children}</>;
};

export default DocumentationLayout;
export default TaskEditorLayout;
2 changes: 2 additions & 0 deletions src/management-system-v2/lib/data/html-forms.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use server';

import { revalidatePath } from 'next/cache';
import { HtmlForm } from '../html-form-schema';
import { UserFacingError, getErrorMessage, userError } from '../user-error';
import {
Expand Down Expand Up @@ -55,6 +56,7 @@ export const addHtmlForm = async (
export const updateHtmlForm = async (formId: string, newData: Partial<HtmlForm>) => {
try {
await _updateHtmlForm(formId, newData);
revalidatePath(`/tasks/${formId}`);
} catch (err) {
console.error(`Unable to update html form ${formId} in the database. Reason: ${err}`);
if (err instanceof UserFacingError) {
Expand Down
8 changes: 8 additions & 0 deletions src/management-system-v2/lib/ms-config/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ export const msConfigSchema = {
'PROCEED_PUBLIC_PROCESS_DOCUMENTATION_ACTIVE needs to be set to true to use PROCEED_PUBLIC_GANTT_ACTIVE',
}),
PROCEED_PUBLIC_PROCESS_AUTOMATION_ACTIVE: z.string().default('FALSE').transform(boolParser),
PROCEED_PUBLIC_PROCESS_AUTOMATION_TASK_EDITOR_ACTIVE: z
.string()
.default('FALSE')
.transform(boolParser)
.refine((val) => !val || process.env.PROCEED_PUBLIC_PROCESS_AUTOMATION_ACTIVE, {
message:
'PROCEED_PUBLIC_PROCESS_AUTOMATION_ACTIVE needs to be set to true to use PROCEED_PUBLIC_PROCESS_AUTOMATION_TASK_EDITOR_ACTIVE',
}),
PROCEED_PUBLIC_CONFIG_SERVER_ACTIVE: z.string().default('FALSE').transform(boolParser),

NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
Expand Down
11 changes: 10 additions & 1 deletion src/management-system-v2/lib/useBoundingClientRect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ function useBoundingClientRect<T extends ReadonlyArray<DOMRectKeyType>>(
el: HTMLElement | undefined,
toWatch: T,
): PartialDOMRect<T> {
const [boundingBox, setBoundingBox] = useState(new DOMRect());
const [boundingBox, setBoundingBox] = useState<FullDOMRect>({
x: 0,
y: 0,
bottom: 0,
top: 0,
left: 0,
right: 0,
width: 0,
height: 0,
});

useLayoutEffect(() => {
if (el) {
Expand Down
Loading