From 33a987c8cd8d91e7bd20a5374c392da0edbabb55 Mon Sep 17 00:00:00 2001 From: donniean <12584040+donniean@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:08:03 +0800 Subject: [PATCH] fix(secret): update error handling in validateImageRegistrySecret to use response data (#4375) * fix(secret): update error handling in validateImageRegistrySecret to use response data Signed-off-by: donniean * feat(secret): replace Button with StyledButton for improved styling in ImagerRegistry component Signed-off-by: donniean --------- Signed-off-by: donniean --- .../components/SecretSettings/ImagerRegistry/index.tsx | 7 ++++--- .../components/SecretSettings/ImagerRegistry/styles.ts | 8 ++++++++ packages/shared/src/stores/secret.ts | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 packages/console/src/pages/clusters/components/SecretSettings/ImagerRegistry/styles.ts diff --git a/packages/console/src/pages/clusters/components/SecretSettings/ImagerRegistry/index.tsx b/packages/console/src/pages/clusters/components/SecretSettings/ImagerRegistry/index.tsx index 9ed5ba0ee50..ba87762f3b1 100644 --- a/packages/console/src/pages/clusters/components/SecretSettings/ImagerRegistry/index.tsx +++ b/packages/console/src/pages/clusters/components/SecretSettings/ImagerRegistry/index.tsx @@ -6,7 +6,8 @@ import React, { useEffect, useState, forwardRef, useImperativeHandle, Ref } from 'react'; import { Success } from '@kubed/icons'; import { debounce, get, has, set } from 'lodash'; -import { Alert, Button, Col, Input, InputPassword, Row } from '@kubed/components'; +import { Alert, Col, Input, InputPassword, Row } from '@kubed/components'; +import { StyledButton } from './styles'; import { safeBtoa, clusterStore, parser, secretStore } from '@ks-console/shared'; @@ -221,9 +222,9 @@ function ImagerRegistry( onChange={handlePasswordChange} autoComplete="new-password" /> - + diff --git a/packages/console/src/pages/clusters/components/SecretSettings/ImagerRegistry/styles.ts b/packages/console/src/pages/clusters/components/SecretSettings/ImagerRegistry/styles.ts new file mode 100644 index 00000000000..d99ed03eac4 --- /dev/null +++ b/packages/console/src/pages/clusters/components/SecretSettings/ImagerRegistry/styles.ts @@ -0,0 +1,8 @@ +import styled from 'styled-components'; +import { Button } from '@kubed/components'; + +export const StyledButton = styled(Button)` + width: auto !important; + min-width: 72px; + padding: 0; +`; diff --git a/packages/shared/src/stores/secret.ts b/packages/shared/src/stores/secret.ts index c37daa95bdd..36dca6c4788 100644 --- a/packages/shared/src/stores/secret.ts +++ b/packages/shared/src/stores/secret.ts @@ -64,10 +64,10 @@ const validateImageRegistrySecret = async ({ }; await request - .post(url, fedFormTemplate, {}) + .post(url, fedFormTemplate, { headers: { 'x-ignore-error-notify': 'true' } }) .then() .catch((err: any) => { - const msg = get(err, 'message', ''); + const msg = get(err, 'response.data', ''); if (msg) { result.reason = t(msg); }