+ {appConfigurationData?.app?.extra_config?.git_config?.branch?.prod}
+
+ }
+ />
+ >) : null
+ }
+
);
diff --git a/frontend/src/pages/appConfiguration/components/Modals/UpdateAppDetailsModal/UpdateAppDetailsForm.jsx b/frontend/src/pages/appConfiguration/components/Modals/UpdateAppDetailsModal/UpdateAppDetailsForm.jsx
index 68afe91ba..ae3e46c17 100644
--- a/frontend/src/pages/appConfiguration/components/Modals/UpdateAppDetailsModal/UpdateAppDetailsForm.jsx
+++ b/frontend/src/pages/appConfiguration/components/Modals/UpdateAppDetailsModal/UpdateAppDetailsForm.jsx
@@ -9,6 +9,7 @@ import InputFieldArray from '../../../../../components/Form/InputFieldArray';
import SelectField from '../../../../../components/Form/SelectField';
import SubmitButton from '../../../../../components/Form/SubmitButton';
import TextareaField from '../../../../../components/Form/TextareaField';
+import CheckboxField from '../../../../../components/Form/CheckboxField';
import useApi from '../../../../../hooks/useApi';
import { transformToFormData } from '../../../../../utils/form';
@@ -31,12 +32,26 @@ const UpdateAppDetailsForm = ({ closeModal }) => {
timezone: appConfigurationData?.app?.timezone ?? '',
date_format: appConfigurationData?.app?.date_format ?? '',
datetime_format: appConfigurationData?.app?.datetime_format ?? '',
+ repo_url: appConfigurationData?.app?.extra_config?.git_config?.repo_url ?? '',
+ dev: appConfigurationData?.app?.extra_config?.git_config?.branch?.dev ?? '',
+ prod: appConfigurationData?.app?.extra_config?.git_config?.branch?.prod ?? '',
+ staging: appConfigurationData?.app?.extra_config?.git_config?.branch?.staging ?? '',
+ sync_packages: appConfigurationData?.app?.extra_config?.sync_packages ?? true
};
let validationSchema = Yup.object({
name: Yup.string().required('Required'),
description: Yup.string().required('Required'),
domains: Yup.array().of(Yup.string().required('Required')),
+ repo_url: Yup.string().url('Must be a valid URL').when(['dev', 'prod', 'staging'], {
+ is: (dev, prod, staging) => dev || prod || staging,
+ then: Yup.string().required('Required'),
+ otherwise: Yup.string().notRequired(),
+ }),
+ dev: Yup.string(),
+ prod: Yup.string(),
+ staging: Yup.string(),
+ sync_packages: Yup.boolean()
});
let onSubmit = (values) => {
@@ -48,7 +63,26 @@ const UpdateAppDetailsForm = ({ closeModal }) => {
if (!tempValues['fav_icon']) {
delete tempValues['fav_icon'];
}
-
+ const extra_config = {
+ git_config: {
+ branch: {
+ dev: tempValues.dev==''?null:tempValues.dev,
+ prod: tempValues.prod==''?null:tempValues.prod,
+ staging: tempValues.staging==''?null:tempValues.staging
+ },
+ repo_url: tempValues.repo_url==''?null:tempValues.repo_url
+ },
+ sync_packages: tempValues.sync_packages
+ };
+
+ delete tempValues.dev;
+ delete tempValues.prod;
+ delete tempValues.staging;
+ delete tempValues.repo_url;
+ delete tempValues.sync_packages;
+
+ tempValues.extra_config = JSON.stringify(extra_config);
+
let dynamicFormData = transformToFormData(tempValues);
const makeApiCall = async () => {
@@ -168,6 +202,57 @@ const UpdateAppDetailsForm = ({ closeModal }) => {
}
formik={formik}
/>
+
+
+
+
+
{
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}
/>
+
+
diff --git a/frontend/src/utils/helper.js b/frontend/src/utils/helper.js
index 6b2f2c30c..98291cb1c 100644
--- a/frontend/src/utils/helper.js
+++ b/frontend/src/utils/helper.js
@@ -35,3 +35,9 @@ export const getPlatformVersion = () => {
return platformVersion;
};
+
+export function getRepoName(githubUrl) {
+ const regex = /github\.com\/([^/]+\/[^/]+)/;
+ const match = githubUrl.match(regex);
+ return match ? match[1] : null;
+}
\ No newline at end of file