Skip to content

Commit eef587e

Browse files
authored
Merge pull request #98 from ISISComputingGroup/refresh_jenkins_jobs
Auto-refresh jenkins jobs every minute
2 parents 1aaf561 + ecab572 commit eef587e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/components/JenkinsJobs.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ const jenkinsColourToWebDashColour = new Map<string, string>([
1212
["yellow", `bg-[#dddd00]`],
1313
[
1414
"yellow_anime",
15-
`bg-[repeating-linear-gradient(45deg,#dddd00_0px,#dddd00_20px,#eeee00_20px,#eeee00_40px)]`,
15+
"bg-[repeating-linear-gradient(45deg,#dddd00_0px,#dddd00_20px,#eeee00_20px,#eeee00_40px)]",
1616
], // build running but was broken
1717
[
1818
"red_anime",
19-
`bg-[repeating-linear-gradient(45deg,#F08080_0px,#F08080_20px,#F09090_20px,#F09090_40px)]`,
19+
"bg-[repeating-linear-gradient(45deg,#F08080_0px,#F08080_20px,#F09090_20px,#F09090_40px)]",
2020
], // build running but was broken
2121
[
2222
"blue_anime",
@@ -32,6 +32,7 @@ export default function JenkinsJobs() {
3232
const [data, setData] = useState<Array<IfcWallDisplayJob>>([]);
3333

3434
useEffect(() => {
35+
// initially request from jenkins, then set interval to do so every minute thereafter.
3536
async function fetchPosts() {
3637
const res = await fetch(
3738
"https://epics-jenkins.isis.rl.ac.uk/view/WallDisplay/api/json",
@@ -43,6 +44,11 @@ export default function JenkinsJobs() {
4344
setData(jobs);
4445
}
4546
fetchPosts();
47+
48+
const interval = setInterval(() => {
49+
fetchPosts();
50+
}, 60000);
51+
return () => clearInterval(interval);
4652
}, []);
4753

4854
if (data.length === 0) {

0 commit comments

Comments
 (0)