Skip to content

Commit

Permalink
dashboard: Replace three-step sed replace by proper template replace
Browse files Browse the repository at this point in the history
  • Loading branch information
okurz committed Sep 23, 2016
1 parent 561160e commit 09ccd41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
15 changes: 12 additions & 3 deletions bin/dashboard
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ decrease_header() {
closed_html=$($OPENQA_REVIEW $GLOBAL_PARAMS --save --save-dir="$tmp" -f closed | decrease_header | markdown)
unassigned_html=$($OPENQA_REVIEW $GLOBAL_PARAMS --load --load-dir="$tmp" -f unassigned | decrease_header | markdown)

sed '/TPL_OPENQA_CONTENT/q' $TPL | head -n -1 > $OUT
cat >> $OUT <<EOF
TPL_OPENQA_HEADER_LINKS='
<p><a href="#closed_box">» Closed bugs</a></p>
<p><a href="#unassigned_box">» Unassigned bugs</a></p>
'
TPL_OPENQA_CONTENT=$(cat <<EOF
<div class="panel panel-default" id="closed_box">
<div class="panel-heading" style="font-weight: bold;">
Closed Bugs
Expand All @@ -42,5 +45,11 @@ cat >> $OUT <<EOF
</div>
</div>
EOF
)

eval "cat <<EOF
$(<$TPL)
EOF
" 2> /dev/null > $OUT


sed '1,/TPL_OPENQA_CONTENT/d' $TPL >> $OUT
5 changes: 2 additions & 3 deletions dashboard_files/dashboard.html.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
<div class="col-md-10">
<h2>openQA review report for openqa.suse.de</h2>

<p><a href="#closed_box">» Closed bugs</a></p>
<p><a href="#unassigned_box">» Unassigned bugs</a></p>
${TPL_OPENQA_HEADER_LINKS}

</div>

Expand All @@ -78,7 +77,7 @@
</div>
</div>

TPL_OPENQA_CONTENT
${TPL_OPENQA_CONTENT}

</div>

Expand Down

0 comments on commit 09ccd41

Please sign in to comment.