Skip to content

Commit

Permalink
Merge pull request #13504 from cyril-ui-developer/page-fail-return-se…
Browse files Browse the repository at this point in the history
…cret-list

OCPBUGS-26566: Page fails to return to the Secrets list after clicking 'Cancel' on any Secret creation page
  • Loading branch information
openshift-merge-bot[bot] committed Feb 7, 2024
2 parents 210175b + 50a6af6 commit a9730e2
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions frontend/public/components/secrets/create-secret.tsx
Expand Up @@ -138,6 +138,7 @@ export const SecretFormWrapper: React.FC<BaseEditSecretProps_> = (props) => {
const { isCreate, modal, onCancel } = props;
const { t } = useTranslation();
const navigate = useNavigate();
const params = useParams();

const existingSecret = _.pick(props.obj, ['metadata', 'type']);
const defaultSecretType = toDefaultSecretType(props.secretTypeAbstraction);
Expand All @@ -163,7 +164,7 @@ export const SecretFormWrapper: React.FC<BaseEditSecretProps_> = (props) => {
const [base64StringData, setBase64StringData] = React.useState({});
const [disableForm, setDisableForm] = React.useState(false);

const defaultCancel = () => navigate(-1);
const cancel = () => navigate(`/k8s/ns/${params.ns}/core~v1~Secret`);

const onDataChanged = (secretsData) => {
setStringData({ ...secretsData?.stringData });
Expand Down Expand Up @@ -272,7 +273,7 @@ export const SecretFormWrapper: React.FC<BaseEditSecretProps_> = (props) => {
errorMessage={error || ''}
inProgress={inProgress}
submitText={t('public~Create')}
cancel={props.onCancel || defaultCancel}
cancel={onCancel || cancel}
/>
</form>
) : (
Expand All @@ -295,12 +296,7 @@ export const SecretFormWrapper: React.FC<BaseEditSecretProps_> = (props) => {
>
{props.saveButtonText || t('public~Create')}
</Button>
<Button
type="button"
variant="secondary"
id="cancel"
onClick={onCancel || defaultCancel}
>
<Button type="button" variant="secondary" id="cancel" onClick={onCancel || cancel}>
{t('public~Cancel')}
</Button>
</ActionGroup>
Expand Down

0 comments on commit a9730e2

Please sign in to comment.