diff --git a/lib/database/queries/catalog.js b/lib/database/queries/catalog.js index 972a34b..0caf167 100644 --- a/lib/database/queries/catalog.js +++ b/lib/database/queries/catalog.js @@ -133,9 +133,21 @@ const testsMock = () => { const mappingsMock = () => { return [ - ["primary", "secondary1", "tertiary1"], - ["primary", "secondary1", "tertiary2"], - ["primary", "secondary2", "tertiary3"], + [ + { name: "primary", delay: 0 }, + { name: "secondary1", delay: 1000 }, + { name: "tertiary1", delay: 0 }, + ], + [ + { name: "primary", delay: 0 }, + { name: "secondary1", delay: 1000 }, + { name: "tertiary2", delay: 8000 }, + ], + [ + { name: "primary", delay: 0 }, + { name: "secondary2", delay: 0 }, + { name: "tertiary3", delay: 3000 }, + ], ]; }; diff --git a/lib/jobs/k8s/kubernetes.js b/lib/jobs/k8s/kubernetes.js index acfedb5..c2eb66f 100644 --- a/lib/jobs/k8s/kubernetes.js +++ b/lib/jobs/k8s/kubernetes.js @@ -26,7 +26,7 @@ const wrapCommand = (jobId, command) => { JSON.stringify({ jobId, command, url: qualiteerUrl }), "utf8" ).toString("base64"); - const curlCmd = `curl -o qltr-executor ${executorUrl} && ${bin} ${payload}`; + const curlCmd = `curl -o qltr-executor ${executorUrl} || true && ${bin} ${payload}`; return curlCmd; }; diff --git a/src/ctx/JobContext.jsx b/src/ctx/JobContext.jsx index ba65db3..ed29dd0 100644 --- a/src/ctx/JobContext.jsx +++ b/src/ctx/JobContext.jsx @@ -109,6 +109,7 @@ export const JobProvider = ({ children }) => { const onPipelineTrigger = (p) => { const { triggers } = p; for (var t in triggers) { + if (t === "__testDelay") continue; const delay = triggers[t].__testDelay ?? 0; delete triggers[t].__testDelay; const jobReq = { diff --git a/src/ctx/StoreContext.jsx b/src/ctx/StoreContext.jsx index d782a6f..974f295 100644 --- a/src/ctx/StoreContext.jsx +++ b/src/ctx/StoreContext.jsx @@ -10,7 +10,7 @@ const localStorage = { setItem: () => {}, getItem: () => {} }; const localSettings = localStorage.getItem("settings"); const defaultSettings = { focusJob: true, - simplifiedControls: true, + simplifiedControls: false, logAppDetails: true, defaultRegion: "us", defaultPage: "failing", diff --git a/src/util/JobTools.jsx b/src/util/JobTools.jsx index 74571e7..6875804 100644 --- a/src/util/JobTools.jsx +++ b/src/util/JobTools.jsx @@ -44,12 +44,13 @@ export const usePipelineIconState = (pipeline) => { if (jobStatuses.includes(jobStatus.PENDING)) return statusIcon(jobStatus.PENDING); if (pipeline.isCanceled) return statusIcon(jobStatus.CANCELED); + if (jobStatuses.includes(jobStatus.OK)) return statusIcon(jobStatus.OK); return statusIcon(jobStatus.QUEUED); }; export const selectedPipelineBranches = (pipeline) => pipeline.branches.map((b) => - b.filter((t) => pipeline.selectedBranches.includes(t)) + b.filter((t) => pipeline.selectedBranches.find((b) => b.name == t.name)) ); export const findPipelineJobByTestName = (pipeline, jobs, testName) => diff --git a/src/util/pipelines.js b/src/util/pipelines.js index e02b11f..1088e62 100644 --- a/src/util/pipelines.js +++ b/src/util/pipelines.js @@ -2,7 +2,7 @@ import _ from "lodash"; const nest = (arr) => { const obj = {}; - arr.reduce((o, s) => (o[s] = {}), obj); + arr.reduce((o, s) => (o[s.name] = { __testDelay: s.delay }), obj); return obj; }; @@ -13,10 +13,10 @@ export const asTree = (branches) => { export const asBranches = (array) => { const merged = []; - array.forEach((p, i) => { + array.forEach((p) => { p.forEach((v, i) => { if (!merged[i]) merged[i] = []; - if (!merged[i].includes(v)) merged[i].push(v); + if (!merged[i].find((t) => t.name == v.name)) merged[i].push(v); }); }); return merged; diff --git a/src/util/queries.js b/src/util/queries.js index 06e7fd8..1a72fb1 100644 --- a/src/util/queries.js +++ b/src/util/queries.js @@ -2,7 +2,7 @@ import { useQuery } from "@tanstack/react-query"; const QUALITEER_URL = "https://qualiteer.elijahparker3.repl.co/api"; -const useMock = true; +const useMock = false; const asMock = (data) => ({ data }); @@ -134,9 +134,21 @@ export const useCatalogTests = () => export const usePipelineMappings = () => useMock ? asMock([ - ["primary", "secondary1", "tertiary1"], - ["primary", "secondary1", "tertiary2"], - ["primary", "secondary2", "tertiary3"], + [ + { name: "primary", delay: 0 }, + { name: "secondary1", delay: 1000 }, + { name: "tertiary1", delay: 0 }, + ], + [ + { name: "primary", delay: 0 }, + { name: "secondary1", delay: 1000 }, + { name: "tertiary2", delay: 8000 }, + ], + [ + { name: "primary", delay: 0 }, + { name: "secondary2", delay: 20000 }, + { name: "tertiary3", delay: 3000 }, + ], ]) : useQuery(["pipelineMappings"], fetchApi("/catalog/pipeline-mappings")); diff --git a/src/views/catalog/CatalogBox.jsx b/src/views/catalog/CatalogBox.jsx index 0898abb..422f3f0 100644 --- a/src/views/catalog/CatalogBox.jsx +++ b/src/views/catalog/CatalogBox.jsx @@ -53,7 +53,13 @@ export default function CatalogBox(props) { }; const runPipelineTest = () => { - const primaries = pipelineMappings.filter((m) => m.includes(testName)); + if (isLoading) { + console.log("Pipeline mappings are loading, retrying in 5 seconds"); + setTimeout(runPipelineTest, 5000); + } + const primaries = pipelineMappings.filter((m) => + m.find((t) => t.name === testName) + ); const builderCache = { branches: asBranches(primaries), tree: asTree(primaries), diff --git a/src/views/failing/FailingBox.jsx b/src/views/failing/FailingBox.jsx index 6d6ad3f..fc8c493 100644 --- a/src/views/failing/FailingBox.jsx +++ b/src/views/failing/FailingBox.jsx @@ -83,7 +83,9 @@ export default function FailingBox(props) { } const retryPipelineTest = () => { - const primaries = pipelineMappings.filter((m) => m.includes(testName)); + const primaries = pipelineMappings.filter((m) => + m.find((t) => t.name === testName) + ); const builderCache = { branches: asBranches(primaries), tree: asTree(primaries), diff --git a/src/views/jobs/JobPipelineDisplay.jsx b/src/views/jobs/JobPipelineDisplay.jsx index 8fed670..574d3eb 100644 --- a/src/views/jobs/JobPipelineDisplay.jsx +++ b/src/views/jobs/JobPipelineDisplay.jsx @@ -122,7 +122,7 @@ function JobPipelineDisplay(props) { disableGutters={true} square key={j} - onClick={selectJob(test)} + onClick={selectJob(test.name)} > - {test} + {test.name} - {jobIcon(test)} + {jobIcon(test.name)} diff --git a/src/views/jobs/Jobs.jsx b/src/views/jobs/Jobs.jsx index 0d744b7..0d96e8e 100644 --- a/src/views/jobs/Jobs.jsx +++ b/src/views/jobs/Jobs.jsx @@ -35,7 +35,7 @@ export default function Jobs() { justifyContent="center" sx={{ flexFlow: "wrap" }} > - No jobs found! {" "} + No jobs found! ) : null} + + {location.hash === "" && ( {jobState.jobs diff --git a/src/views/jobs/builder/PipelineSelector.jsx b/src/views/jobs/builder/PipelineSelector.jsx index f2f111f..0a9b5f8 100644 --- a/src/views/jobs/builder/PipelineSelector.jsx +++ b/src/views/jobs/builder/PipelineSelector.jsx @@ -17,8 +17,8 @@ function PipelineSelector(props) { if (isLoading) return {}; const primaryMappings = {}; for (var pm of pipelineMappings) { - if (!(pm[0] in primaryMappings)) primaryMappings[pm[0]] = []; - primaryMappings[pm[0]].push(pm); + if (!(pm[0].name in primaryMappings)) primaryMappings[pm[0].name] = []; + primaryMappings[pm[0].name].push(pm); } return primaryMappings; }; @@ -54,8 +54,10 @@ function PipelineSelector(props) { component={"span"} style={{ wordBreak: "break-word", margin: "auto 0" }} color={ - (cache.primarySelectedMappings ?? [[]])[0][0] === k - ? "primary" + cache.primarySelectedMappings + ? cache.primarySelectedMappings[0][0].name === k + ? "primary" + : null : null } > diff --git a/src/views/jobs/builder/PipelineTrackSelector.jsx b/src/views/jobs/builder/PipelineTrackSelector.jsx index 5addfe1..f686698 100644 --- a/src/views/jobs/builder/PipelineTrackSelector.jsx +++ b/src/views/jobs/builder/PipelineTrackSelector.jsx @@ -27,7 +27,7 @@ function PipelineTrackSelector(props) { const removeTrack = (test) => { const { tracks } = cache; for (var i in tracks) { - const index = tracks[i].indexOf(test); + const index = tracks[i].findIndex((t) => t.name === test.name); if (index === -1) continue; tracks[i] = tracks[i].slice(0, index); } @@ -35,12 +35,13 @@ function PipelineTrackSelector(props) { }; const selectTrack = (test) => () => { - if (as1d(cache.tracks).includes(test)) return removeTrack(test); + if (as1d(cache.tracks).find((t) => t.name === test.name)) + return removeTrack(test); addTrack(test); }; const getColor = (test) => - as1d(cache.tracks).includes(test) ? "primary" : null; + as1d(cache.tracks).find((t) => t.name === test.name) ? "primary" : null; const nextClick = () => { setCache({ @@ -79,7 +80,7 @@ function PipelineTrackSelector(props) { style={{ wordBreak: "break-word", margin: "auto 0" }} color={getColor(test)} > - {test} + {test.name} I