Skip to content

Commit

Permalink
Merge pull request #9 from IceWreck/build
Browse files Browse the repository at this point in the history
Add Copr Builds to the dashboard.
  • Loading branch information
lachmanfrantisek committed Feb 25, 2020
2 parents 6f90df0 + dca622f commit 453d9c2
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 43 deletions.
13 changes: 13 additions & 0 deletions packit_dashboard/app.py
Expand Up @@ -98,6 +98,19 @@ def projects():
)
return render_template("main_frame.html", header="Project", content=content)

@app.route("/builds/")
def builds():
# Only display recent builds for now
# Fetching everything takes too long
# TODO Add button/table navigation to load more
json_url = f"{API_URL}/copr-builds?page=1&per_page=20"
api_data = requests.get(url=json_url).json()
content = render_template(
"builds.html",
builds_list = api_data
)
return render_template("main_frame.html", header="Builds", content=content)


if __name__ == "__main__":
app.run(debug=True)
77 changes: 77 additions & 0 deletions templates/builds.html
@@ -0,0 +1,77 @@
<h2> Recent Builds</h2>
<table class="pf-c-table pf-m-grid-lg" role="grid" aria-label="Builds Table" id="builds-table">

<thead>
<tr role="row">
<th class="pf-c-table__sort " role="columnheader" scope="col">
<button class="pf-c-button pf-m-plain" type="button">Project
<span class="pf-c-table__sort-indicator">
<i class="fas fa-arrows-alt-v"></i>
</span>
</button>
</th>
<th class="pf-c-table__sort " role="columnheader" aria-sort="none" scope="col">
<button class="pf-c-button pf-m-plain" type="button">Owner
<span class="pf-c-table__sort-indicator">
<i class="fas fa-arrows-alt-v"></i>
</span>
</button>
</th>
<th class="pf-c-table__sort " role="columnheader" aria-sort="none" scope="col">
<button class="pf-c-button pf-m-plain" type="button">Status
<span class="pf-c-table__sort-indicator">
<i class="fas fa-arrows-alt-v"></i>
</span>
</button>
</th>
<th class="pf-c-table__sort sort-disabled" role="columnheader" aria-sort="none" scope="col">
<button class="pf-c-button pf-m-plain" type="button">Chroots
</button>
</th>
<th class="pf-c-table__sort " role="columnheader" aria-sort="none" scope="col">
<button class="pf-c-button pf-m-plain" type="button">Build ID
<span class="pf-c-table__sort-indicator">
<i class="fas fa-arrows-alt-v"></i>
</span>
</button>
</th>

</tr>
</thead>
<tbody role="rowgroup">


{% for build in builds_list %}
<tr role="row">
<td role="cell" data-label="Project">{{ build["project"] }}</td>
<td role="cell" data-label="Owner">{{ build["owner"] }}</td>
<td role="cell" data-label="Status">{{ build["status"] }}</td>
<td role="cell" data-label="Chroots">
{% for os in build["chroots"] %}
<li>{{ os }}</li>
{% endfor %}
</td>
<td role="cell" data-label="Build ID">{{ build["build_id"] }}</td>
</tr>
{% endfor %}

</tbody>
</table>

<script src="{{ url_for('node_modules', filename='datatables.net/js/jquery.dataTables.min.js') }}">
</script>
<script type="text/javascript">
$(document).ready(function () {
$('#builds-table').DataTable({
"paging": false,
"searching": false,
"info": false
});
});
</script>

<style>
.sort-disabled {
pointer-events: none;
}
</style>
98 changes: 55 additions & 43 deletions templates/main_frame.html
@@ -1,48 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="{{ url_for('node_modules', filename='@patternfly/patternfly/patternfly.css') }}">
</head>
<body>
<div class="pf-c-page" id="page-layout-horizontal-nav">
<header role="banner" class="pf-c-page__header">
<div class="pf-c-page__header-brand">
<a class="pf-c-page__header-brand-link" href="https://github.com/packit-service/packit-service">
<img class="pf-c-brand" src="https://avatars2.githubusercontent.com/u/46870917?s=400&u=d55055f0ee529d7b45dbf67f464735527becca77&v=4" alt="Packit Service" />
</a>
</div>
<div class="pf-c-page__header-nav">
<nav class="pf-c-nav pf-m-end" id="page-layout-horizontal-nav-horizontal-nav" aria-label="Global">
<ul class="pf-c-nav__horizontal-list">
<li class="pf-c-nav__item">
<a href="{{ url_for('status') }}" class="pf-c-nav__link">Service Status</a>
</li>
<li class="pf-c-nav__item">
<a href="{{ url_for('projects') }}" class="pf-c-nav__link">Projects</a>
</li>
</ul>
</nav>

<head>
<meta charset="UTF-8">

<link rel="stylesheet" type="text/css"
href="{{ url_for('node_modules', filename='@patternfly/patternfly/patternfly.css') }}">

<!-- Scripts at the top so that js based components do not error out -->
<script src="{{ url_for('node_modules', filename='jquery/dist/jquery.min.js') }}"></script>
<script src="{{ url_for('node_modules', filename='patternfly/dist/js/patternfly.js') }}"></script>

</head>

<body>

<div class="pf-c-page" id="page-layout-horizontal-nav">
<header role="banner" class="pf-c-page__header">
<div class="pf-c-page__header-brand">
<a class="pf-c-page__header-brand-link" href="https://github.com/packit-service/packit-service">
<img class="pf-c-brand"
src="https://avatars2.githubusercontent.com/u/46870917?s=400&u=d55055f0ee529d7b45dbf67f464735527becca77&v=4"
alt="Packit Service" />
</a>
</div>
<div class="pf-c-page__header-nav">
<nav class="pf-c-nav pf-m-end" id="page-layout-horizontal-nav-horizontal-nav" aria-label="Global">
<ul class="pf-c-nav__horizontal-list">
<li class="pf-c-nav__item">
<a href="{{ url_for('status') }}" class="pf-c-nav__link">Service Status</a>
</li>
<li class="pf-c-nav__item">
<a href="{{ url_for('projects') }}" class="pf-c-nav__link">Projects</a>
</li>
<li class="pf-c-nav__item">
<a href="{{ url_for('builds') }}" class="pf-c-nav__link">Recent Builds</a>
</li>
</ul>
</nav>
</div>
</header>

<main role="main" class="pf-c-page__main" tabindex="-1" id="main-content-page-layout-horizontal-nav">
<section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content">
<h1> Information </h1>
</div>
</section>
<section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content">
{{ content|safe }}
</div>
</section>
</main>
</div>
</header>

<main role="main" class="pf-c-page__main" tabindex="-1" id="main-content-page-layout-horizontal-nav">
<section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content">
<h1> Information </h1>
</div>
</section>
<section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content">
{{ content|safe }}
</div>
</section>
</main>
</div>
<script src="{{ url_for('node_modules', filename='jquery/dist/jquery.min.js') }}"></script>
<script src="{{ url_for('node_modules', filename='patternfly/dist/js/patternfly.js') }}"></script>

</body>
</html>

</body>

</html>

0 comments on commit 453d9c2

Please sign in to comment.