[infra] new build status ui

This commit is contained in:
Oliver Chang 2017-04-18 00:46:54 -07:00 committed by Oliver Chang
parent af7251ffc0
commit 489446d17a
6 changed files with 218 additions and 0 deletions

View File

@ -0,0 +1,18 @@
{
"name": "build-status",
"main": "index.html",
"dependencies": {
"polymer": "Polymer/polymer#^2.0.0-rc.3",
"paper-item": "PolymerElements/paper-item#2.0-preview",
"app-layout": "PolymerElements/app-layout#2.0-preview",
"paper-card": "PolymerElements/paper-card#2.0-preview",
"iron-icons": "PolymerElements/iron-icons#2.0-preview",
"iron-ajax": "PolymerElements/iron-ajax#2.0-preview",
"iron-flex-layout": "PolymerElements/iron-flex-layout#2.0-preview",
"paper-icon-button": "PolymerElements/paper-icon-button#2.0-preview"
},
"devDependencies": {
"web-component-tester": "^6.0.0-prerelease.5",
"webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0-rc.7"
}
}

3
infra/gcb/templates/deploy.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
gsutil -m cp -r bower_components index.html src manifest.json gs://oss-fuzz-build-logs

View File

@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<title>OSS-Fuzz build status</title>
<meta name="description" content="OSS-Fuzz build status">
<!-- See https://goo.gl/OOhYW5 -->
<link rel="manifest" href="/manifest.json">
<script src="/bower_components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="/src/build-status/build-status.html">
<style>
body {
font-family: 'Roboto', 'Noto', sans-serif;
background: #f1f1f1;
margin: 0;
}
</style>
</head>
<body>
<build-status></build-status>
</body>
</html>

View File

@ -0,0 +1,6 @@
{
"name": "build-status",
"short_name": "build-status",
"start_url": "/",
"display": "standalone"
}

View File

@ -0,0 +1,7 @@
{
"lint": {
"rules": [
"polymer-2"
]
}
}

View File

@ -0,0 +1,156 @@
<link rel="import" href="../../bower_components/polymer/polymer-element.html">
<link rel="import" href="../../bower_components/app-layout/app-drawer-layout/app-drawer-layout.html">
<link rel="import" href="../../bower_components/app-layout/app-drawer/app-drawer.html">
<link rel="import" href="../../bower_components/app-layout/app-scroll-effects/app-scroll-effects.html">
<link rel="import" href="../../bower_components/app-layout/app-header/app-header.html">
<link rel="import" href="../../bower_components/app-layout/app-header-layout/app-header-layout.html">
<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../../bower_components/paper-item/paper-item.html">
<link rel="import" href="../../bower_components/paper-item/paper-item-body.html">
<link rel="import" href="../../bower_components/paper-card/paper-card.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../../bower_components/polymer/lib/elements/dom-if.html">
<link rel="import" href="../../bower_components/polymer/lib/elements/dom-repeat.html">
<dom-module id="build-status">
<template>
<style is="custom-style" include="iron-flex iron-flex-alignment">
<style>
.paper-item-link {
color: inherit;
text-decoration: none;
}
app-header {
background-color: #2ba4ad;
color: #fff;
}
paper-card {
margin: 0.5em;
}
paper-item {
cursor: pointer;
}
:host {
display: block;
}
.icon-error {
color: #e83030;
margin-right: 0.2em;
}
.projects {
min-width: 10em;
}
.log {
width: 80%;
display: inline;
}
pre {
white-space: pre-wrap;
}
</style>
<app-header reveals>
<app-toolbar>
<div main-title>OSS-Fuzz build status</div>
<div><small>(Updated every 30 minutes)</small></div>
</app-toolbar>
</app-header>
<div class="layout horizontal">
<paper-card class="projects">
<div class="card-content">
<template is="dom-repeat" items="[[status.projects]]" as="project">
<paper-item on-tap="onTap">
<paper-item-body two-line>
<div>
<template is="dom-if" if="[[!project.success]]">
<iron-icon class="icon-error" icon="icons:error"></iron-icon>
</template>
[[project.name]]
</div>
<div secondary>
Last built [[project.finish_time]]
<template is="dom-if" if="[[!project.success]]">
(failed)
</template>
</div>
</paper-item-body>
</paper-item>
</template>
</div>
</paper-card>
<paper-card class="log">
<div class="card-content">
<template is="dom-if" if="[[showMessage(loading_log, log)]]">
Select a project to see logs.
</template>
<template is="dom-if" if="[[loading_log]]">
Loading...
</template>
<template is="dom-if" if="[[showLog(log)]]">
<a href="/log-[[build_id]].txt" tabindex="-1">
<iron-icon icon="icons:link"></iron-iron>
</a>
</template>
<pre>[[log]]</pre>
</div>
</paper-card>
</div>
<iron-ajax auto handle-as="json" url="/status.json" on-response="onResponse"></iron-ajax>
<iron-ajax id="logxhr" auto handle-as="text" on-response="onLogResponse"></iron-ajax>
</template>
<script>
/** @polymerElement */
class BuildStatus extends Polymer.Element {
static get is() { return 'build-status'; }
static get properties() {
return {
log: {
type: String,
value: ''
},
loading_log: {
type: Boolean,
value: false
}
};
}
onResponse(e) {
this.status = e.detail.response;
}
onLogResponse(e) {
this.log = e.detail.response;
this.loading_log = false;
}
onTap(e) {
this.$.logxhr.url = "/log-" + e.model.project.build_id + ".txt";
this.build_id = e.model.project.build_id;
this.log = '';
this.loading_log = true;
}
showMessage(loading_log, log) {
return !loading_log && log === '';
}
showLog(log) {
return log !== '';
}
}
window.customElements.define(BuildStatus.is, BuildStatus);
</script>
</dom-module>