Skip to content

Commit

Permalink
fix a small issue
Browse files Browse the repository at this point in the history
Signed-off-by: farodin91 <[email protected]>
  • Loading branch information
farodin91 committed Dec 12, 2024
1 parent e8b9bc5 commit 61975b7
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 32 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/gateway/HTTPRouteDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function HTTPRouteDetails(props: { name?: string; namespace?: str
httpRoute && [
{
name: 'Hostnames',
value: <LabelListItem labels={httpRoute.hostnames?.map(tls => `${tls}`)} />,
value: <LabelListItem labels={httpRoute.hostnames.map(tls => `${tls}`)} />,
},
]
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/gateway/HTTPRouteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function HTTPRouteList() {
{
id: 'rules',
label: t('translation|rules'),
getValue: (httpRoute: HTTPRoute) => httpRoute.spec.rules.length,
getValue: (httpRoute: HTTPRoute) => httpRoute.spec.rules?.length,
},
'age',
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h1
class="MuiTypography-root MuiTypography-h1 MuiTypography-noWrap css-yeaech-MuiTypography-root"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h1
class="MuiTypography-root MuiTypography-h1 MuiTypography-noWrap css-yeaech-MuiTypography-root"
>
GRPCRoute
GRPCRoute: default-httproute
</h1>
<div
class="MuiBox-root css-ldp2l3"
Expand Down Expand Up @@ -187,7 +187,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h2
class="MuiTypography-root MuiTypography-h2 MuiTypography-noWrap css-m5vcfd-MuiTypography-root"
Expand Down Expand Up @@ -351,7 +351,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h2
class="MuiTypography-root MuiTypography-h2 MuiTypography-noWrap css-m5vcfd-MuiTypography-root"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h1
class="MuiTypography-root MuiTypography-h1 MuiTypography-noWrap css-yeaech-MuiTypography-root"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h1
class="MuiTypography-root MuiTypography-h1 MuiTypography-noWrap css-yeaech-MuiTypography-root"
>
Gateway
Gateway: default-gateway
</h1>
<div
class="MuiBox-root css-ldp2l3"
Expand Down Expand Up @@ -202,7 +202,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h2
class="MuiTypography-root MuiTypography-h2 MuiTypography-noWrap css-m5vcfd-MuiTypography-root"
Expand Down Expand Up @@ -251,7 +251,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h2
class="MuiTypography-root MuiTypography-h2 MuiTypography-noWrap css-m5vcfd-MuiTypography-root"
Expand Down Expand Up @@ -342,7 +342,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h2
class="MuiTypography-root MuiTypography-h2 MuiTypography-noWrap css-m5vcfd-MuiTypography-root"
Expand Down Expand Up @@ -391,7 +391,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h2
class="MuiTypography-root MuiTypography-h2 MuiTypography-noWrap css-m5vcfd-MuiTypography-root"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h1
class="MuiTypography-root MuiTypography-h1 MuiTypography-noWrap css-yeaech-MuiTypography-root"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h1
class="MuiTypography-root MuiTypography-h1 MuiTypography-noWrap css-yeaech-MuiTypography-root"
>
HTTPRoute
HTTPRoute: default-httproute
</h1>
<div
class="MuiBox-root css-ldp2l3"
Expand Down Expand Up @@ -203,7 +203,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h2
class="MuiTypography-root MuiTypography-h2 MuiTypography-noWrap css-m5vcfd-MuiTypography-root"
Expand Down Expand Up @@ -254,7 +254,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h2
class="MuiTypography-root MuiTypography-h2 MuiTypography-noWrap css-m5vcfd-MuiTypography-root"
Expand Down Expand Up @@ -303,7 +303,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h2
class="MuiTypography-root MuiTypography-h2 MuiTypography-noWrap css-m5vcfd-MuiTypography-root"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
>
<div
class="MuiBox-root css-70qvj9"
class="MuiBox-root css-15xsm7k"
>
<h1
class="MuiTypography-root MuiTypography-h1 MuiTypography-noWrap css-yeaech-MuiTypography-root"
Expand Down
18 changes: 15 additions & 3 deletions frontend/src/i18n/locales/zh-tw/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,22 @@
"Port": "端口",
"Protocol": "協定",
"Endpoints": "端點",
"Controller Name": "",
"Gateway Classes": "",
"Controller": "控制器",
"Class Name": "類別名稱",
"Addresses": "",
"Listeners": "",
"No data": "",
"Gateways": "",
"GRPCRoutes": "",
"Rules": "規則",
"HttpRoutes": "",
"Hostnames": "",
"Horizontal Pod Autoscalers": "水平 Pod 自動擴縮",
"Ingress Classes": "Ingress 類別",
"Default Ingress Class": "預設 Ingress 類別",
"Controller": "控制器",
"Default Backend": "預設後端",
"Class Name": "類別名稱",
"Rules": "規則",
"Backends": "後端",
"Ingresses": "Ingresses",
"Hosts": "主機",
Expand Down Expand Up @@ -165,6 +174,9 @@
"Persistent Volumes": "持續性卷",
"Storage Classes": "儲存類別",
"Network": "網路",
"Gateway": "",
"HTTP Routes": "",
"GRPC Routes": "",
"Security": "安全",
"Configuration": "配置",
"HPAs": "水平 Pod 自動擴縮",
Expand Down
15 changes: 13 additions & 2 deletions frontend/src/i18n/locales/zh-tw/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,19 @@
"Current": "當前",
"Desired//context:pods": "期望",
"Addresses": "地址",
"Hostname": "",
"Port": "",
"Protocol": "",
"No addresses data to be shown.": "",
"Listeners": "",
"BackendRefs": "",
"Matches": "",
"rules": "",
"ParentRefs": "",
"No rules data to be shown.": "無規則數據顯示。",
"Namespace": "命名空間",
"Kind": "",
"Section Name": "",
"Search": "搜索",
"Press<1>/</1>to search": "按<1>/</1>搜索",
"Search resources, pages, clusters by name": "按名稱搜索資源、頁面、叢集",
Expand All @@ -338,7 +351,6 @@
"Targets": "目標",
"more…": "更多…",
"Default": "預設",
"No rules data to be shown.": "無規則數據顯示。",
"Host": "主機",
"Path": "路徑",
"Duration": "持續時間",
Expand Down Expand Up @@ -393,7 +405,6 @@
"Zoom out": "縮小",
"No data to be shown. Try to change filters or select a different namespace.": "無數據顯示。嘗試更改篩選器或選擇不同的命名空間。",
"Group By: {{ name }}": "分組:{{ name }}",
"Namespace": "命名空間",
"Instance": "實例",
"Node": "節點",
"Status: Error or Warning": "狀態:錯誤或警告",
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/lib/k8s/httpRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export interface HTTPRouteRule {
*/
export interface KubeHTTPRoute extends KubeObjectInterface {
spec: {
hostnames: string[];
parentRefs: GatewayParentReference[];
rules: HTTPRouteRule[];
hostnames?: string[];
parentRefs?: GatewayParentReference[];
rules?: HTTPRouteRule[];
[key: string]: any;
};
}
Expand All @@ -42,15 +42,15 @@ class HTTPRoute extends KubeObject<KubeHTTPRoute> {
}

get hostnames(): string[] {
return this.jsonData.spec.hostnames;
return this.jsonData.spec.hostnames || [];
}

get rules(): HTTPRouteRule[] {
return this.jsonData.spec.rules;
return this.jsonData.spec.rules || [];
}

get parentRefs(): GatewayParentReference[] {
return this.jsonData.spec.parentRefs;
return this.jsonData.spec.parentRefs || [];
}

static get pluralName() {
Expand Down

0 comments on commit 61975b7

Please sign in to comment.