Skip to content

Commit 125ed1d

Browse files
committed
better managment of the kubectl info in the kubernetes page for the live refresh and more information is now display in the page
1 parent f2b4c60 commit 125ed1d

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

AzureDevOpsTeamMembersVelocity/Pages/KubernetesDashboard.razor

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
@if (Error != null)
44
{
5-
<ul class="list-group mb-3">
5+
<ul class="list-group mb-3 alert-fixed">
66
<li class="list-group-item list-group-item-danger">@Error</li>
77
</ul>
88
}
@@ -26,6 +26,7 @@
2626
<th>Name</th>
2727
<th>Creation time</th>
2828
<th>Phase</th>
29+
<th>Latest condition</th>
2930
<th></th>
3031
</tr>
3132
</thead>
@@ -36,6 +37,7 @@
3637
<td>@ns.Metadata.Name</td>
3738
<td>@ns.Metadata.CreationTimestamp</td>
3839
<td>@ns.Status.Phase</td>
40+
<td>@ns.Status.Conditions?.OrderByDescending(c => c.LastTransitionTime).FirstOrDefault()?.Message</td>
3941
<td>
4042
<button id="@string.Concat("ns-", ns.Metadata.Name)"
4143
@@ -69,6 +71,8 @@
6971
<th>Creation time</th>
7072
<th>Ready</th>
7173
<th>Unavailable</th>
74+
<th>Latest condition type</th>
75+
<th>Latest condition message</th>
7276
<th></th>
7377
</tr>
7478
</thead>
@@ -77,12 +81,15 @@
7781
{
7882
var deploymentNamespace = deployment.Namespace();
7983
var deploymentName = deployment.Name();
84+
var latestCondition = @deployment.Status.Conditions?.OrderByDescending(c => c.LastUpdateTime).FirstOrDefault();
8085

8186
<tr>
8287
<td>@deployment.Metadata.Name</td>
8388
<td>@deployment.Metadata.CreationTimestamp</td>
8489
<td>@deployment.Status.ReadyReplicas</td>
8590
<td>@deployment.Status.UnavailableReplicas</td>
91+
<td>@latestCondition?.Type</td>
92+
<td>@latestCondition?.Message</td>
8693
<td>
8794
<input id="@string.Concat(deploymentNamespace, deploymentName)"
8895
@@ -115,6 +122,7 @@
115122
<th>Creation time</th>
116123
<th>Phase</th>
117124
<th>Reason</th>
125+
<th>Latest condition type</th>
118126
<th>Select</th>
119127
</tr>
120128
</thead>
@@ -129,6 +137,7 @@
129137
<td>@pod.Metadata.CreationTimestamp</td>
130138
<td>@pod.Status.Phase</td>
131139
<td>@pod.Status.Reason</td>
140+
<td>@pod.Status.Conditions?.OrderByDescending(c => c.LastTransitionTime).FirstOrDefault()?.Type</td>
132141
<td>
133142
<input id="@string.Concat(podNamespace, podName)"
134143

AzureDevOpsTeamMembersVelocity/Pages/KubernetesDashboard.razor.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ await deploymentChannel.OnMessageRecieved(async deployment =>
221221
return;
222222
}
223223

224-
var key = $"{deployment.Item2.Metadata.NamespaceProperty}-{deployment.Item2.Metadata.Name}";
224+
var key = $"{deployment.Item2.Namespace()}-{deployment.Item2.Name()}";
225225

226226
switch (deployment.Item1)
227227
{
@@ -283,8 +283,8 @@ await podChannel.OnMessageRecieved(async pod =>
283283
return;
284284
}
285285

286-
var @namespace = pod.Item2.Metadata.NamespaceProperty;
287-
var podName = pod.Item2.Metadata.Name;
286+
var @namespace = pod.Item2.Namespace();
287+
var podName = pod.Item2.Name();
288288
var key = $"{@namespace}-{pod.Item2.Metadata.Name}";
289289

290290
switch (pod.Item1)
@@ -340,15 +340,15 @@ await podChannel.OnMessageRecieved(async pod =>
340340

341341
if (TokensBag.TryGetValue(taskKey, out var token))
342342
{
343-
if (pod.Item2.Status.Phase == "Succeded" ||
343+
if (pod.Item2.Status.Phase == "Succeeded" ||
344344
pod.Item2.Status.Phase == "Failed")
345345
{
346346
token.Cancel();
347347

348348
TokensBag.Remove(taskKey);
349349
}
350350
else if (pod.Item2.Status.Phase == "Running" ||
351-
pod.Item2.Status.Phase == "Pending")
351+
pod.Item2.Status.Phase == "Pending")
352352
{
353353
Logger.LogInformation("Get metadata update on a pod that listen to logs");
354354
}
@@ -361,7 +361,7 @@ await podChannel.OnMessageRecieved(async pod =>
361361
}
362362
else
363363
{
364-
if (pod.Item2.Status.Phase == "Succeded" ||
364+
if (pod.Item2.Status.Phase == "Succeeded" ||
365365
pod.Item2.Status.Phase == "Failed")
366366
{
367367
Logger.LogInformation("Get metadata update on a pod that listen to logs, but the pod is not ready for listening to logs");
@@ -411,15 +411,18 @@ private async Task OnPodLogClick(ChangeEventArgs args, string podNamespace, stri
411411
{
412412
var taskKey = PodLogsTaskKey(podNamespace, podName);
413413

414-
if (TokensBag.TryGetValue(taskKey, out var tokenSourceCancellation))
414+
if (((bool?)args.Value) == true)
415415
{
416-
tokenSourceCancellation.Cancel();
417-
418-
TokensBag.Remove(taskKey);
416+
await ListenTopPodLogs(taskKey, podNamespace, podName);
419417
}
420418
else
421419
{
422-
await ListenTopPodLogs(taskKey, podNamespace, podName);
420+
if (TokensBag.TryGetValue(taskKey, out var tokenSourceCancellation))
421+
{
422+
tokenSourceCancellation.Cancel();
423+
424+
TokensBag.Remove(taskKey);
425+
}
423426
}
424427
}
425428

AzureDevOpsTeamMembersVelocity/wwwroot/css/site.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,13 @@ textarea {
8585
.textarea-big {
8686
height: 500px;
8787
width: 800px;
88+
}
89+
90+
.alert-fixed {
91+
position: fixed;
92+
top: 0px;
93+
left: 0px;
94+
width: 100%;
95+
z-index: 9999;
96+
border-radius: 0px
8897
}

0 commit comments

Comments
 (0)