All checks were successful
continuous-integration/drone/push Build is passing
85 lines
3.2 KiB
Plaintext
85 lines
3.2 KiB
Plaintext
package views
|
|
|
|
import (
|
|
"strconv"
|
|
"mocksnow/components/core"
|
|
tpl "github.com/a-h/templ"
|
|
)
|
|
|
|
type IncidentRow struct {
|
|
ID int64
|
|
ExternalID string
|
|
CreatedAt string
|
|
IncidentNumber string
|
|
Description string
|
|
ShortDescription string
|
|
Urgency int64
|
|
Impact int64
|
|
State int64
|
|
AllNotes string
|
|
AssignmentGroup string
|
|
AssignedTo string
|
|
Category string
|
|
SubCategory string
|
|
SysID string
|
|
}
|
|
|
|
templ IncidentsTable(rows []IncidentRow) {
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
@core.Header()
|
|
<body>
|
|
<main>
|
|
<div>
|
|
<h1 class="text-5xl mt-4 font-bold">Incidents</h1>
|
|
<div>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Created At</th>
|
|
<th>Incident #</th>
|
|
<th>SysId</th>
|
|
<th>Description</th>
|
|
<th>Short Description</th>
|
|
<th>Urgency</th>
|
|
<th>Impact</th>
|
|
<th>State</th>
|
|
<th>External ID</th>
|
|
<th>Work Notes</th>
|
|
<th>Assignment Group</th>
|
|
<th>Assigned To</th>
|
|
<th>Category</th>
|
|
<th>Subcategory</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
for _, row := range rows {
|
|
<tr>
|
|
<td>{ strconv.FormatInt(row.ID, 10) }</td>
|
|
<td>{ row.CreatedAt }</td>
|
|
<td>{ row.IncidentNumber }</td>
|
|
<td>{ row.SysID }</td>
|
|
<td>{ row.Description }</td>
|
|
<td>{ row.ShortDescription }</td>
|
|
<td>{ strconv.FormatInt(row.Urgency, 10) }</td>
|
|
<td>{ strconv.FormatInt(row.Impact, 10) }</td>
|
|
<td>{ strconv.FormatInt(row.State, 10) }</td>
|
|
<td>{ row.ExternalID }</td>
|
|
<td>@tpl.Raw(row.AllNotes)</td>
|
|
<td>{ row.AssignmentGroup }</td>
|
|
<td>{ row.AssignedTo }</td>
|
|
<td>{ row.Category }</td>
|
|
<td>{ row.SubCategory }</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
@core.Footer()
|
|
</body>
|
|
</html>
|
|
} |