Skip to content

Commit

Permalink
[release-4.1] fix(secret): update error handling in validateImageRegi…
Browse files Browse the repository at this point in the history
…strySecret to use response data (#4376)

* fix(secret): update error handling in validateImageRegistrySecret to use response data

Signed-off-by: donniean <[email protected]>

* feat(secret): replace Button with StyledButton for improved styling in ImagerRegistry component

Signed-off-by: donniean <[email protected]>

---------

Signed-off-by: donniean <[email protected]>
Co-authored-by: donniean <[email protected]>
  • Loading branch information
ks-ci-bot and donniean authored Dec 20, 2024
1 parent 6d4c823 commit a01094d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -221,9 +222,9 @@ function ImagerRegistry(
onChange={handlePasswordChange}
autoComplete="new-password"
/>
<Button onClick={handleValidate} loading={isValidating}>
<StyledButton onClick={handleValidate} loading={isValidating}>
{t('VALIDATE')}
</Button>
</StyledButton>
</PasswordItem>
</Wrapper>
</Col>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
`;
4 changes: 2 additions & 2 deletions packages/shared/src/stores/secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit a01094d

Please sign in to comment.