Improve the style of the PR list (both interface and code)
parent
c418d54aec
commit
c8a3b49c82
@ -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…
Reference in New Issue