blob: 9d2c3faf826d0b65a3810b32cdf2391f8bab8be7 [file] [log] [blame]
<!--
The fuzzer/res/fuzzer.js file must be included before this file.
This in an HTML Import-able file that contains the definition
of the following elements:
<fuzzer-collapse-file-sk>
This element will poll /json/list
To use this file import it:
<link href="/res/imp/fuzzer-collapse-file-sk.html" rel="import" />
Usage:
<fuzzer-collapse-file-sk></fuzzer-collapse-file-sk>
Properties:
file - The FileDetails object. Expected to have the following attributes:
fileName: String,
count: Number,
byFunction: Array of FunctionDetail objects. See fuzzer-collapse-function-sk.html for schema.
expand: String, which should be "true" if the element and any children should start expanded.
Methods:
setFile(file) - Programmatically set the FileDetails object.
Events:
None.
-->
<link rel="import" href="/res/common/imp/details-summary.html">
<link rel="import" href="/res/imp/bower_components/iron-collapse/iron-collapse.html">
<link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html">
<link rel="import" href="fuzzer-collapse-function-sk.html" />
<dom-module id="fuzzer-collapse-file-sk">
<template>
<style>
#file {
padding: 20px;
margin: 10px;
border-radius: 10px;
background-color: #F5F5F5;
color: #000000;
display:block;
}
.func {
padding: 20px;
border-radius: 10px;
background-color: #E5E5E5;
color: #000000;
display:block;
}
h3 {
display:inline;
margin-top: 0px;
}
ul {
list-style-type: none;
}
</style>
<details-sk id="file" open="{{expand}}">
<summary-sk>
<h3>
<a href$="{{_getDetailsLink(category, file)}}">{{file.fileName}}</a>
-- {{file.count}} crash-causing fuzzes
</h3>
</summary-sk>
<template is="dom-if" if="[[expand]]">
<template is="dom-repeat" items="{{file.byFunction}}" as="func" sort="_byCount">
<fuzzer-collapse-function-sk
class="func-group"
func="{{func}}"
details-base="{{_getDetailsLink(category, file)}}"
expand="[[expand]]" ></fuzzer-collapse-function-sk>
</template>
</template>
</details-sk>
</template>
<script>
Polymer({
is: 'fuzzer-collapse-file-sk',
properties: {
file: { //expected to be provided
type: Object,
value: function() {
return {};
},
},
category: {
type: String,
value: "",
},
// We can use one-way [[]] bindings to initialize all of the details-sk,
// but keep their open states untangled.
expand: {
type: Boolean,
value: false,
},
},
setFile: function(file) {
this.file = file;
},
_byCount: function(a, b) {
// Higher counts come first
return b.count - a.count;
},
_getDetailsLink: function(category, file, func) {
if (!file) {
return "#";
}
var base = fuzzer.getLinkToDetails("/category/"+category, "file", file.fileName);
if (func) {
base = fuzzer.getLinkToDetails(base, "func", func.functionName);
}
return base;
}
});
</script>
</dom-module>