Skip to content

Commit

Permalink
Add commands table to command details
Browse files Browse the repository at this point in the history
  • Loading branch information
Tzvonimir committed Mar 29, 2024
1 parent 5f1c6fb commit 70c2290
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions resources/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ func commandHandler(w http.ResponseWriter, r *http.Request) {
"CommandsJSON": commandsJson,
"StartTime": start,
"EndTime": end,
"Commands": commands,
}); err != nil {
showError(w)
}
Expand Down
25 changes: 25 additions & 0 deletions resources/views/command.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<title>Command Execution Dashboard</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/2.0.3/css/dataTables.dataTables.min.css">
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://cdn.datatables.net/2.0.3/js/dataTables.js"></script>
</head>
<body class="p-5 bg-gray-50">
<div class="flex justify-end">
Expand Down Expand Up @@ -36,9 +39,31 @@
<canvas id="commandsExecutionTime"></canvas>
</div>
</div>
<div class="overflow-x-auto mt-8">
<table id="commandsTable" class="stripe" style="width:100%">
<thead>
<tr>
<th>Category</th>
<th>Command</th>
<th>Execution Time</th>
</tr>
</thead>
<tbody>
{{range .Commands}}
<tr>
<td>{{.Category}}</td>
<td>{{.Command}}</td>
<td>{{.ExecutionTime}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</body>
<script>
(async function () {
new DataTable('#commandsTable');

const commandsData = `{{.CommandsJSON}}`;

function isDataEmpty(data) {
Expand Down

0 comments on commit 70c2290

Please sign in to comment.