From 341b63c61c4706c2420d43d9b2aa949bcc814b07 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 22 Mar 2025 01:07:28 +0530 Subject: [PATCH] feat: updated frontend to make reviewer jwt optional --- frontend/src/hooks/api/identities/types.ts | 4 +-- .../IdentityKubernetesAuthForm.tsx | 10 +++--- .../ViewIdentityKubernetesAuthContent.tsx | 34 +++++++++++-------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/frontend/src/hooks/api/identities/types.ts b/frontend/src/hooks/api/identities/types.ts index 00dd13d55..35a9870bc 100644 --- a/frontend/src/hooks/api/identities/types.ts +++ b/frontend/src/hooks/api/identities/types.ts @@ -350,7 +350,7 @@ export type AddIdentityKubernetesAuthDTO = { organizationId: string; identityId: string; kubernetesHost: string; - tokenReviewerJwt: string; + tokenReviewerJwt?: string; allowedNamespaces: string; allowedNames: string; allowedAudience: string; @@ -367,7 +367,7 @@ export type UpdateIdentityKubernetesAuthDTO = { organizationId: string; identityId: string; kubernetesHost?: string; - tokenReviewerJwt?: string; + tokenReviewerJwt?: string | null; allowedNamespaces?: string; allowedNames?: string; allowedAudience?: string; diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx index 4d25590a1..87dc7dbfd 100644 --- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx +++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx @@ -31,7 +31,7 @@ import { IdentityFormTab } from "./types"; const schema = z .object({ kubernetesHost: z.string().min(1), - tokenReviewerJwt: z.string().min(1), + tokenReviewerJwt: z.string().optional(), allowedNames: z.string(), allowedNamespaces: z.string(), allowedAudience: z.string(), @@ -166,7 +166,7 @@ export const IdentityKubernetesAuthForm = ({ await updateMutateAsync({ organizationId: orgId, kubernetesHost, - tokenReviewerJwt, + tokenReviewerJwt: tokenReviewerJwt || null, allowedNames, allowedNamespaces, allowedAudience, @@ -182,7 +182,7 @@ export const IdentityKubernetesAuthForm = ({ organizationId: orgId, identityId, kubernetesHost: kubernetesHost || "", - tokenReviewerJwt, + tokenReviewerJwt: tokenReviewerJwt || undefined, allowedNames: allowedNames || "", allowedNamespaces: allowedNamespaces || "", allowedAudience: allowedAudience || "", @@ -255,11 +255,11 @@ export const IdentityKubernetesAuthForm = ({ name="tokenReviewerJwt" render={({ field, fieldState: { error } }) => ( diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityKubernetesAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityKubernetesAuthContent.tsx index b34c058b6..da0455160 100644 --- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityKubernetesAuthContent.tsx +++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityKubernetesAuthContent.tsx @@ -70,20 +70,26 @@ export const ViewIdentityKubernetesAuthContent = ({ {data.kubernetesHost} - {data.tokenReviewerJwt}

- } - > -
- - - Reveal - -
-
+ {data.tokenReviewerJwt ? ( + + {data.tokenReviewerJwt || "Not provided"} +

+ } + > +
+ + + Reveal + +
+
+ ) : ( +

Not set

+ )}
{data.allowedNames