Skip to content

Commit

Permalink
update listener
Browse files Browse the repository at this point in the history
  • Loading branch information
weibaohui committed Jul 9, 2024
1 parent 450961d commit f7b6906
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 24 deletions.
7 changes: 6 additions & 1 deletion BlazorApp/Pages/Gateway/GrpcRoute/GrpcRouteIndex.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using BlazorApp.Pages.Common
@using BlazorApp.Pages.Common.Html.HTable
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Pages.Gateway.Share
@using BlazorApp.Utils
@using Entity.Crd.Gateway
@using k8s.Models
Expand Down Expand Up @@ -38,7 +39,11 @@
</AntDesign.Column>
<AntDesign.Column Field="@context.Namespace()" Title="@L["Namespace"]" Width="110px"/>


<AntDesign.Column Title=@L["Gateway"] TData="string" Width="150px">
<ParentRefSimpleView ns="@context.Namespace()"
ParentRefs="@context.Spec.ParentRefs">
</ParentRefSimpleView>
</AntDesign.Column>
<AntDesign.Column Title=@L["Hostname"] TData="string">
@if (context.Spec.Hostnames is { Count: > 0 })
{
Expand Down
31 changes: 31 additions & 0 deletions BlazorApp/Pages/Gateway/HttpRoute/HttpRouteDetailView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,37 @@
<PropertySimpleView Title="@L["Type"]" Item="@item.Type"
ExplainField="httpRoute.spec.rules.filters.type">
</PropertySimpleView>
<PropertySimpleView Title="@L["URLRewrite"]" Item="@item.URLRewrite"
ExplainField="httpRoute.spec.rules.filters.uRLRewrite">

<GridRow Class="grid-table">
<GridCol Span="6">Hostname</GridCol>
<GridCol Span="6">Type</GridCol>
<GridCol Span="6">PrefixMatch</GridCol>
<GridCol Span="6">Path</GridCol>
</GridRow>
<GridRow Class="grid-table">
<GridCol Span="6">@item.URLRewrite.Hostname</GridCol>
<GridCol Span="6">
@if (item.URLRewrite.Path is not null)
{
@item.URLRewrite.Path.Type
}
</GridCol>
<GridCol Span="6">
@if (item.URLRewrite.Path is not null)
{
@item.URLRewrite.Path.ReplacePrefixMatch
}
</GridCol>
<GridCol Span="6">
@if (item.URLRewrite.Path is not null)
{
@item.URLRewrite.Path.ReplaceFullPath
}
</GridCol>
</GridRow>
</PropertySimpleView>
<PropertySimpleView Title="@L["ExtensionRef"]" Item="@item.ExtensionRef"
ExplainField="httpRoute.spec.rules.filters.extensionRef">

Expand Down
38 changes: 18 additions & 20 deletions BlazorApp/Pages/Gateway/HttpRoute/HttpRouteIndex.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using BlazorApp.Pages.Common
@using BlazorApp.Pages.Common.Html.HTable
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Pages.Gateway.Share
@using BlazorApp.Utils
@using Entity.Crd.Gateway
@using k8s.Models
Expand Down Expand Up @@ -38,15 +39,9 @@
</AntDesign.Column>
<AntDesign.Column Field="@context.Namespace()" Title="@L["Namespace"]" Width="110px"/>
<AntDesign.Column Title=@L["Gateway"] TData="string" Width="150px">
@if (context.Spec.ParentRefs is { Count: > 0 })
{
foreach (var parent in context.Spec.ParentRefs)
{
<RefView OnlyName
Ref="@KubeHelper.GetObjectRef(parent.Kind, context.Metadata.Namespace(), parent.Name)">
</RefView>
}
}
<ParentRefSimpleView ns="@context.Namespace()"
ParentRefs="@context.Spec.ParentRefs">
</ParentRefSimpleView>
</AntDesign.Column>
<AntDesign.Column Title=@L["Hostname"] TData="string" Width="150px">
@if (context.Spec.Hostnames is { Count: > 0 })
Expand Down Expand Up @@ -79,18 +74,21 @@
</GridRow>
foreach (var rule in context.Spec.Rules)
{
foreach (var backendRef in rule.BackendRefs)
if (rule.BackendRefs is { Count: > 0 })
{
<GridRow Class="grid-table">
<GridCol Span="4">@backendRef.Weight</GridCol>
<GridCol Span="10">@backendRef.Name</GridCol>
<GridCol Span="4">@backendRef.Port</GridCol>
<GridCol Span="6">
<RefView
Ref="@KubeHelper.GetObjectRef(backendRef.Kind, context.Metadata.Namespace(), backendRef.Name)">
</RefView>
</GridCol>
</GridRow>
foreach (var backendRef in rule.BackendRefs)
{
<GridRow Class="grid-table">
<GridCol Span="4">@backendRef.Weight</GridCol>
<GridCol Span="10">@backendRef.Name</GridCol>
<GridCol Span="4">@backendRef.Port</GridCol>
<GridCol Span="6">
<RefView
Ref="@KubeHelper.GetObjectRef(backendRef.Kind, context.Metadata.Namespace(), backendRef.Name)">
</RefView>
</GridCol>
</GridRow>
}
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions BlazorApp/Pages/Gateway/Share/ParentRefSimpleView.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@using BlazorApp.Pages.Common
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Utils
@using Entity.Crd.Gateway
@if (ParentRefs is { Count: > 0 })
{
foreach (var parent in ParentRefs)
{
<RefView OnlyName
Ref="@KubeHelper.GetObjectRef(parent.Kind, ns, parent.Name)">
</RefView>
@if (parent.SectionName is not null)
{
<ColorfulTag>@parent.SectionName</ColorfulTag>
}
}
}

@code {
[Parameter] public string ns { get; set; }
[Parameter] public IList<ParentReference> ParentRefs { get; set; }
}
7 changes: 6 additions & 1 deletion BlazorApp/Pages/Gateway/TcpRoute/TcpRouteIndex.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using BlazorApp.Pages.Common
@using BlazorApp.Pages.Common.Html.HTable
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Pages.Gateway.Share
@using BlazorApp.Utils
@using Entity.Crd.Gateway
@using k8s.Models
Expand Down Expand Up @@ -37,7 +38,11 @@
<Button OnClick="@(() => OnItemNameClick(context))" Type="@ButtonType.Link">@context.Name()</Button>
</AntDesign.Column>
<AntDesign.Column Field="@context.Namespace()" Title="@L["Namespace"]" Width="110px"/>

<AntDesign.Column Title=@L["Gateway"] TData="string" Width="150px">
<ParentRefSimpleView ns="@context.Namespace()"
ParentRefs="@context.Spec.ParentRefs">
</ParentRefSimpleView>
</AntDesign.Column>
<AntDesign.Column Title=@L["Rules"] TData="string" Width="420px">
@if (context.Spec.Rules is { Count: > 0 })
{
Expand Down
8 changes: 7 additions & 1 deletion BlazorApp/Pages/Gateway/TlsRoute/TlsRouteIndex.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using BlazorApp.Pages.Common
@using BlazorApp.Pages.Common.Html.HTable
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Pages.Gateway.Share
@using Entity.Crd.Gateway
@using k8s.Models
@inherits BlazorApp.Pages.Common.TableBase<Entity.Crd.Gateway.V1Alpha2TLSRoute>
Expand Down Expand Up @@ -35,6 +36,11 @@
<Button OnClick="@(() => OnItemNameClick(context))" Type="@ButtonType.Link">@context.Name()</Button>
</AntDesign.Column>
<AntDesign.Column Field="@context.Namespace()" Title="@L["Namespace"]" Width="110px"/>
<AntDesign.Column Title=@L["Gateway"] TData="string" Width="150px">
<ParentRefSimpleView ns="@context.Namespace()"
ParentRefs="@context.Spec.ParentRefs">
</ParentRefSimpleView>
</AntDesign.Column>
<AntDesign.Column Title="@L["Age"]" TData="string" Width="100px">
<AgeView Age="@context.CreationTimestamp()"></AgeView>
</AntDesign.Column>
Expand All @@ -46,4 +52,4 @@
</HTr>
</HTable>
<ResourceWatcher OnResourceChanged="OnResourceChanged" T="V1Alpha2TLSRoute"></ResourceWatcher>
}
}
8 changes: 7 additions & 1 deletion BlazorApp/Pages/Gateway/UdpRoute/UdpRouteIndex.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using BlazorApp.Pages.Common
@using BlazorApp.Pages.Common.Html.HTable
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Pages.Gateway.Share
@using Entity.Crd.Gateway
@using k8s.Models
@inherits BlazorApp.Pages.Common.TableBase<Entity.Crd.Gateway.V1Alpha2UDPRoute>
Expand Down Expand Up @@ -35,6 +36,11 @@
<Button OnClick="@(() => OnItemNameClick(context))" Type="@ButtonType.Link">@context.Name()</Button>
</AntDesign.Column>
<AntDesign.Column Field="@context.Namespace()" Title="@L["Namespace"]" Width="110px"/>
<AntDesign.Column Title=@L["Gateway"] TData="string" Width="150px">
<ParentRefSimpleView ns="@context.Namespace()"
ParentRefs="@context.Spec.ParentRefs">
</ParentRefSimpleView>
</AntDesign.Column>
<AntDesign.Column Title="@L["Age"]" TData="string" Width="100px">
<AgeView Age="@context.CreationTimestamp()"></AgeView>
</AntDesign.Column>
Expand All @@ -46,4 +52,4 @@
</HTr>
</HTable>
<ResourceWatcher OnResourceChanged="OnResourceChanged" T="V1Alpha2UDPRoute"></ResourceWatcher>
}
}

0 comments on commit f7b6906

Please sign in to comment.