Fixed nav bug

This commit is contained in:
Dunemask 2022-08-09 15:19:09 +00:00
parent c05502f15c
commit 55e0a21f79

View file

@ -18,11 +18,11 @@ export default function Jobs() {
useEffect(() => {
const jobName = location.hash.slice(1);
const pipelineId = jobName.slice(1);
const noPipeline = !jobName || jobState.pipelines.find((p)=>p.id ===pipelineId);
const noJob = !jobName || jobState.jobs.find((job) => job.name === jobName)
if(!noPipeline || !noJob) return;
navigate("/qualiteer/jobs");
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");
});
return (
@ -69,7 +69,7 @@ export default function Jobs() {
</React.Fragment>)
}
{ location.hash[1] === "p"? <JobPipelineDisplay pipeline={jobState.pipelines.find((p)=>p.id===location.hash.slice(2))}/> :
{ 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))}
/>