Skip to content
Snippets Groups Projects
Commit c39f2ae6 authored by Steffen Vogel's avatar Steffen Vogel :santa_tone2:
Browse files

fix accesses to profile service

parent afa15018
No related branches found
No related tags found
No related merge requests found
Pipeline #379400 passed
......@@ -76,18 +76,25 @@ function updateDirectLink(profileSlug, path) {
}
function loadBuildStatus() {
window.fetch(serviceUrl + '/profile/all')
.then(response => response.json())
.then(json => {
this.console.log(json);
for (const i in json.jobs) {
let job = json.jobs[i];
elm = this.document.getElementById('build-' + job.name);
getProfiles().then(profiles => {
for (const i in profiles) {
let profile = profiles[i];
let elm = document.getElementById('build-' + profile.slug);
if (elm) {
elm.classList.add(job.status);
elm.innerText = job.status;
elm.insertAdjacentHTML('afterend', '<span class="build-log">(open <a href="' + job.web_url + '">build log</a> #' + job.id + ' from ' + new Date(job.created_at).toLocaleString() + ')</span>');
let build = profile.last_build;
if (build) {
elm.classList.add(build.status);
elm.innerText = build.status;
let date = new Date(build.started_at).toLocaleString();
let text = '<a href="' + build.web_url + '">#' + build.id + '</a> from ' + date + ' ran for ' + build.duration + ' secs, triggered by <a href="' + build.user.web_url + '">' + build.user.name + '</a>';
elm.insertAdjacentHTML('afterend', '<span title="' + build.commit.message + '" class="build-details">' + text + '</span>');
}
else {
elm.classList.add('unknown');
elm.innerText = 'unknown';
}
}
}
});
......@@ -130,9 +137,9 @@ function insertVersionCollapsibles() {
coll.insertAdjacentElement('beforebegin', btn)
btn.addEventListener('click', () => {
window.fetch(apiBaseUrl + '/versions/' + slug + '/' + repo)
.then((response) => response.json())
.then((pkgs) => {
fetch(serviceUrl + '/profile/api/' + slug + '/versions/' + repo)
.then(response => response.json())
.then(pkgs => {
tbl = document.createElement('table');
tbl.classList.add('versions')
tbl.insertAdjacentHTML('afterbegin', '<th>Name</th><th>Version</th>');
......
......@@ -8,7 +8,7 @@ span.build-badge {
padding: 0px 6px;
}
span.build-log {
span.build-details {
padding-left: 10px;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment