Improve the style of the PR list (both interface and code)

pull/3/head
Baptiste Gelez 5 years ago
parent c418d54aec
commit c8a3b49c82

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Plume-ci ⋅ list of running pull requests</title> <title>Plume-ci ⋅ List of running pull requests</title>
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/main.css" /> <link rel="stylesheet" href="/main.css" />
<link rel="stylesheet" href="/feather.css" /> <link rel="stylesheet" href="/feather.css" />
@ -18,7 +18,7 @@
<nav> <nav>
<a href="/" class="title"> <a href="/" class="title">
<img src="/plumeFeather256.png"> <img src="/plumeFeather256.png">
<p>Plume</p> <p>Plume CI</p>
</a> </a>
<hr/> <hr/>
</nav> </nav>
@ -26,7 +26,7 @@
</header> </header>
<main> <main>
<h1>List of running pull requests</h1> <h1>List of running pull requests</h1>
<ul id="list"></ul> <ul class="list" id="list"></ul>
</main> </main>
<footer> <footer>
<span>Plume-ci 0.0.1</span> <span>Plume-ci 0.0.1</span>

@ -1,44 +1,34 @@
fetch("/up.json").then(function(response) { fetch('/up.json')
return response.json().then(function(json) { .then(r => r.json())
for(i = 0; i < json.length; i++) { .then(json => {
let id = json[i]; for (const id of json) {
fetch("https://api.github.com/repos/Plume-org/Plume/pulls/"+id, {mode: 'cors'}).then( fetch(`https://api.github.com/repos/Plume-org/Plume/pulls/${id}`, { mode: 'cors' })
.then(r => r.json())
.catch(() => {
return {
title: ''
}
})
.then(json => {
const linkTest = document.createElement('a')
linkTest.href = `https://pr-${id}.joinplu.me/`
linkTest.innerText = `#${id}: ${json.title || ''}`
const linkGitHub = document.createElement('a')
linkGitHub.href = `https://github.com/Plume-org/Plume/pull/${id}`
linkGitHub.innerText = 'View on Github'
function(response) { const pTest = document.createElement('p')
return response.json().then(function(json) { pTest.classList.add('grow')
let link_test = document.createElement("a"); pTest.appendChild(linkTest)
link_test.href = "https://pr-" + id + ".joinplu.me/"; const pGitHub = document.createElement('p')
let link_github = document.createElement("a"); pGitHub.appendChild(linkGitHub)
link_github.href = "https://github.com/Plume-org/Plume/pull/" + id;
link_github.innerText = "(view on Github)";
if(json.title === undefined) {
link_test.innerText = "#" + id;
} else {
link_test.innerText = "#" + id + " " + json.title;
}
let li = document.createElement("li");
li.appendChild(link_test);
li.append(" ⋅ ");
li.appendChild(link_github);
document.getElementById("list").appendChild(li);
})
}
).catch( const li = document.createElement('li')
function() { li.appendChild(pTest)
let link_test = document.createElement("a"); li.appendChild(pGitHub)
link_test.href = "https://pr-" + id + ".joinplu.me/"; li.classList.add('flex')
let link_github = document.createElement("a"); document.getElementById('list').appendChild(li)
link_github.href = "https://github.com/Plume-org/Plume/pull/" + id; })
link_github.innerText = "(view on Github)";
link_test.innerText = "#" + id;
let li = document.createElement("li");
li.appendChild(link_test);
li.append(" ⋅ ");
li.appendChild(link_github);
document.getElementById("list").appendChild(li);
}
)
} }
}) })
});

Loading…
Cancel
Save