Skip to content

Commit

Permalink
mirrorlist: put at least one element in the piechart
Browse files Browse the repository at this point in the history
  • Loading branch information
etix committed Nov 5, 2018
1 parent e731fee commit 26a3f96
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion templates/mirrorlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
{{end}}
<script type="text/javascript">
$(function() {
{{$filledchart := false}}
var mirrordistchartdata = [
{{range $i, $v := .MirrorList}}{{if $v.Weight}}{ label: '{{$v.ID}}', data: {{$v.Weight}}},{{end}}{{end}}
{{range $i, $v := .MirrorList -}}
{{if $v.Weight}}{{$filledchart = "yes"}}{ label: '{{$v.ID}}', data: {{$v.Weight}}},{{end}}
{{- end -}}
{{if not $filledchart}}{ label: 'Random', data: 100 },{{end}}
];
$.plot('#chart_div', mirrordistchartdata, {
series: {
Expand Down

0 comments on commit 26a3f96

Please sign in to comment.