|
14 | 14 | // You should have received a copy of the GNU Affero General Public License
|
15 | 15 | // along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16 | 16 |
|
17 |
| -import React, { Fragment, useCallback, useEffect, useState } from "react"; |
18 |
| -import { Box } from "@mui/material"; |
19 |
| -import { Button, OnlineRegistrationIcon } from "mds"; |
20 |
| -import { FormTitle } from "./utils"; |
21 |
| -import InputBoxWrapper from "../Common/FormComponents/InputBoxWrapper/InputBoxWrapper"; |
22 |
| -import GetApiKeyModal from "./GetApiKeyModal"; |
23 |
| -import RegisterHelpBox from "./RegisterHelpBox"; |
| 17 | +import React, { useCallback, useEffect, useState } from "react"; |
| 18 | +import { Box, Button, FormLayout, InputBox, OnlineRegistrationIcon } from "mds"; |
| 19 | +import { useNavigate } from "react-router-dom"; |
24 | 20 | import { SubnetLoginRequest, SubnetLoginResponse } from "../License/types";
|
25 |
| -import api from "../../../common/api"; |
26 | 21 | import { useAppDispatch } from "../../../store";
|
27 | 22 | import {
|
28 | 23 | setErrorSnackMessage,
|
29 | 24 | setServerNeedsRestart,
|
30 | 25 | } from "../../../systemSlice";
|
31 | 26 | import { ErrorResponseHandler } from "../../../common/types";
|
32 |
| -import { spacingUtils } from "../Common/FormComponents/common/styleLibrary"; |
33 |
| -import { Theme } from "@mui/material/styles"; |
34 |
| -import createStyles from "@mui/styles/createStyles"; |
35 |
| -import withStyles from "@mui/styles/withStyles"; |
36 |
| -import { useNavigate } from "react-router-dom"; |
| 27 | +import { modalStyleUtils } from "../Common/FormComponents/common/styleLibrary"; |
37 | 28 | import { IAM_PAGES } from "../../../common/SecureComponent/permissions";
|
| 29 | +import GetApiKeyModal from "./GetApiKeyModal"; |
| 30 | +import RegisterHelpBox from "./RegisterHelpBox"; |
| 31 | +import api from "../../../common/api"; |
38 | 32 |
|
39 | 33 | interface IApiKeyRegister {
|
40 |
| - classes: any; |
41 | 34 | registerEndpoint: string;
|
42 | 35 | }
|
43 | 36 |
|
44 |
| -const styles = (theme: Theme) => |
45 |
| - createStyles({ |
46 |
| - sizedLabel: { |
47 |
| - minWidth: "75px", |
48 |
| - }, |
49 |
| - ...spacingUtils, |
50 |
| - }); |
51 |
| - |
52 |
| -const ApiKeyRegister = ({ classes, registerEndpoint }: IApiKeyRegister) => { |
| 37 | +const ApiKeyRegister = ({ registerEndpoint }: IApiKeyRegister) => { |
53 | 38 | const navigate = useNavigate();
|
54 | 39 |
|
55 | 40 | const [showApiKeyModal, setShowApiKeyModal] = useState(false);
|
@@ -92,108 +77,66 @@ const ApiKeyRegister = ({ classes, registerEndpoint }: IApiKeyRegister) => {
|
92 | 77 | };
|
93 | 78 |
|
94 | 79 | return (
|
95 |
| - <Fragment> |
| 80 | + <FormLayout |
| 81 | + title={"Register cluster with API key"} |
| 82 | + icon={<OnlineRegistrationIcon />} |
| 83 | + containerPadding={false} |
| 84 | + withBorders={false} |
| 85 | + helpBox={<RegisterHelpBox />} |
| 86 | + > |
96 | 87 | <Box
|
97 | 88 | sx={{
|
98 |
| - "& .title-text": { |
99 |
| - marginLeft: "27px", |
100 |
| - fontWeight: 600, |
101 |
| - }, |
| 89 | + fontSize: 14, |
| 90 | + display: "flex", |
| 91 | + flexFlow: "column", |
| 92 | + marginBottom: "30px", |
102 | 93 | }}
|
103 | 94 | >
|
104 |
| - <FormTitle |
105 |
| - icon={<OnlineRegistrationIcon />} |
106 |
| - title={`Register cluster with API key`} |
107 |
| - /> |
| 95 | + Use your MinIO Subscription Network API Key to register this cluster. |
108 | 96 | </Box>
|
109 | 97 | <Box
|
110 | 98 | sx={{
|
111 |
| - display: "flex", |
112 |
| - flexFlow: { |
113 |
| - xs: "column", |
114 |
| - md: "row", |
115 |
| - }, |
| 99 | + flex: "1", |
116 | 100 | }}
|
117 | 101 | >
|
118 |
| - <Box |
119 |
| - sx={{ |
120 |
| - display: "flex", |
121 |
| - flexFlow: "column", |
122 |
| - flex: "2", |
123 |
| - }} |
124 |
| - > |
125 |
| - <Box |
126 |
| - sx={{ |
127 |
| - fontSize: "16px", |
128 |
| - display: "flex", |
129 |
| - flexFlow: "column", |
130 |
| - marginTop: "30px", |
131 |
| - marginBottom: "30px", |
132 |
| - }} |
133 |
| - > |
134 |
| - Use your MinIO Subscription Network API Key to register this |
135 |
| - cluster. |
136 |
| - </Box> |
137 |
| - <Box |
138 |
| - sx={{ |
139 |
| - flex: "1", |
140 |
| - }} |
141 |
| - > |
142 |
| - <InputBoxWrapper |
143 |
| - className={classes.spacerBottom} |
144 |
| - classes={{ |
145 |
| - inputLabel: classes.sizedLabel, |
146 |
| - }} |
147 |
| - id="api-key" |
148 |
| - name="api-key" |
149 |
| - onChange={(event: React.ChangeEvent<HTMLInputElement>) => |
150 |
| - setApiKey(event.target.value) |
151 |
| - } |
152 |
| - label="API Key" |
153 |
| - value={apiKey} |
154 |
| - /> |
| 102 | + <InputBox |
| 103 | + id="api-key" |
| 104 | + name="api-key" |
| 105 | + onChange={(event: React.ChangeEvent<HTMLInputElement>) => |
| 106 | + setApiKey(event.target.value) |
| 107 | + } |
| 108 | + label="API Key" |
| 109 | + value={apiKey} |
| 110 | + /> |
155 | 111 |
|
156 |
| - <Box |
157 |
| - sx={{ |
158 |
| - display: "flex", |
159 |
| - alignItems: "center", |
160 |
| - justifyContent: "flex-end", |
161 |
| - "& button": { |
162 |
| - marginLeft: "8px", |
163 |
| - }, |
164 |
| - }} |
165 |
| - > |
166 |
| - <Button |
167 |
| - id={"get-from-subnet"} |
168 |
| - variant="regular" |
169 |
| - className={classes.spacerRight} |
170 |
| - disabled={loading} |
171 |
| - onClick={() => setShowApiKeyModal(true)} |
172 |
| - label={"Get from SUBNET"} |
173 |
| - /> |
174 |
| - <Button |
175 |
| - id={"register"} |
176 |
| - type="submit" |
177 |
| - variant="callAction" |
178 |
| - disabled={loading || apiKey.trim().length === 0} |
179 |
| - onClick={() => onRegister()} |
180 |
| - label={"Register"} |
181 |
| - /> |
182 |
| - <GetApiKeyModal |
183 |
| - open={showApiKeyModal} |
184 |
| - closeModal={() => setShowApiKeyModal(false)} |
185 |
| - onSet={(value) => { |
186 |
| - setApiKey(value); |
187 |
| - setFromModal(true); |
188 |
| - }} |
189 |
| - /> |
190 |
| - </Box> |
191 |
| - </Box> |
| 112 | + <Box sx={modalStyleUtils.modalButtonBar}> |
| 113 | + <Button |
| 114 | + id={"get-from-subnet"} |
| 115 | + variant="regular" |
| 116 | + disabled={loading} |
| 117 | + onClick={() => setShowApiKeyModal(true)} |
| 118 | + label={"Get from SUBNET"} |
| 119 | + /> |
| 120 | + <Button |
| 121 | + id={"register"} |
| 122 | + type="submit" |
| 123 | + variant="callAction" |
| 124 | + disabled={loading || apiKey.trim().length === 0} |
| 125 | + onClick={() => onRegister()} |
| 126 | + label={"Register"} |
| 127 | + /> |
192 | 128 | </Box>
|
193 |
| - <RegisterHelpBox /> |
194 | 129 | </Box>
|
195 |
| - </Fragment> |
| 130 | + <GetApiKeyModal |
| 131 | + open={showApiKeyModal} |
| 132 | + closeModal={() => setShowApiKeyModal(false)} |
| 133 | + onSet={(value) => { |
| 134 | + setApiKey(value); |
| 135 | + setFromModal(true); |
| 136 | + }} |
| 137 | + /> |
| 138 | + </FormLayout> |
196 | 139 | );
|
197 | 140 | };
|
198 | 141 |
|
199 |
| -export default withStyles(styles)(ApiKeyRegister); |
| 142 | +export default ApiKeyRegister; |
0 commit comments