blob: f8aa0be2b658c6c7bf46c7d6df4ea07960e9f308 [file] [log] [blame]
<!-- The <fuzzer-status-sk> element displays the status of the fuzzer
Attributes:
None
Events:
None
Methods:
None
-->
<link rel="import" href="/res/imp/bower_components/iron-ajax/iron-ajax.html">
<dom-module id="fuzzer-status-sk">
<template>
<style>
:host{
color: #000000;
}
</style>
<div>
Last Commit In Fuzz: <a href$="{{_getLink(current)}}" target="_blank">{{_getShortHash(current)}}
- {{_getAuthor(current)}}</a>
</div>
<div>
Updated: {{last_updated}} ago
</div>
<template is="dom-if" if="{{pending}}">
<div>
Update in progress: <a href$="{{_getLink(pending)}}" target="_blank">{{_getShortHash(pending)}}
- {{_getAuthor(pending)}}</a>
</div>
</template>
<iron-ajax auto url="/json/status" handle-as="json" last-response="{{_status}}"></iron-ajax>
</template>
<script>
Polymer({
is: "fuzzer-status-sk",
properties: {
_status: {
type: Object,
value: function() {
return {
current: {
hash: "Loading",
author: "loading (Loading)"
},
pending: {}
};
}
},
current: {
type: Object,
computed: "_getCurrent(_status)"
},
last_updated: {
type: String,
computed: "_getLastUpdated(_status)"
},
pending: {
type: Object,
computed: "_getPending(_status)"
}
},
_getCurrent: function(status){
return status.current;
},
_getLastUpdated: function(status){
return sk.human.diffDate(status.lastUpdated);
},
_getPending: function(status){
// Empty object is not considered falsey, so we check to see if it is empty.
if (!status.pending || !status.pending.hash) {
return undefined;
}
return status.pending;
},
_getShortHash: function(status) {
return status.hash.substr(0, 7);
},
_getAuthor: function(status) {
var a = status.author;
var idx = a.indexOf('(');
return a.substring(0, (idx === -1) ? a.length : idx);
},
_getLink:function(status) {
return "https://skia.googlesource.com/skia/+/" + status.hash;
}
});
</script>
</dom-module>