From c9938d0e3cae5210b80027aae8aa10585f7b157b Mon Sep 17 00:00:00 2001 From: adhiraj23zelthy Date: Tue, 24 Sep 2024 18:30:46 +0530 Subject: [PATCH] template upload --- .../src/assets/images/svg/single-file.svg | 6 +++ .../AppConfiguration/DetailsTable/index.jsx | 18 +++++++ .../LaunchNewAppModal/LaunchNewAppForm.jsx | 51 +++++++++++++++++-- 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 frontend/src/assets/images/svg/single-file.svg diff --git a/frontend/src/assets/images/svg/single-file.svg b/frontend/src/assets/images/svg/single-file.svg new file mode 100644 index 000000000..290cda0fa --- /dev/null +++ b/frontend/src/assets/images/svg/single-file.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/frontend/src/pages/appConfiguration/components/AppConfiguration/DetailsTable/index.jsx b/frontend/src/pages/appConfiguration/components/AppConfiguration/DetailsTable/index.jsx index 3e2735233..0d59410ba 100644 --- a/frontend/src/pages/appConfiguration/components/AppConfiguration/DetailsTable/index.jsx +++ b/frontend/src/pages/appConfiguration/components/AppConfiguration/DetailsTable/index.jsx @@ -2,6 +2,8 @@ import { useSelector } from 'react-redux'; import { ReactComponent as EachAppIcon } from '../../../../../assets/images/svg/each-app-icon.svg'; import { selectAppConfigurationData } from '../../../slice'; import EachDescriptionRow from './EachDescriptionRow'; +import { ReactComponent as SingleFileIcon } from '../../../../../assets/images/svg/single-file.svg'; + function DetailsTable() { const appConfigurationData = useSelector(selectAppConfigurationData); @@ -100,6 +102,22 @@ function DetailsTable() { } /> + + + + ):( + + No Template found + + ) + } + /> ); diff --git a/frontend/src/pages/platform/components/Modals/LaunchNewAppModal/LaunchNewAppForm.jsx b/frontend/src/pages/platform/components/Modals/LaunchNewAppModal/LaunchNewAppForm.jsx index ec931f593..dfa2b2f4a 100644 --- a/frontend/src/pages/platform/components/Modals/LaunchNewAppModal/LaunchNewAppForm.jsx +++ b/frontend/src/pages/platform/components/Modals/LaunchNewAppModal/LaunchNewAppForm.jsx @@ -5,6 +5,7 @@ import * as Yup from 'yup'; import InputField from '../../../../../components/Form/InputField'; import SubmitButton from '../../../../../components/Form/SubmitButton'; import TextareaField from '../../../../../components/Form/TextareaField'; +import FileUpload from '../../../../../components/Form/FileUpload'; import useApi from '../../../../../hooks/useApi'; import { transformToFormDataOrder } from '../../../../../utils/form'; import { setPollingTastIds, toggleRerenderPage } from '../../../slice'; @@ -16,12 +17,41 @@ const LaunchNewAppForm = ({ closeModal }) => { let initialValues = { name: '', description: '', + app_template: null }; - let validationSchema = Yup.object({ - name: Yup.string().required('Required'), - description: Yup.string().required('Required'), - }); + let validationSchema = Yup.object().shape({ + name: Yup.string(), + description: Yup.string(), + app_template: Yup.mixed(), + }).test('custom', null, function(value) { + if (value.app_template) { + return true; + } + + if (!value.name && !value.description) { + return this.createError({ + path: 'app_template', + message: 'Required', + }); + } + + if (value.name && !value.description) { + return this.createError({ + path: 'description', + message: 'Required', + }); + } + + if (!value.name && value.description) { + return this.createError({ + path: 'name', + message: 'Required', + }); + } + + return true; + }); const makeApiCall = async (dynamicFormData) => { const { response, success } = await triggerApi({ @@ -79,6 +109,19 @@ const LaunchNewAppForm = ({ closeModal }) => { onChange={formik.handleChange} formik={formik} /> +
+
+
+

OR

+
+
+
+