Skip to content

Commit 9a0703f

Browse files
committed
Refactor HTTP handlers to enforce POST method for scale, rollout, delete-machine, and delete-pod endpoints
Signed-off-by: Artiom Diomin <artiom@kubermatic.com>
1 parent 714e6e1 commit 9a0703f

3 files changed

Lines changed: 317 additions & 206 deletions

File tree

pkg/dashboard/components.templ

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ templ NodesTable(nodes []node) {
130130
</div>
131131
}
132132

133+
templ RolloutButton(md machineDeployment) {
134+
<form method="POST" action="/rollout" hx-post="/rollout" hx-target="body" hx-swap="outerHTML">
135+
<input type="hidden" name="namespace" value={ md.Namespace }/>
136+
<input type="hidden" name="name" value={ md.Name }/>
137+
<button type="submit" class="btn btn-outline-warning btn-sm" title="Force rollout">
138+
<i class="bi bi-arrow-repeat me-1"></i>Rollout
139+
</button>
140+
</form>
141+
}
142+
133143
templ ScaleButtons(md machineDeployment) {
134144
<div class="d-flex align-items-center gap-2">
135145
<form method="POST" action="/scale" hx-post="/scale" hx-target="body" hx-swap="outerHTML">
@@ -163,8 +173,7 @@ templ MachineDeploymentsTable(machineDeployments []machineDeployment) {
163173
<th scope="col">Namespace</th>
164174
<th scope="col">Replicas</th>
165175
<th scope="col">Available</th>
166-
<th scope="col">Scale</th>
167-
<th scope="col">Kubelet</th>
176+
<th scope="col">Scale</th> <th scope="col">Rollout</th> <th scope="col">Kubelet</th>
168177
<th scope="col">Age</th>
169178
</tr>
170179
</thead>
@@ -182,11 +191,12 @@ templ MachineDeploymentsTable(machineDeployments []machineDeployment) {
182191
<td>{ fmt.Sprintf("%d", md.AvailableReplicas) }</td>
183192
<td>@ScaleButtons(md)
184193
</td>
194+
<td>@RolloutButton(md)</td>
185195
<td>{ md.Kubelet }</td>
186196
<td>{ md.Age.String() }</td>
187197
</tr>
188198
<tr>
189-
<td colspan="7" class="p-0">
199+
<td colspan="9" class="p-0">
190200
<h5 class="p-2 m-0">Machines</h5>
191201
@MachinesTable(md.Machines)
192202
</td>

0 commit comments

Comments
 (0)