diff --git a/apps/hpc-ftsadmin/src/app/app.tsx b/apps/hpc-ftsadmin/src/app/app.tsx
index 4bb257b79..635b3be07 100644
--- a/apps/hpc-ftsadmin/src/app/app.tsx
+++ b/apps/hpc-ftsadmin/src/app/app.tsx
@@ -32,6 +32,7 @@ import PagePendingFlowsList from './pages/flows/pending-flows-list';
import PageOrganizationsList from './pages/organizations/organization-list';
import PageOrganization from './pages/organizations/organization';
import FlowEdit from './pages/add-edit/flow-edit';
+import FlowEditRewrite from './pages/add-edit/flow-edit-rewrite/index';
import * as paths from './paths';
import { RouteParamsValidator } from './components/route-params-validator';
import { QueryParamProvider } from 'use-query-params';
@@ -272,6 +273,18 @@ const router = createBrowserRouter(
path={paths.editFlow()}
element={}
/>
+ }
+ />
+ }
+ />
+ }
+ />
} />
)
diff --git a/apps/hpc-ftsadmin/src/app/components/flow-form-rewrite/index.tsx b/apps/hpc-ftsadmin/src/app/components/flow-form-rewrite/index.tsx
new file mode 100644
index 000000000..9b2f03fb9
--- /dev/null
+++ b/apps/hpc-ftsadmin/src/app/components/flow-form-rewrite/index.tsx
@@ -0,0 +1,32 @@
+import { Form, Formik } from 'formik';
+import Button from '@mui/material/Button';
+import TextField from '@mui/material/TextField';
+
+export const FlowRewriteForm = () => {
+ const initialValues = {
+ inputValue: '', // Initial value for the input field
+ };
+
+ const handleSubmit = (values: any) => {
+ console.log('Form values:', values);
+ };
+ return (
+
+ {(
+ { values } // Destructure handleChange and values from Formik props
+ ) => (
+
+ )}
+
+ );
+};
+export default FlowRewriteForm;
diff --git a/apps/hpc-ftsadmin/src/app/pages/add-edit/flow-edit-rewrite/index.tsx b/apps/hpc-ftsadmin/src/app/pages/add-edit/flow-edit-rewrite/index.tsx
new file mode 100644
index 000000000..3ae0c064d
--- /dev/null
+++ b/apps/hpc-ftsadmin/src/app/pages/add-edit/flow-edit-rewrite/index.tsx
@@ -0,0 +1,12 @@
+import React from 'react';
+
+import FlowRewriteForm from '../../../components/flow-form-rewrite/index';
+
+interface Props {
+ className?: string;
+ isEdit: boolean;
+}
+
+export default (props: Props) => {
+ return ;
+};
diff --git a/apps/hpc-ftsadmin/src/app/paths.ts b/apps/hpc-ftsadmin/src/app/paths.ts
index eef994d5a..8f9d479fd 100644
--- a/apps/hpc-ftsadmin/src/app/paths.ts
+++ b/apps/hpc-ftsadmin/src/app/paths.ts
@@ -9,6 +9,8 @@ const ADD_ORGANIZATION = `${ORGANIZATIONS}/add`;
const KEYWORDS = '/keywords';
const NEW_FLOW = '/flows/add';
const EDIT_FLOW = '/flows/edit/:flowId/version/:versionId';
+const REWRITE_NEW_FLOW = '/flows/test/add';
+const REWRITE_EDIT_FLOW = '/flows/test/edit/:flowId/version/:versionId';
const replacePlaceholders = (
path: string,
@@ -49,3 +51,14 @@ export const editFlowSetting = (flowId: number, versionId: number) =>
});
export const editFlow = () => EDIT_FLOW;
+
+export const rewriteNewFlow = () => replacePlaceholders(REWRITE_NEW_FLOW, {});
+export const rewriteCopyFlow = () => replacePlaceholders(REWRITE_NEW_FLOW, {});
+
+export const rewriteEditFlowSetting = (flowId: number, versionId: number) =>
+ replacePlaceholders(REWRITE_EDIT_FLOW, {
+ flowId,
+ versionId,
+ });
+
+export const rewriteEditFlow = () => REWRITE_EDIT_FLOW;
diff --git a/libs/hpc-ui/src/lib/components/form-fields/async-single-select-field.tsx b/libs/hpc-ui/src/lib/components/form-fields/async-single-select-field.tsx
index 48d190d1c..b0ba47718 100644
--- a/libs/hpc-ui/src/lib/components/form-fields/async-single-select-field.tsx
+++ b/libs/hpc-ui/src/lib/components/form-fields/async-single-select-field.tsx
@@ -34,6 +34,7 @@ const CircularProgressBox = tw.div`
const StyledIconButton = tw(IconButton)`
me-6
`;
+const StyledFormControl = tw(FormControl)`w-full`;
const FormikError = ({ name }: { name: string }) => (
@@ -204,7 +205,7 @@ const AsyncSingleSelect = memo(
return (
<>
-
+
@@ -238,7 +239,7 @@ const AsyncSingleSelect = memo(
)}
-
+
{entryInfo && rejectInputEntry && (
{
+ const handleChange = (event: React.ChangeEvent) => {
+ if (onChange) {
+ onChange(event);
+ }
+ };
+ const configCheckBox = useMemo(
+ () => ({
+ ...otherProps,
+ label: label,
+ id: name,
+ control: (
+
+ ),
+ }),
+ [label, name, size, disabled, otherProps]
+ );
if (!withoutFormik) {
return (
);
}
- const handleChange = (event: React.ChangeEvent) => {
- if (onChange) {
- const values = onChange(event);
- }
- };
- const configCheckBox: FormControlLabelProps = {
- ...otherProps,
- label: label,
- id: name,
- control: (
-
- ),
- };
return ;
}
diff --git a/libs/hpc-ui/src/lib/components/form-fields/date-picker.tsx b/libs/hpc-ui/src/lib/components/form-fields/date-picker.tsx
index fde6d6ed1..65f0cee69 100644
--- a/libs/hpc-ui/src/lib/components/form-fields/date-picker.tsx
+++ b/libs/hpc-ui/src/lib/components/form-fields/date-picker.tsx
@@ -6,6 +6,8 @@ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import tw from 'twin.macro';
import dayjs, { Dayjs } from 'dayjs';
+import { DateValidationError } from '@mui/x-date-pickers/models/validation';
+import { TextFieldProps } from '@mui/material/TextField';
const StyledDatePicker = tw.div`
flex
@@ -36,6 +38,12 @@ const DatePicker = memo(
const [field, meta, helpers] = useField(name);
const [cleared, setCleared] = useState(false);
+ const linkStyles = {
+ height: '100%',
+ lineHeight: '40px',
+ cursor: 'pointer',
+ };
+
const onBlur = useCallback(() => {
helpers.setTouched(true);
}, [helpers]);
@@ -73,6 +81,51 @@ const DatePicker = memo(
helpers.setValue(dayjs());
}, [helpers]);
+ const memoizedValue = useMemo(() => {
+ if (enableButton) {
+ return field.value === null ? null : dayjs(field.value, 'DD/MM/YYYY');
+ } else {
+ return dayjs();
+ }
+ }, [enableButton, field.value]);
+
+ const handleError = useCallback(
+ (error: DateValidationError, value: Dayjs | null) => {
+ if (error) {
+ console.error(`Date validation error: ${error} for value: ${value}`);
+ }
+ },
+ []
+ );
+
+ const renderInput = useCallback(
+ (params: TextFieldProps) => (
+
+ ),
+ [onBlur, errorMsg]
+ );
+
+ const slots = useMemo(
+ () => ({
+ textField: renderInput,
+ }),
+ [renderInput]
+ );
+
+ const slotProps = useMemo(
+ () => ({
+ field: { clearable: true, onClear: handleClear },
+ }),
+ [handleClear]
+ );
+
return (
@@ -80,42 +133,18 @@ const DatePicker = memo(
{...field}
{...otherProps}
format="DD/MM/YYYY"
- value={
- enableButton
- ? field.value === null
- ? null
- : dayjs(field.value, 'DD/MM/YYYY')
- : dayjs()
- }
- onError={(error) => {
- console.error(error);
- }}
+ value={memoizedValue}
+ onError={handleError}
onChange={handleDateChange}
label={label}
- slots={{
- textField: useMemo(
- () => (params) => (
-
- ),
- [onBlur, errorMsg]
- ),
- }}
- slotProps={{
- field: { clearable: true, onClear: handleClear },
- }}
+ slots={slots}
+ slotProps={slotProps}
/>
{enableButton && (
Today
diff --git a/libs/hpc-ui/src/lib/components/form-fields/file-upload.tsx b/libs/hpc-ui/src/lib/components/form-fields/file-upload.tsx
index 3cb77fc55..dec43f17b 100644
--- a/libs/hpc-ui/src/lib/components/form-fields/file-upload.tsx
+++ b/libs/hpc-ui/src/lib/components/form-fields/file-upload.tsx
@@ -28,6 +28,28 @@ const VisuallyHiddenInput = styled('input')({
width: 1,
});
+const StyledDiv = styled('div')({
+ display: 'flex',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+});
+
+const StyledContainer = styled('div')({
+ display: 'flex',
+ justifyContent: 'space-between',
+ border: '1px solid grey',
+ width: '80%',
+ backgroundColor: 'hsla(0, 50%, 90%, 0.3)',
+ alignItems: 'center',
+ borderRadius: '5px',
+ marginTop: '6px',
+});
+
+const StyledButton = styled(Button)(({ theme }) => ({
+ marginLeft: '5px',
+ textDecoration: 'underline',
+}));
+
type FileUploadProps = {
name?: string;
label: string;
@@ -81,13 +103,7 @@ const FileUpload = React.memo(
}, [fileDownName, name]);
return (
-
+
{!(value && fileName) && (
)}
{value && fileName && (
-
-
+
-
+
)}
-
+
);
}
);