Skip to content

Commit

Permalink
Merge pull request #400 from Healthlane-Technologies/feat/package_ins…
Browse files Browse the repository at this point in the history
…tall_and_launch_from_template

Feat/package install and launch from template
  • Loading branch information
shahharsh176 authored Oct 24, 2024
2 parents c008183 + 147ac4c commit 4e197da
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 4 deletions.
6 changes: 6 additions & 0 deletions frontend/src/assets/images/svg/single-file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -100,6 +102,22 @@ function DetailsTable() {
</span>
}
/>
<EachDescriptionRow
label="Template:"
content={
appConfigurationData?.app?.app_template?(
<a target='__blank'
href={appConfigurationData?.app?.app_template}
className='whitespace-nowrap cursor-pointer font-lato text-[14px] font-bold leading-[20px] tracking-[0.2px] text-[#5048ED]'>
<SingleFileIcon />
</a>
):(
<span className="whitespace-nowrap font-lato text-[14px] font-bold leading-[20px] tracking-[0.2px] text-[#212429]">
No Template found
</span>
)
}
/>
</tbody>
</table>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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({
Expand Down Expand Up @@ -79,6 +109,19 @@ const LaunchNewAppForm = ({ closeModal }) => {
onChange={formik.handleChange}
formik={formik}
/>
<div className='w-full flex my-4'>
<div className="w-full flex items-center">
<div className="flex-grow h-px bg-[#A3ABB1]"></div>
<p className="mx-4 text-sm text-[#A3ABB1] font-medium">OR</p>
<div className="flex-grow h-px bg-[#A3ABB1]"></div>
</div>
</div>
<FileUpload
formik={formik}
label={'Template'}
id={'app_template'}
fileValue={null}
/>
</div>
<div className="sticky bottom-0 flex flex-col gap-[8px] bg-[#ffffff] pt-[24px] font-lato text-[#696969]">
<SubmitButton label={'Launch App'} formik={formik} />
Expand Down

0 comments on commit 4e197da

Please sign in to comment.