Browse Source

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

pull/3/head
Baptiste Gelez 2 years ago
parent
commit
c8a3b49c82
2 changed files with 33 additions and 43 deletions
  1. +3
    -3
      static/index.html
  2. +30
    -40
      static/plume-ci.js

+ 3
- 3
static/index.html View File

@@ -2,7 +2,7 @@
<html>
<head>
<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" />
<link rel="stylesheet" href="/main.css" />
<link rel="stylesheet" href="/feather.css" />
@@ -18,7 +18,7 @@
<nav>
<a href="/" class="title">
<img src="/plumeFeather256.png">
<p>Plume</p>
<p>Plume CI</p>
</a>
<hr/>
</nav>
@@ -26,7 +26,7 @@
</header>
<main>
<h1>List of running pull requests</h1>
<ul id="list"></ul>
<ul class="list" id="list"></ul>
</main>
<footer>
<span>Plume-ci 0.0.1</span>


+ 30
- 40
static/plume-ci.js View File

@@ -1,44 +1,34 @@
fetch("/up.json").then(function(response) {
return response.json().then(function(json) {
for(i = 0; i < json.length; i++) {
let id = json[i];
fetch("https://api.github.com/repos/Plume-org/Plume/pulls/"+id, {mode: 'cors'}).then(
fetch('/up.json')
.then(r => r.json())
.then(json => {
for (const id of json) {
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) {
return response.json().then(function(json) {
let link_test = document.createElement("a");
link_test.href = "https://pr-" + id + ".joinplu.me/";
let link_github = document.createElement("a");
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);
})
}
const pTest = document.createElement('p')
pTest.classList.add('grow')
pTest.appendChild(linkTest)
const pGitHub = document.createElement('p')
pGitHub.appendChild(linkGitHub)

).catch(
function() {
let link_test = document.createElement("a");
link_test.href = "https://pr-" + id + ".joinplu.me/";
let link_github = document.createElement("a");
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);
}
)
const li = document.createElement('li')
li.appendChild(pTest)
li.appendChild(pGitHub)
li.classList.add('flex')
document.getElementById('list').appendChild(li)
})
}
})
});


Loading…
Cancel
Save