Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
Signed-off-by: farodin91 <[email protected]>
  • Loading branch information
farodin91 committed Dec 7, 2024
1 parent 12851f2 commit 5c0ccb3
Show file tree
Hide file tree
Showing 23 changed files with 216 additions and 287 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/Sidebar/prepareRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ function prepareRoutes(
],
},
{
name: 'gateway',
name: 'gatewayapi',
label: t('glossary|Gateway'),
icon: 'mdi:lan-connect',
subList: [
{
name: 'k8sgateways',
name: 'gateways',
label: t('glossary|Gateways'),
},
{
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/components/gateway/ClassDetails.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ export default {
msw: {
handlers: {
storyBase: [
http.get(
'http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/gatewayclasses',
() => HttpResponse.error()
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/gatewayclasses', () =>
HttpResponse.error()
),
http.get('http://localhost:4466/api/v1/namespaces/default/events', () =>
HttpResponse.json({
Expand Down Expand Up @@ -51,7 +50,7 @@ Basic.parameters = {
handlers: {
story: [
http.get(
'http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/gatewayclasses/default-gateway-class',
'http://localhost:4466/apis/gateway.networking.k8s.io/v1/gatewayclasses/default-gateway-class',
() => HttpResponse.json(DEFAULT_GATEWAY_CLASS)
),
],
Expand Down
14 changes: 6 additions & 8 deletions frontend/src/components/gateway/ClassList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ export default {
msw: {
handlers: {
story: [
http.get(
'http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/gatewayclasses',
() =>
HttpResponse.json({
kind: 'GatewayClassList',
metadata: {},
items: [DEFAULT_GATEWAY_CLASS],
})
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/gatewayclasses', () =>
HttpResponse.json({
kind: 'GatewayClassList',
metadata: {},
items: [DEFAULT_GATEWAY_CLASS],
})
),
],
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/gateway/ClassList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export default function GatewayClassList() {
getValue: (gatewayClass: GatewayClass) =>
gatewayClass.status?.conditions?.find(
({ status }: { status: string }) => status === 'True'
) ?? null,
)?.type || null,
render: (gatewayClass: GatewayClass) =>
makeGatewayStatusLabel(gatewayClass.status?.conditions),
makeGatewayStatusLabel(gatewayClass.status?.conditions || null),
},
'age',
]}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/gateway/GRPCRouteDetails.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ export default {
msw: {
handlers: {
baseStory: [
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/grpcroutes', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/grpcroutes', () =>
HttpResponse.json({})
),
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/grpcroutes', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/grpcroutes', () =>
HttpResponse.error()
),
http.get('http://localhost:4466/api/v1/namespaces/default/events', () =>
Expand Down Expand Up @@ -57,7 +57,7 @@ Basic.parameters = {
handlers: {
story: [
http.get(
'http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/grpcroutes/default-grpcroute',
'http://localhost:4466/apis/gateway.networking.k8s.io/v1/grpcroutes/default-grpcroute',
() => HttpResponse.json(DEFAULT_GRPC_ROUTE)
),
],
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/gateway/GRPCRouteList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export default {
handlers: {
storyBase: [],
story: [
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/grpcroutes', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/grpcroutes', () =>
HttpResponse.json({
kind: 'GRPCRouteList',
metadata: {},
items: [DEFAULT_GRPC_ROUTE],
})
),
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/grpcroutes', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/grpcroutes', () =>
HttpResponse.error()
),
],
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/gateway/GatewayDetails.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ export default {
msw: {
handlers: {
baseStory: [
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/gateways', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/gateways', () =>
HttpResponse.json({})
),
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/gateways', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/gateways', () =>
HttpResponse.error()
),
http.get('http://localhost:4466/api/v1/namespaces/default/events', () =>
Expand Down Expand Up @@ -57,7 +57,7 @@ Basic.parameters = {
handlers: {
story: [
http.get(
'http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/gateways/default-gateway',
'http://localhost:4466/apis/gateway.networking.k8s.io/v1/gateways/default-gateway',
() => HttpResponse.json(DEFAULT_GATEWAY)
),
],
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/gateway/GatewayDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import { KubeCondition } from '../../lib/k8s/cluster';
import Gateway, {
GatewayAddress,
GatewayListener,
GatewayListenerStatus,
GatewayStatusAddress,
} from '../../lib/k8s/gateway';
import { EmptyContent, StatusLabel, StatusLabelProps } from '../common';
import Link from '../common/Link';
Expand Down Expand Up @@ -91,11 +91,11 @@ export default function GatewayDetails(props: { name?: string; namespace?: strin
columns={[
{
label: t('translation|Type'),
getter: (data: GatewayAddress) => data.type,
getter: (data: GatewayStatusAddress) => data.type,
},
{
label: t('translation|Value'),
getter: (data: GatewayAddress) => data.value,
getter: (data: GatewayStatusAddress) => data.value,
},
]}
data={item?.getAddresses() || []}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/gateway/GatewayList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export default {
handlers: {
storyBase: [],
story: [
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/gateways', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/gateways', () =>
HttpResponse.json({
kind: 'GatewayList',
metadata: {},
items: [DEFAULT_GATEWAY],
})
),
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/gateways', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/gateways', () =>
HttpResponse.error()
),
],
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/components/gateway/GatewayList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ export default function GatewayList() {
id: 'conditions',
label: t('translation|Conditions'),
getValue: (gateway: Gateway) =>
gateway.status?.conditions?.find(
({ status }: { status: string }) => status === 'True'
) ?? null,
render: (gateway: Gateway) => makeGatewayStatusLabel(gateway.status?.conditions),
gateway.status?.conditions?.find(({ status }: { status: string }) => status === 'True')
?.type || null,
render: (gateway: Gateway) => makeGatewayStatusLabel(gateway.status?.conditions || null),
},
{
id: 'listeners',
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/gateway/HTTPRouteDetails.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ export default {
msw: {
handlers: {
baseStory: [
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/httproutes', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/httproutes', () =>
HttpResponse.json({})
),
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/httproutes', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/httproutes', () =>
HttpResponse.error()
),
http.get('http://localhost:4466/api/v1/namespaces/default/events', () =>
Expand Down Expand Up @@ -57,7 +57,7 @@ Basic.parameters = {
handlers: {
story: [
http.get(
'http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/httproutes/default-httproute',
'http://localhost:4466/apis/gateway.networking.k8s.io/v1/httproutes/default-httproute',
() => HttpResponse.json(DEFAULT_HTTP_ROUTE)
),
],
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/components/gateway/HTTPRouteDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ function HTTPRouteRuleTable(props: { rule: HTTPRouteRule }) {
const { t } = useTranslation(['glossary', 'translation']);

const mainRows = [
{
name: rule.name,
withHighlightStyle: true,
hide: rule.name === undefined,
},
{
name: t('translation|BackendRefs'),
value: rule.backendRefs?.length,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/gateway/HTTPRouteList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export default {
handlers: {
storyBase: [],
story: [
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/httproutes', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/httproutes', () =>
HttpResponse.json({
kind: 'HTTPRouteList',
metadata: {},
items: [DEFAULT_HTTP_ROUTE],
})
),
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1beta1/httproutes', () =>
http.get('http://localhost:4466/apis/gateway.networking.k8s.io/v1/httproutes', () =>
HttpResponse.error()
),
],
Expand Down
Loading

0 comments on commit 5c0ccb3

Please sign in to comment.