Skip to content

Commit a1ac6e5

Browse files
committed
add delete pod button and a more reactive pod search
1 parent d4a44eb commit a1ac6e5

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

AzureDevOpsTeamMembersVelocity/Pages/KubernetesDashboard.razor

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@
119119
type="text"
120120
class="form-control"
121121
placeholder="Search pods"
122-
@bind="SearchPods" />
122+
@bind="SearchPods"
123+
@bind:event="oninput" />
123124
<div class="input-group-append">
124125
<button class="btn btn-outline-secondary"
125126
type="button"
@@ -142,6 +143,7 @@
142143
<th>Reason</th>
143144
<th>Latest condition type</th>
144145
<th>Select</th>
146+
<th></th>
145147
</tr>
146148
</thead>
147149
<tbody>
@@ -163,6 +165,14 @@
163165
class="form-check"
164166
@onchange="async (changeEventArg) => await OnPodLogClick(changeEventArg, podNamespace, podName)" />
165167
</td>
168+
<td>
169+
<button id='@string.Concat("pod-", podName)'
170+
title="btn-delete-ns-@podNamespace"
171+
class="btn btn-danger"
172+
@onclick="@(async (mea) => await DeletePod(pod))">
173+
Delete
174+
</button>
175+
</td>
166176
</tr>
167177
}
168178
</tbody>

AzureDevOpsTeamMembersVelocity/Pages/KubernetesDashboard.razor.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,19 @@ private async Task DeleteNamespace(V1Namespace ns)
525525
}
526526
}
527527

528+
private async Task DeletePod(V1Pod pod)
529+
{
530+
try
531+
{
532+
await Client.DeleteNamespacedPodAsync(pod.Name(), pod.Namespace(), new V1DeleteOptions());
533+
}
534+
catch (Exception e)
535+
{
536+
Error = e.Message;
537+
Logger.LogError(e, e.Message);
538+
}
539+
}
540+
528541
private void ClearLogs()
529542
{
530543
try

0 commit comments

Comments
 (0)