From 3a0b341dc7c4297ce115dd66330ff1254e96b949 Mon Sep 17 00:00:00 2001
From: "Kernchen, Sophie"
Date: Tue, 28 Oct 2025 12:56:57 +0100
Subject: [PATCH 1/2] Fix Path
---
public/dashboard/main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/dashboard/main.js b/public/dashboard/main.js
index 5431e01..07e56c8 100644
--- a/public/dashboard/main.js
+++ b/public/dashboard/main.js
@@ -7,7 +7,7 @@ window.onload = async function () {
const token = localStorage.getItem("gitlab-api-token");
if (!token) {
alert("Please set up the GitLab connection first!");
- window.location = "/";
+ window.location = "./";
return;
}
From a6fd3eb6b9e8e714c4536409a6a380992a98b953 Mon Sep 17 00:00:00 2001
From: "Kernchen, Sophie"
Date: Tue, 28 Oct 2025 14:35:48 +0100
Subject: [PATCH 2/2] Add new categorie to load the latest job
---
public/callback/main.js | 34 ++++++++++++++++++++++++++++++++--
public/gitlab-setup/main.js | 2 +-
public/index.html | 5 ++++-
3 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/public/callback/main.js b/public/callback/main.js
index 0801b5e..21877c2 100644
--- a/public/callback/main.js
+++ b/public/callback/main.js
@@ -13,10 +13,15 @@ window.onload = async function () {
}
const gitLabProjectId = parameters.get("gitlab_project_id");
+
+ const get_latest = parameters.get("latest");
+
const gitLabPipelineId = parameters.get("gitlab_pipeline_id");
const gitLabJobId = parameters.get("gitlab_job_id");
+ if(get_latest != 1){
await registerPipeline(gitLabProjectId, gitLabPipelineId, gitLabJobId);
+ }
if (showDebugInformation) {
await new Promise(r => setTimeout(r, 5000));
@@ -24,11 +29,36 @@ window.onload = async function () {
const token = localStorage.getItem("gitlab-api-token");
if (token) {
- window.location = "/software-card/dashboard/";
+ if(get_latest==1){
+ await latest(gitLabProjectId, token);
+ }else{
+ window.location = "../dashboard/";
+ }
return;
} else {
alert("Please set up the GitLab connection, then go to the dashboard!");
- window.location = "/software-card/gitlab-setup/";
+ window.location = "../gitlab-setup/";
return;
}
+
+
+}
+
+async function latest(projectId, token) {
+ const jobResponse = await fetch(
+ `https://codebase.helmholtz.cloud/api/v4/projects/${projectId}/jobs/`,
+ { headers: { "Content-Type": "application/json", "PRIVATE-TOKEN": token } }
+ );
+
+ if (!jobResponse.ok) {
+ alert("Fetching pipeline failed");
+ return;
+ }
+
+ const jobData = await jobResponse.json();
+ const jobId = jobData[0]["id"];
+ const pipelineId = jobData[0]["pipeline"]["id"];
+
+ window.location = `../callback?gitlab_project_id=${projectId}&gitlab_pipeline_id=${pipelineId}&gitlab_job_id=${jobId}&latest=2`;
+ //gitlab_pipeline_id=618554&gitlab_job_id=2513432
}
diff --git a/public/gitlab-setup/main.js b/public/gitlab-setup/main.js
index bc278c2..9a2f7d7 100644
--- a/public/gitlab-setup/main.js
+++ b/public/gitlab-setup/main.js
@@ -40,7 +40,7 @@ window.onload = async function () {
localStorage.setItem("gitlab-name", userData["name"]);
localStorage.setItem("gitlab-api-token", token);
- window.location = "./";
+ window.location = "../";
return;
}
};
diff --git a/public/index.html b/public/index.html
index 37534ed..11e3a09 100644
--- a/public/index.html
+++ b/public/index.html
@@ -5,7 +5,7 @@
-
+
@@ -22,6 +22,8 @@ Welcome
Set up the connection to your GitLab account.
Load an
example CI pipeline.
+ Load the
+ newest CI pipeline.
See your dashboard.
See your curation view.
See your reporting view.
@@ -29,6 +31,7 @@ Welcome
+