Commit 58315ca3 authored by Candy Tsai's avatar Candy Tsai

unify layout for home status and api page

parent 592564ef
Pipeline #39298 passed with stage
in 11 minutes and 59 seconds
<!DOCTYPE html>
<html>
<head>
<noscript>
<style type='text/css'>
form { display: none }
</style>
</noscript>
<style type='text/css'>
body {
font-family: sans-serif;
max-width: 960px;
margin: 50px auto;
<h1>403 Forbidden: missing authentication</h1>
background-color: #fff0f0;
}
<p>
To retry a test job, you need to be authenticated with a client certificate
(e.g. Debian SSO), or with a API key. See the <a href="../../doc">API
documentation</a> for more information.
</p>
h1 {
color: #663333
}
pre {
background-color: #eeeeec;
border: 1px solid #babdb6;
border-radius: 2px;
padding: 0.5em;
}
</style>
</head>
<body>
<h1>403 Forbidden: missing authentication</h1>
<p>
To retry a test job, you need to be authenticated with a client certificate
(e.g. Debian SSO), or with a API key. See the <a href="../../doc">API
documentation</a> for more information.
</p>
<p>
Once you are properly authenticated, just reload this page to get the retry
form.
</p>
</body>
</html>
<p>
Once you are properly authenticated, just reload this page to get the retry
form.
</p>
<noscript>
<style type='text/css'>
form { display: none }
</style>
</noscript>
<html>
<head>
<noscript>
<style type='text/css'>
form { display: none }
</style>
</noscript>
<style type='text/css'>
body {
font-family: sans-serif;
max-width: 960px;
margin: 50px auto;
}
<h1>debci API documentation</h1>
pre {
background-color: #eeeeec;
border: 1px solid #babdb6;
border-radius: 2px;
padding: 0.5em;
}
</style>
</head>
<body>
<h1>debci API documentation</h1>
<% host = request.scheme + '://' + request.host %>
<% if ! [['http', 80], ['https', 443]].include?([request.scheme, request.port]) %>
<% host += ":%d" % request.port %>
<% end %>
<% host = request.scheme + '://' + request.host %>
<% if ! [['http', 80], ['https', 443]].include?([request.scheme, request.port]) %>
<% host += ":%d" % request.port %>
<% end %>
<p>
All requests to the API must provide a <a href="v1/getkey">valid API key</a>
in the <code>Auth-Key</code> HTTP header. The only exception are the
endpoints that manipulate the API keys themselves, in which case the
requests must be authenticated using another method (HTTP basic
authentication, client certificates, etc).
</p>
<p>
Example:
</p>
<pre>$ KEY='00000000-0000-0000-0000-000000000000'
<p>
All requests to the API must provide a <a href="v1/getkey">valid API key</a>
in the <code>Auth-Key</code> HTTP header. The only exception are the
endpoints that manipulate the API keys themselves, in which case the
requests must be authenticated using another method (HTTP basic
authentication, client certificates, etc).
</p>
<p>
Example:
</p>
<pre>$ KEY='00000000-0000-0000-0000-000000000000'
$ curl --header "Auth-Key: $KEY" <%= host %>/api/v1/auth</pre>
<% @doc.each do |entry| %>
<h2>
<%= entry[:method] %>
<%= entry[:path] %>
</h2>
<%= entry[:text].gsub('https://host', host) %>
<% end %>
</body>
</html>
<% @doc.each do |entry| %>
<h2>
<%= entry[:method] %>
<%= entry[:path] %>
</h2>
<%= entry[:text].gsub('https://host', host) %>
<% end %>
<noscript>
<style type='text/css'>
form { display: none }
</style>
</noscript>
<html>
<head>
<noscript>
<style type='text/css'>
form { display: none }
</style>
</noscript>
<style type='text/css'>
body {
font-family: sans-serif;
max-width: 960px;
margin: 50px auto;
}
pre {
background-color: #eeeeec;
border: 1px solid #babdb6;
border-radius: 2px;
padding: 0.5em;
}
</style>
</head>
<body>
<h1>Get an API key</h1>
<noscript>
<p>
To obtain an API key from this page, you need Javascript enabled on your
browser.
</p>
<p>
You will need to make a HTTP POST request to this page URL, for example
using <code>curl</code> or <code>wget</code>, authenticated with a valid
SSL client certificate.
</p>
</noscript>
<form method="POST">
<p>
Once you click the "Get Key" button below, any previous key you had will
be invalidated.
</p>
<div id='key-info' style='display: none'>
<p>
Your key:
</p>
<pre id='key'></pre>
<p>
Please copy it now and store it in a safe location.
<em>It will not be displayed again</em>
</p>
</div>
<input type='button' value='Get Key' onclick='getkey(this)'/>
</form>
<script type='text/javascript'>
function displaykey() {
var status = this.status
if (Math.floor(status/100) == 2) {
var keyinfo = document.getElementById('key-info')
var keytext = document.getElementById('key')
keytext.innerHTML = this.responseText
keyinfo.style.display = 'block'
} else {
var text = this.statusText
alert("An error ocurred while trying to get a key: " + status + " " + text)
}
}
function getkey(button) {
var request = new XMLHttpRequest();
request.addEventListener('load', displaykey)
request.open("POST", document.location.href)
request.send()
<h1>Get an API key</h1>
<noscript>
<p>
To obtain an API key from this page, you need Javascript enabled on your
browser.
</p>
<p>
You will need to make a HTTP POST request to this page URL, for example
using <code>curl</code> or <code>wget</code>, authenticated with a valid
SSL client certificate.
</p>
</noscript>
<form method="POST">
<p>
Once you click the "Get Key" button below, any previous key you had will
be invalidated.
</p>
<div id='key-info' style='display: none'>
<p>
Your key:
</p>
<pre id='key'></pre>
<p>
Please copy it now and store it in a safe location.
<em>It will not be displayed again</em>
</p>
</div>
<input type='button' value='Get Key' onclick='getkey(this)'/>
</form>
<script type='text/javascript'>
function displaykey() {
var status = this.status
if (Math.floor(status/100) == 2) {
var keyinfo = document.getElementById('key-info')
var keytext = document.getElementById('key')
keytext.innerHTML = this.responseText
keyinfo.style.display = 'block'
} else {
var text = this.statusText
alert("An error ocurred while trying to get a key: " + status + " " + text)
}
</script>
</body>
</html>
}
function getkey(button) {
var request = new XMLHttpRequest();
request.addEventListener('load', displaykey)
request.open("POST", document.location.href)
request.send()
}
</script>
<noscript>
<style type='text/css'>
form { display: none }
</style>
</noscript>
../html/layout.erb
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<noscript>
<style type='text/css'>
form { display: none }
</style>
</noscript>
<style type='text/css'>
body {
font-family: sans-serif;
max-width: 960px;
margin: 50px auto;
}
pre {
background-color: #eeeeec;
border: 1px solid #babdb6;
border-radius: 2px;
padding: 0.5em;
}
</style>
</head>
<body>
<h1>Retry an autopkgtest job</h1>
<noscript>
<p>
To retry an autopkgtest job via this page, you need Javascript enabled on your
browser.
</p>
<p>
Without it, you will need to make a HTTP POST request to this page URL,
for example using <code>curl</code> or <code>wget</code>, authenticated
with a valid SSL client certificate or with a valid Debci key (see
the <a href="/doc/file.API.html">API documentation</a>).
</p>
</noscript>
<form method="POST">
<p>
Once you click the "Retry" button below, an autopkgtest with the same
settings as the original will be triggered on the infrastructure.
</p>
<div id='result-info' style='display: none'>
<p>
Your request has been successfully submitted.
</p>
</div>
<input type='button' value='Retry' onclick='retry(this)'/>
</form>
<script type='text/javascript'>
function displayresult() {
var status = this.status
if (Math.floor(status/100) == 2) {
var resinfo = document.getElementById('result-info')
resinfo.style.display = 'block'
} else {
var text = this.statusText
alert("An error ocurred while requesting a retry: " + status + " " + text)
}
}
function retry(button) {
var request = new XMLHttpRequest();
request.addEventListener('load', displayresult)
request.open("POST", document.location.href)
request.send()
<h1>Retry an autopkgtest job</h1>
<noscript>
<p>
To retry an autopkgtest job via this page, you need Javascript enabled on your
browser.
</p>
<p>
Without it, you will need to make a HTTP POST request to this page URL,
for example using <code>curl</code> or <code>wget</code>, authenticated
with a valid SSL client certificate or with a valid Debci key (see
the <a href="/doc/file.API.html">API documentation</a>).
</p>
</noscript>
<form method="POST">
<p>
Once you click the "Retry" button below, an autopkgtest with the same
settings as the original will be triggered on the infrastructure.
</p>
<div id='result-info' style='display: none'>
<p>
Your request has been successfully submitted.
</p>
</div>
<input type='button' value='Retry' onclick='retry(this)'/>
</form>
<script type='text/javascript'>
function displayresult() {
var status = this.status
if (Math.floor(status/100) == 2) {
var resinfo = document.getElementById('result-info')
resinfo.style.display = 'block'
} else {
var text = this.statusText
alert("An error ocurred while requesting a retry: " + status + " " + text)
}
</script>
</body>
</html>
}
function retry(button) {
var request = new XMLHttpRequest();
request.addEventListener('load', displayresult)
request.open("POST", document.location.href)
request.send()
}
</script>
<noscript>
<style type='text/css'>
form { display: none }
</style>
</noscript>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class='page-header'>Status <small>/ Blacklist</small></h1>
<%= @status_nav %>
<table class='table table-striped'>
<% Debci.blacklist.packages.each do |package, reason| %>
<tr>
<td><a href="/packages/<%= Debci::Package.new(package).prefix %>/<%= package %>/"><%= package %></a></td>
<td>
<% if reason && !reason.empty? %>
<%= reason %>
<% else %>
<em>No reason provided</em>
<% end %>
</td>
</tr>
<% end %>
</table>
</div>
<div class="row">
<div class="col-md-12">
<h1 class='page-header'>Status <small>/ Blacklist</small></h1>
<%= @status_nav %>
<table class='table table-striped'>
<% Debci.blacklist.packages.each do |package, reason| %>
<tr>
<td><a href="/packages/<%= Debci::Package.new(package).prefix %>/<%= package %>/"><%= package %></a></td>
<td>
<% if reason && !reason.empty? %>
<%= reason %>
<% else %>
<em>No reason provided</em>
<% end %>
</td>
</tr>
<% end %>
</table>
</div>
</div>
<div class="container">
<div class='row'>
<div class='col-lg-12'>
<ol class='breadcrumb'>
<li><a href='/packages/<%= @package.prefix %>'><%= @package.prefix %></a></li>
<li><a href='/packages/<%= @package.prefix %>/<%= @package.name %>'><%= @package.name %></a></li>
<li class='active'><%= @suite %>/<%= @architecture %></li>
</ol>
<div class='row'>
<div class='col-lg-12'>
<ol class='breadcrumb'>
<li><a href='/packages/<%= @package.prefix %>'><%= @package.prefix %></a></li>
<li><a href='/packages/<%= @package.prefix %>/<%= @package.name %>'><%= @package.name %></a></li>
<li class='active'><%= @suite %>/<%= @architecture %></li>
</ol>
<h2>
<%= @package.name %>
<small>
[ <%= @suite %>/<%= @architecture %> ]
<h2>
<%= @package.name %>
<small>
[ <%= @suite %>/<%= @architecture %> ]
<a href='/data/feeds/<%= @package.prefix %>/<%= @package.name %>.xml'><i class='fa fa-rss'></i></a>
<a href='/data/feeds/<%= @package.prefix %>/<%= @package.name %>.xml'><i class='fa fa-rss'></i></a>
<a href='https://tracker.debian.org/pkg/<%= @package.name %>'
title='On the Package Tracking System'><i class='fa fa-info-circle'></i></a>
</small>
</h2>
<a href='https://tracker.debian.org/pkg/<%= @package.name %>'
title='On the Package Tracking System'><i class='fa fa-info-circle'></i></a>
</small>
</h2>
<% if @package.blacklisted? %>
<div class='alert alert-warning'>
This package is currently <a href="/status/blacklist/">blacklisted</a> and will not have any new test runs.
</div>
<% end %>
<% if @package.blacklisted? %>
<div class='alert alert-warning'>
This package is currently <a href="/status/blacklist/">blacklisted</a> and will not have any new test runs.
</div>
<% end %>
<% if @latest && @latest.status == :fail && @latest.failmsg %>
<div class='alert alert-warning'>
<%= icon(@latest.extended_status) %>
This package is failing and has <%= @latest.failmsg %>.
</div>
<% end %>
<% if @latest && @latest.status == :fail && @latest.failmsg %>
<div class='alert alert-warning'>
<%= icon(@latest.extended_status) %>
This package is failing and has <%= @latest.failmsg %>.
</div>
<% end %>
<table class="table">
<tr>
<td><b>Version</b></td>
<td><b>Date</b></td>
<td><b>Trigger</b></td>
<td><b>Duration</b></td>
<td><b>Status</b></td>
<td><b>Results</b></td>
<td></td>
<td></td>
</tr>
<table class="table">
<tr>
<td><b>Version</b></td>
<td><b>Date</b></td>
<td><b>Trigger</b></td>
<td><b>Duration</b></td>
<td><b>Status</b></td>
<td><b>Results</b></td>
<td></td>
<td></td>
</tr>
<% begin %>
<% Array(@package.history(@suite, @architecture)).each do |test| %>
<tr>
<td><%= test.version %></td>
<td><%= test.date %></td>
<td><%= escape(test.trigger) || '&mdash;' %></td>
<td><%= test.duration_human %></td>
<td>
<%= icon(test.status) %>
<%= test.status %>
</td>
<% begin %>
<% Array(@package.history(@suite, @architecture)).each do |test| %>
<tr>
<td><%= test.version %></td>
<td><%= test.date %></td>
<td><%= escape(test.trigger) || '&mdash;' %></td>
<td><%= test.duration_human %></td>
<td>
<%= icon(test.status) %>
<%= test.status %>
</td>
<% if test.expired? %>
<td><span class='fa fa-trash' title='file has been removed due to data retention policy'></span></td>
<% else %>
<td><a href="/<%= @packages_dir %>/<%= @package_dir %>/<%= test.run_id %>.log">debci log</a></td>
<% end %>
<% if @artifacts_url_base %>
<td><a href="<%= @artifacts_url_base %>/<%= @package_dir %>/<%= test.run_id %>/log.gz">test log</a></td>
<td><a href="<%= @artifacts_url_base %>/<%= @package_dir %>/<%= test.run_id %>/artifacts.tar.gz">artifacts</a></td>
<% else %>
<% if test.expired? %>
<td><span class='fa fa-trash' title='file has been removed due to data retention policy'></span></td>
<td><span class='fa fa-trash' title='file has been removed due to data retention policy'></span></td>
<% else %>
<td><a href="/<%= @packages_dir %>/<%= @package_dir %>/<%= test.run_id %>.log">debci log</a></td>
<% end %>
<% if @artifacts_url_base %>
<td><a href="<%= @artifacts_url_base %>/<%= @package_dir %>/<%= test.run_id %>/log.gz">test log</a></td>
<td><a href="<%= @artifacts_url_base %>/<%= @package_dir %>/<%= test.run_id %>/artifacts.tar.gz">artifacts</a></td>
<% else %>
<% if test.expired? %>
<td><span class='fa fa-trash' title='file has been removed due to data retention policy'></span></td>
<td><span class='fa fa-trash' title='file has been removed due to data retention policy'></span></td>
<% else %>
<td><a href="/<%= @autopkgtest_dir %>/<%= @package_dir %>/<%= test.run_id %>/log.gz">test log</a></td>
<td><a href="/<%= @autopkgtest_dir %>/<%= @package_dir %>/<%= test.run_id %>/artifacts.tar.gz">artifacts</a></td>
<% end %>
<td><a href="/<%= @autopkgtest_dir %>/<%= @package_dir %>/<%= test.run_id %>/log.gz">test log</a></td>
<td><a href="/<%= @autopkgtest_dir %>/<%= @package_dir %>/<%= test.run_id %>/artifacts.tar.gz">artifacts</a></td>
<% end %>
</tr>
<% end %>
<% rescue JSON::ParserError %>
</table>
<div class='alert alert-warning' role='alert'>
<span class='fa fa-warning'></span>
Cannot display test history. There was an error when parsing the history data.
<a href='/<%= @packages_dir %>/<%= @package_dir %>/history.json'>[ See raw JSON file ]</a>
</div>
<% end %>
<% end %>
</tr>
<% end %>
<% rescue JSON::ParserError %>
</table>
<div class='alert alert-warning' role='alert'>
<span class='fa fa-warning'></span>
Cannot display test history. There was an error when parsing the history data.
<a href='/<%= @packages_dir %>/<%= @package_dir %>/history.json'>[ See raw JSON file ]</a>
</div>
<% end %>
</table>
</table>
<p>Automate:</p>
<p>Automate:</p>
<% automation_info = "<code># latest status of the package\n" +
"$ curl #{@site_url}/#{@packages_dir}/#{@package_dir}/latest.json\n\n"
<% automation_info = "<code># latest status of the package\n" +
"$ curl #{@site_url}/#{@packages_dir}/#{@package_dir}/latest.json\n\n"
if not @artifacts_url_base
automation_info += "# latest autopkgtest log of the package\n" +
"$ curl #{@site_url}/#{@packages_dir}/#{@package_dir}/latest-autopkgtest/log.gz\n\n"
end
if not @artifacts_url_base
automation_info += "# latest autopkgtest log of the package\n" +
"$ curl #{@site_url}/#{@packages_dir}/#{@package_dir}/latest-autopkgtest/log.gz\n\n"
end
automation_info += "# test run history of the package\n" +
"$ curl #{@site_url}/#{@packages_dir}/#{@package_dir}/history.json</code>"
%>
automation_info += "# test run history of the package\n" +
"$ curl #{@site_url}/#{@packages_dir}/#{@package_dir}/history.json</code>"
%>
<pre><%= automation_info %></pre>
<pre><%= automation_info %></pre>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">News
<a class='pull-right'
href="data/feeds/all-packages.xml"
title='Atom feed for events in all packages'><i class='fa fa-rss'></i></a>
</div>
<div class="list-group">
<% news = @repository.news_for('*') %>
<% if news.empty? %>
<div class='list-group-item'><em>(no news yet)</em></div>
<% else %>
<% news.each do |item| %>
<a href="/packages/<%= @repository.find_package(item.package).prefix %>/<%= item.package %>/<%= item.suite %>/<%= item.architecture %>" class="list-group-item"><%= icon(item.extended_status) %> <%= item.headline %><div><small class="text-muted"><%= item.date %> | <strong><%= item.time %></strong></small></div></a>
<% end %>
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">News
<a class='pull-right'
href="data/feeds/all-packages.xml"
title='Atom feed for events in all packages'><i class='fa fa-rss'></i></a>
</div>
<div class="list-group">
<% news = @repository.news_for('*') %>
<% if news.empty? %>
<div class='list-group-item'><em>(no news yet)</em></div>
<% else %>
<% news.each do |item| %>
<a href="/packages/<%= @repository.find_package(item.package).prefix %>/<%= item.package %>/<%= item.suite %>/<%= item.architecture %>" class="list-group-item"><%= icon(item.extended_status) %> <%= item.headline %><div><small class="text-muted"><%= item.date %> | <strong><%= item.time %></strong></small></div></a>
<% end %>
<% end %>
</div> <!-- class='list-group' -->
</div> <!-- class='panel panel-default' -->
</div> <!-- class='col-md-4' -->
</div> <!-- class='list-group' -->
</div> <!-- class='panel panel-default' -->
</div> <!-- class='col-md-4' -->
<div class="col-md-8">
<div class="col-md-8">
<h3>Packages</h3>
<ul class="list-inline">
<% @package_prefixes.each do |prefix| %>
<li><h5><a href="/packages/<%= prefix %>"><%= prefix %></a></h5></li>
<% end %>
<% if @package_prefixes.empty? %>
<em>(no data yet)</em>
<% end %>
</ul>
<h3>Packages</h3>
<ul class="list-inline">
<% @package_prefixes.each do |prefix| %>
<li><h5><a href="/packages/<%= prefix %>"><%= prefix %></a></h5></li>
<% end %>
<% if @package_prefixes.empty? %>
<em>(no data yet)</em>
<% end %>
</ul>
</div> <!-- class='col-md-8' -->
</div> <!-- class='col-md-8' -->
</div> <!-- class='row' -->
</div> <!-- class='container' -->
</div> <!-- class='row' -->
......@@ -42,7 +42,9 @@
</div>
</div>
<%= yield %>
<div class="container">
<%= yield %>
</div>
<div id="footer">