forked from cerc-io/snowballtools-base
Add fixtures for remaining entities in database initialization script (#36)
* Create fixture data for remaining entities and load it in db * Rename currProject to currentProject in frontend package * Handle review changes * Update readme for loading fixtures --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
committed by
Ashwin Phatak
co-authored by
neeraj
parent
890603061f
commit
2d7e56c0e1
@@ -14,19 +14,19 @@ const Domains = () => {
|
||||
|
||||
const { projects } = useOutletContext<ProjectsOutletContext>();
|
||||
|
||||
const currProject = useMemo(() => {
|
||||
const currentProject = useMemo(() => {
|
||||
return projects.find((project) => {
|
||||
return project.id === id;
|
||||
});
|
||||
}, [id, projects]);
|
||||
|
||||
const linkedRepo = useMemo(() => {
|
||||
return currProject?.repositories.find(
|
||||
(repo: any) => repo.id === Number(currProject?.repositoryId),
|
||||
return currentProject?.repositories.find(
|
||||
(repo: any) => repo.id === Number(currentProject?.repositoryId),
|
||||
);
|
||||
}, [currProject]);
|
||||
}, [currentProject]);
|
||||
|
||||
const domains = currProject?.deployments
|
||||
const domains = currentProject?.deployments
|
||||
.filter((deployment) => {
|
||||
return deployment.domain != null;
|
||||
})
|
||||
@@ -49,7 +49,7 @@ const Domains = () => {
|
||||
domain={domain}
|
||||
key={domain.id}
|
||||
repo={linkedRepo!}
|
||||
project={currProject!}
|
||||
project={currentProject!}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
+4
-4
@@ -38,7 +38,7 @@ export const EnvironmentVariablesTabPanel = () => {
|
||||
|
||||
const { projects } = useOutletContext<ProjectsOutletContext>();
|
||||
|
||||
const currProject = useMemo(() => {
|
||||
const currentProject = useMemo(() => {
|
||||
return projects.find((project) => {
|
||||
return project.id === id;
|
||||
});
|
||||
@@ -77,9 +77,9 @@ export const EnvironmentVariablesTabPanel = () => {
|
||||
}, [isSubmitSuccessful, reset]);
|
||||
|
||||
const getEnvironmentVariable = useCallback((environment: Environments) => {
|
||||
return (currProject?.environmentVariables as EnvironmentVariable[]).filter(
|
||||
(item) => item.environments.includes(environment),
|
||||
);
|
||||
return (
|
||||
currentProject?.environmentVariables as EnvironmentVariable[]
|
||||
).filter((item) => item.environments.includes(environment));
|
||||
}, []);
|
||||
|
||||
const isFieldEmpty = useMemo(() => {
|
||||
|
||||
@@ -15,7 +15,6 @@ import DeleteProjectDialog from './DeleteProjectDialog';
|
||||
import ConfirmDialog from '../../../shared/ConfirmDialog';
|
||||
import { ProjectsOutletContext } from '../../../../types/project';
|
||||
|
||||
const PROJECT_ID = '62f87575-7a2b-4951-8156-9f9821j380d';
|
||||
const TEAMS = ['Airfoil'];
|
||||
const DEFAULT_SELECT_TEAM = undefined;
|
||||
|
||||
@@ -37,7 +36,7 @@ const GeneralTabPanel = () => {
|
||||
const { id } = useParams();
|
||||
const { projects } = useOutletContext<ProjectsOutletContext>();
|
||||
|
||||
const currProject = useMemo(() => {
|
||||
const currentProject = useMemo(() => {
|
||||
return projects.find((project: any) => project.id === id);
|
||||
}, [id]);
|
||||
|
||||
@@ -61,128 +60,132 @@ const GeneralTabPanel = () => {
|
||||
|
||||
const { handleSubmit, register } = useForm({
|
||||
defaultValues: {
|
||||
appName: currProject?.name,
|
||||
description: currProject?.description,
|
||||
appName: currentProject?.name,
|
||||
description: currentProject?.description,
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<form onSubmit={handleSubmit(() => {})}>
|
||||
<Typography variant="h6">Project info</Typography>
|
||||
<Typography variant="small" className="font-medium text-gray-800">
|
||||
App name
|
||||
</Typography>
|
||||
<Input
|
||||
variant="outlined"
|
||||
// TODO: Debug issue: https://github.com/creativetimofficial/material-tailwind/issues/427
|
||||
crossOrigin={undefined}
|
||||
size="md"
|
||||
{...register('appName')}
|
||||
/>
|
||||
<Typography variant="small" className="font-medium text-gray-800">
|
||||
Description (Optional)
|
||||
</Typography>
|
||||
<Input
|
||||
variant="outlined"
|
||||
crossOrigin={undefined}
|
||||
size="md"
|
||||
{...register('description')}
|
||||
/>
|
||||
<Typography variant="small" className="font-medium text-gray-800">
|
||||
Project ID
|
||||
</Typography>
|
||||
<Input
|
||||
crossOrigin={undefined}
|
||||
variant="outlined"
|
||||
value={PROJECT_ID}
|
||||
size="md"
|
||||
disabled
|
||||
icon={<CopyIcon value={PROJECT_ID} />}
|
||||
/>
|
||||
<Button type="submit" variant="gradient" size="sm" className="mt-1">
|
||||
Save
|
||||
</Button>
|
||||
</form>
|
||||
<div className="mb-1">
|
||||
<Typography variant="h6">Transfer project</Typography>
|
||||
<Typography variant="small">
|
||||
Transfer this app to your personal account or a team you are a member
|
||||
of.
|
||||
<Link to="" className="text-blue-500">
|
||||
Learn more
|
||||
</Link>
|
||||
</Typography>
|
||||
<form
|
||||
onSubmit={handleTransfer(() => {
|
||||
handleTransferProjectDialog();
|
||||
})}
|
||||
>
|
||||
<Typography variant="small" className="font-medium text-gray-800">
|
||||
Choose team
|
||||
</Typography>
|
||||
<Controller
|
||||
name="team"
|
||||
rules={{ required: 'This field is required' }}
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Select
|
||||
{...field}
|
||||
// TODO: Implement placeholder for select
|
||||
label={!field.value ? 'Select an account / team' : ''}
|
||||
{currentProject && (
|
||||
<>
|
||||
<form onSubmit={handleSubmit(() => {})}>
|
||||
<Typography variant="h6">Project info</Typography>
|
||||
<Typography variant="small" className="font-medium text-gray-800">
|
||||
App name
|
||||
</Typography>
|
||||
<Input
|
||||
variant="outlined"
|
||||
// TODO: Debug issue: https://github.com/creativetimofficial/material-tailwind/issues/427
|
||||
crossOrigin={undefined}
|
||||
size="md"
|
||||
{...register('appName')}
|
||||
/>
|
||||
<Typography variant="small" className="font-medium text-gray-800">
|
||||
Description (Optional)
|
||||
</Typography>
|
||||
<Input
|
||||
variant="outlined"
|
||||
crossOrigin={undefined}
|
||||
size="md"
|
||||
{...register('description')}
|
||||
/>
|
||||
<Typography variant="small" className="font-medium text-gray-800">
|
||||
Project ID
|
||||
</Typography>
|
||||
<Input
|
||||
crossOrigin={undefined}
|
||||
variant="outlined"
|
||||
value={currentProject.id}
|
||||
size="md"
|
||||
disabled
|
||||
icon={<CopyIcon value={currentProject.id} />}
|
||||
/>
|
||||
<Button type="submit" variant="gradient" size="sm" className="mt-1">
|
||||
Save
|
||||
</Button>
|
||||
</form>
|
||||
<div className="mb-1">
|
||||
<Typography variant="h6">Transfer project</Typography>
|
||||
<Typography variant="small">
|
||||
Transfer this app to your personal account or a team you are a
|
||||
member of.
|
||||
<Link to="" className="text-blue-500">
|
||||
Learn more
|
||||
</Link>
|
||||
</Typography>
|
||||
<form
|
||||
onSubmit={handleTransfer(() => {
|
||||
handleTransferProjectDialog();
|
||||
})}
|
||||
>
|
||||
<Typography variant="small" className="font-medium text-gray-800">
|
||||
Choose team
|
||||
</Typography>
|
||||
<Controller
|
||||
name="team"
|
||||
rules={{ required: 'This field is required' }}
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Select
|
||||
{...field}
|
||||
// TODO: Implement placeholder for select
|
||||
label={!field.value ? 'Select an account / team' : ''}
|
||||
>
|
||||
{TEAMS.map((team, key) => (
|
||||
<Option key={key} value={team}>
|
||||
^ {team}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
)}
|
||||
/>
|
||||
<Button
|
||||
variant="gradient"
|
||||
size="sm"
|
||||
className="mt-1"
|
||||
disabled={!formState.isValid}
|
||||
type="submit"
|
||||
>
|
||||
{TEAMS.map((team, key) => (
|
||||
<Option key={key} value={team}>
|
||||
^ {team}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
)}
|
||||
/>
|
||||
<Button
|
||||
variant="gradient"
|
||||
size="sm"
|
||||
className="mt-1"
|
||||
disabled={!formState.isValid}
|
||||
type="submit"
|
||||
>
|
||||
Transfer
|
||||
</Button>
|
||||
</form>
|
||||
<ConfirmDialog
|
||||
dialogTitle="Transfer project"
|
||||
handleOpen={handleTransferProjectDialog}
|
||||
open={openTransferDialog}
|
||||
confirmButtonTitle="Yes, Confirm transfer"
|
||||
handleConfirm={handleTransferProjectDialog}
|
||||
color="blue"
|
||||
>
|
||||
<Typography variant="small">
|
||||
Upon confirmation, your project nextjs-boilerplate will be
|
||||
transferred from saugat to Airfoil.
|
||||
</Typography>
|
||||
</ConfirmDialog>
|
||||
</div>
|
||||
<div className="mb-1">
|
||||
<Typography variant="h6">Delete project</Typography>
|
||||
<Typography variant="small">
|
||||
The project will be permanently deleted, including its deployments and
|
||||
domains. This action is irreversible and can not be undone.
|
||||
</Typography>
|
||||
<Button
|
||||
variant="gradient"
|
||||
size="sm"
|
||||
color="red"
|
||||
onClick={handleDeleteProjectDialog}
|
||||
>
|
||||
^ Delete project
|
||||
</Button>
|
||||
<DeleteProjectDialog
|
||||
handleOpen={handleDeleteProjectDialog}
|
||||
open={openDeleteDialog}
|
||||
project={{ name: 'Iglootools' }}
|
||||
/>
|
||||
</div>
|
||||
Transfer
|
||||
</Button>
|
||||
</form>
|
||||
<ConfirmDialog
|
||||
dialogTitle="Transfer project"
|
||||
handleOpen={handleTransferProjectDialog}
|
||||
open={openTransferDialog}
|
||||
confirmButtonTitle="Yes, Confirm transfer"
|
||||
handleConfirm={handleTransferProjectDialog}
|
||||
color="blue"
|
||||
>
|
||||
<Typography variant="small">
|
||||
Upon confirmation, your project nextjs-boilerplate will be
|
||||
transferred from saugat to Airfoil.
|
||||
</Typography>
|
||||
</ConfirmDialog>
|
||||
</div>
|
||||
<div className="mb-1">
|
||||
<Typography variant="h6">Delete project</Typography>
|
||||
<Typography variant="small">
|
||||
The project will be permanently deleted, including its deployments
|
||||
and domains. This action is irreversible and can not be undone.
|
||||
</Typography>
|
||||
<Button
|
||||
variant="gradient"
|
||||
size="sm"
|
||||
color="red"
|
||||
onClick={handleDeleteProjectDialog}
|
||||
>
|
||||
^ Delete project
|
||||
</Button>
|
||||
<DeleteProjectDialog
|
||||
handleOpen={handleDeleteProjectDialog}
|
||||
open={openDeleteDialog}
|
||||
project={{ name: 'Iglootools' }}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -18,12 +18,12 @@ const MembersTabPanel = () => {
|
||||
// @ts-expect-error create context type for projects
|
||||
const { projects } = useOutletContext();
|
||||
|
||||
const currProject = useMemo(() => {
|
||||
const currentProject = useMemo(() => {
|
||||
return projects.find((project: any) => project.id === id);
|
||||
}, [id]);
|
||||
|
||||
const [updatedMembers, setUpdatedMembers] = useState([
|
||||
...currProject?.members,
|
||||
...currentProject?.members,
|
||||
]);
|
||||
|
||||
const addMemberHandler = useCallback((member: Member) => {
|
||||
@@ -59,7 +59,7 @@ const MembersTabPanel = () => {
|
||||
member={member.member}
|
||||
key={member.id}
|
||||
isFirstCard={index === FIRST_MEMBER_CARD}
|
||||
isOwner={member.member.id === currProject?.owner.id}
|
||||
isOwner={member.member.id === currentProject?.owner.id}
|
||||
isPending={member.name === ''}
|
||||
permissions={member.permissions}
|
||||
handleDeletePendingMember={(id: number) => {
|
||||
|
||||
Reference in New Issue
Block a user