diff --git a/portal-ui/src/screens/Console/Support/ApiKeyRegister.tsx b/portal-ui/src/screens/Console/Support/ApiKeyRegister.tsx index 043d2558f..fbbb0d313 100644 --- a/portal-ui/src/screens/Console/Support/ApiKeyRegister.tsx +++ b/portal-ui/src/screens/Console/Support/ApiKeyRegister.tsx @@ -30,11 +30,12 @@ import { spacingUtils } from "../Common/FormComponents/common/styleLibrary"; import { Theme } from "@mui/material/styles"; import createStyles from "@mui/styles/createStyles"; import withStyles from "@mui/styles/withStyles"; +import { useNavigate } from "react-router-dom"; +import { IAM_PAGES } from "../../../common/SecureComponent/permissions"; interface IApiKeyRegister { classes: any; registerEndpoint: string; - afterRegister: () => void; } const styles = (theme: Theme) => @@ -45,11 +46,9 @@ const styles = (theme: Theme) => ...spacingUtils, }); -const ApiKeyRegister = ({ - classes, - registerEndpoint, - afterRegister, -}: IApiKeyRegister) => { +const ApiKeyRegister = ({ classes, registerEndpoint }: IApiKeyRegister) => { + const navigate = useNavigate(); + const [showApiKeyModal, setShowApiKeyModal] = useState(false); const [apiKey, setApiKey] = useState(""); const [loading, setLoading] = useState(false); @@ -67,8 +66,7 @@ const ApiKeyRegister = ({ .then((resp: SubnetLoginResponse) => { setLoading(false); if (resp && resp.registered) { - reset(); - afterRegister(); + navigate(IAM_PAGES.LICENSE); } }) .catch((err: ErrorResponseHandler) => { @@ -76,7 +74,7 @@ const ApiKeyRegister = ({ setLoading(false); reset(); }); - }, [afterRegister, apiKey, dispatch, loading, registerEndpoint]); + }, [apiKey, dispatch, loading, registerEndpoint, navigate]); useEffect(() => { if (fromModal) { diff --git a/portal-ui/src/screens/Console/Support/ClusterRegistrationForm.tsx b/portal-ui/src/screens/Console/Support/ClusterRegistrationForm.tsx new file mode 100644 index 000000000..d9f420738 --- /dev/null +++ b/portal-ui/src/screens/Console/Support/ClusterRegistrationForm.tsx @@ -0,0 +1,116 @@ +// This file is part of MinIO Console Server +// Copyright (c) 2023 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +import React from "react"; +import { Box } from "@mui/material"; +import { FormTitle } from "./utils"; +import SelectWrapper from "../Common/FormComponents/SelectWrapper/SelectWrapper"; +import { setLoading, setSelectedSubnetOrganization } from "./registerSlice"; +import { Button } from "mds"; +import RegisterHelpBox from "./RegisterHelpBox"; +import { useSelector } from "react-redux"; +import { AppState, useAppDispatch } from "../../../store"; +import { callRegister } from "./registerThunks"; + +const ClusterRegistrationForm = () => { + const dispatch = useAppDispatch(); + + const subnetAccessToken = useSelector( + (state: AppState) => state.register.subnetAccessToken + ); + const selectedSubnetOrganization = useSelector( + (state: AppState) => state.register.selectedSubnetOrganization + ); + const subnetOrganizations = useSelector( + (state: AppState) => state.register.subnetOrganizations + ); + const loading = useSelector((state: AppState) => state.register.loading); + + return ( + + + + + + + + dispatch(setSelectedSubnetOrganization(e.target.value as string)) + } + label="Select an organization" + value={selectedSubnetOrganization} + options={subnetOrganizations.map((organization) => ({ + label: organization.company, + value: organization.accountId.toString(), + }))} + /> + +