Fused Frontend and Bakcend

This commit is contained in:
Dunemask 2022-08-09 17:59:36 +00:00
parent 55e0a21f79
commit b7f953e93d
11 changed files with 245 additions and 135 deletions

View file

@ -18,11 +18,11 @@ export default function Jobs() {
useEffect(() => {
const jobName = location.hash.slice(1);
const pipelineId = jobName.slice(1);
if(!jobName || !pipelineId) return;
const hasJob = jobState.pipelines.find((p)=>p.id ===pipelineId);
if (!jobName || !pipelineId) return;
const hasJob = jobState.pipelines.find((p) => p.id === pipelineId);
const hasPipeline = jobState.jobs.find((job) => job.name === jobName);
if(hasPipeline || hasJob) return;
if(jobName || pipelineId) navigate("/qualiteer/jobs");
if (hasPipeline || hasJob) return;
if (jobName || pipelineId) navigate("/qualiteer/jobs");
});
return (
@ -51,29 +51,46 @@ export default function Jobs() {
</React.Fragment>
) : null}
<JobBuilder />
{location.hash === "" &&(
<React.Fragment>
{jobState.jobs
.filter((j) => !j.isPipeline)
.map((v, i) => (
{location.hash === "" && (
<React.Fragment>
{jobState.jobs
.filter((j) => !j.isPipeline)
.map((v, i) => (
<a
key={i}
href={`/qualiteer/jobs#${v.name}`}
style={{ textDecoration: "none" }}
>
<JobBox job={v} />
</a>
))}
{jobState.pipelines.map((p, i) => (
<a
key={i}
href={`/qualiteer/jobs#${v.name}`}
style={{ textDecoration: "none" }}
href={`/qualiteer/jobs#p${p.id}`}
>
<JobBox job={v} />
</a>))}
{jobState.pipelines.map((p,i)=><a key={i} style={{textDecoration: "none"}} href={`/qualiteer/jobs#p${p.id}`}>
<JobPipelineBox pipeline={p}/>
</a>)}
</React.Fragment>)
}
{ location.hash[1] === "p"? jobState.pipelines.find((p)=>p.id===location.hash.slice(2)) && (<JobPipelineDisplay pipeline={jobState.pipelines.find((p)=>p.id===location.hash.slice(2))}/>) :
jobState.jobs.find((job) => job.name === location.hash.slice(1)) && (<JobView
job={jobState.jobs.find((job) => job.name === location.hash.slice(1))}
/>
<JobPipelineBox pipeline={p} />
</a>
))}
</React.Fragment>
)}
{location.hash[1] === "p"
? jobState.pipelines.find((p) => p.id === location.hash.slice(2)) && (
<JobPipelineDisplay
pipeline={jobState.pipelines.find(
(p) => p.id === location.hash.slice(2)
)}
/>
)
: jobState.jobs.find((job) => job.name === location.hash.slice(1)) && (
<JobView
job={jobState.jobs.find(
(job) => job.name === location.hash.slice(1)
)}
/>
)}
</div>
);
}