Skip to content

Commit

Permalink
Merge pull request #10 from medyagh/order_num
Browse files Browse the repository at this point in the history
add order num and alternative background color
  • Loading branch information
medyagh authored Dec 1, 2020
2 parents 4172df5 + 24ffd86 commit 8b54a05
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
15 changes: 8 additions & 7 deletions pkg/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ type TestEvent struct {
}

type TestGroup struct {
TestName string
Hidden bool
Status string
Start time.Time
End time.Time
Duration float64
Events []TestEvent
TestName string
TestOrder int
Hidden bool
Status string
Start time.Time
End time.Time
Duration float64
Events []TestEvent
}
3 changes: 3 additions & 0 deletions pkg/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ func Generate(report models.ReportDetail, groups []models.TestGroup) (DisplayCon
var passedTests []models.TestGroup
var failedTests []models.TestGroup
var skippedTests []models.TestGroup
order := 0
for _, g := range groups {
order = order + 1
g.Duration = g.Events[len(g.Events)-1].Elapsed
if !g.Hidden {
g.TestOrder = order
if g.Status == pass {
passedTests = append(passedTests, g)
}
Expand Down
12 changes: 11 additions & 1 deletion pkg/template/report3.css
Original file line number Diff line number Diff line change
Expand Up @@ -8478,5 +8478,15 @@ h3 {
margin-left:40px;
margin-bottom:40px;
}


tr:nth-child(even) {
background-color: #EDEDED;
}

th {
background-color: black;
color: white;
font-weight: bolder;
}

{{end}}
6 changes: 4 additions & 2 deletions pkg/template/report3.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,23 @@ <h2 class="mdl-card__title-text">Test {{$resultType}} ({{ len $results }}/{{ $.T
<table id="{{$resultType}}dummy" class="duration_table">
<thead>
<tr>
<th data-sort-default style="text-align:left;text-transform: capitalize;">Order</th>
<th style="text-align:left;text-transform: capitalize;">{{$resultType}}ed test</th>
<th data-sort-default>Duration</th>
<th >Duration</th>
</tr>
</thead>
<tbody>
{{range $i,$r :=$results}}
<tr>
<td>{{$r.TestOrder}} </td>
<td><a href="#{{$resultType}}_{{ $r.TestName }}">{{ $r.TestName }}</a> </td>
<td> {{$r.Duration}}</td>
</tr>
{{end}}
</tbody>
</table>
<script>
new Tablesort(document.getElementById('{{$resultType}}dummy'), {descending: true});
new Tablesort(document.getElementById('{{$resultType}}dummy'), {descending: false});
</script>
</div>

Expand Down

0 comments on commit 8b54a05

Please sign in to comment.