Use fetched domains data in domains panel (#27)
* Use fetched domains data and use it in domains page * Add record field to fetched domain data --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
parent
63b7f4e7de
commit
f9e4d8ebd5
@ -155,6 +155,7 @@ const DomainCard = ({ domain, repo, project }: DomainCardProps) => {
|
|||||||
</table>
|
</table>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<EditDomainDialog
|
<EditDomainDialog
|
||||||
handleOpen={() => {
|
handleOpen={() => {
|
||||||
setEditDialogOpen((preVal) => !preVal);
|
setEditDialogOpen((preVal) => !preVal);
|
||||||
|
@ -5,8 +5,6 @@ import { Button, Typography } from '@material-tailwind/react';
|
|||||||
|
|
||||||
import DomainCard from './DomainCard';
|
import DomainCard from './DomainCard';
|
||||||
import { DomainDetails } from '../../../../types/project';
|
import { DomainDetails } from '../../../../types/project';
|
||||||
import domainsData from '../../../../assets/domains.json';
|
|
||||||
import repositories from '../../../../assets/repositories.json';
|
|
||||||
|
|
||||||
const Domains = () => {
|
const Domains = () => {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
@ -15,15 +13,23 @@ const Domains = () => {
|
|||||||
const { projects } = useOutletContext();
|
const { projects } = useOutletContext();
|
||||||
|
|
||||||
const currProject = useMemo(() => {
|
const currProject = useMemo(() => {
|
||||||
return projects.find((data: any) => Number(data.id) === Number(id));
|
return projects.find((data: any) => {
|
||||||
|
return Number(data?.id) === Number(id);
|
||||||
|
});
|
||||||
}, [id]);
|
}, [id]);
|
||||||
|
|
||||||
const linkedRepo = useMemo(() => {
|
const linkedRepo = useMemo(() => {
|
||||||
return repositories.find(
|
return currProject.repositories.find(
|
||||||
(repo) => repo.id === Number(currProject?.repositoryId),
|
(repo: any) => repo.id === Number(currProject?.repositoryId),
|
||||||
);
|
);
|
||||||
}, [currProject]);
|
}, [currProject]);
|
||||||
|
|
||||||
|
const domains = currProject.deployments
|
||||||
|
.filter((deployment: any) => {
|
||||||
|
return deployment.domain != null;
|
||||||
|
})
|
||||||
|
.map((deployment: any) => deployment.domain);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex justify-between p-2">
|
<div className="flex justify-between p-2">
|
||||||
@ -35,7 +41,7 @@ const Domains = () => {
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{(domainsData as DomainDetails[]).map((domain) => {
|
{(domains as DomainDetails[]).map((domain) => {
|
||||||
return (
|
return (
|
||||||
<DomainCard
|
<DomainCard
|
||||||
domain={domain}
|
domain={domain}
|
||||||
|
@ -30,6 +30,16 @@ const ProjectSearch = () => {
|
|||||||
hash: '',
|
hash: '',
|
||||||
message: '',
|
message: '',
|
||||||
},
|
},
|
||||||
|
domain: deployment.domain
|
||||||
|
? {
|
||||||
|
...deployment.domain,
|
||||||
|
record: {
|
||||||
|
type: '',
|
||||||
|
name: '',
|
||||||
|
value: '',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: null,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -44,7 +54,17 @@ const ProjectSearch = () => {
|
|||||||
domain: null,
|
domain: null,
|
||||||
createdBy: project.owner.name,
|
createdBy: project.owner.name,
|
||||||
source: '',
|
source: '',
|
||||||
repositoryId: project.repository,
|
repositoryId: 0,
|
||||||
|
repositories: [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
title: project.repository,
|
||||||
|
updatedAt: '',
|
||||||
|
user: '',
|
||||||
|
private: false,
|
||||||
|
branch: [''],
|
||||||
|
},
|
||||||
|
],
|
||||||
// TODO: populate from github API
|
// TODO: populate from github API
|
||||||
latestCommit: {
|
latestCommit: {
|
||||||
message: '',
|
message: '',
|
||||||
|
@ -75,8 +75,8 @@ export enum GitSelect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum DomainStatus {
|
export enum DomainStatus {
|
||||||
LIVE = 'live',
|
LIVE = 'Live',
|
||||||
PENDING = 'pending',
|
PENDING = 'Pending',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DomainDetails {
|
export interface DomainDetails {
|
||||||
|
Loading…
Reference in New Issue
Block a user