Skip to content

Commit 698f72f

Browse files
authored
Migrated Register page components to mds (#3034)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
1 parent 8dd94f5 commit 698f72f

File tree

14 files changed

+485
-978
lines changed

14 files changed

+485
-978
lines changed

portal-ui/src/screens/Console/Common/FormComponents/InputUnitMenu/InputUnitMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ import React, { Fragment } from "react";
1818
import { Theme } from "@mui/material/styles";
1919
import createStyles from "@mui/styles/createStyles";
2020
import withStyles from "@mui/styles/withStyles";
21-
import { selectorTypes } from "../SelectWrapper/SelectWrapper";
21+
import { SelectorType } from "mds";
2222
import { Menu, MenuItem } from "@mui/material";
2323

2424
interface IInputUnitBox {
2525
classes: any;
2626
id: string;
2727
unitSelected: string;
28-
unitsList: selectorTypes[];
28+
unitsList: SelectorType[];
2929
disabled?: boolean;
3030
onUnitChange?: (newValue: string) => void;
3131
}

portal-ui/src/screens/Console/Common/FormComponents/SelectWrapper/SelectWrapper.tsx

Lines changed: 0 additions & 144 deletions
This file was deleted.

portal-ui/src/screens/Console/Support/ApiKeyRegister.tsx

Lines changed: 56 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,27 @@
1414
// You should have received a copy of the GNU Affero General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

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";
2420
import { SubnetLoginRequest, SubnetLoginResponse } from "../License/types";
25-
import api from "../../../common/api";
2621
import { useAppDispatch } from "../../../store";
2722
import {
2823
setErrorSnackMessage,
2924
setServerNeedsRestart,
3025
} from "../../../systemSlice";
3126
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";
3728
import { IAM_PAGES } from "../../../common/SecureComponent/permissions";
29+
import GetApiKeyModal from "./GetApiKeyModal";
30+
import RegisterHelpBox from "./RegisterHelpBox";
31+
import api from "../../../common/api";
3832

3933
interface IApiKeyRegister {
40-
classes: any;
4134
registerEndpoint: string;
4235
}
4336

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) => {
5338
const navigate = useNavigate();
5439

5540
const [showApiKeyModal, setShowApiKeyModal] = useState(false);
@@ -92,108 +77,66 @@ const ApiKeyRegister = ({ classes, registerEndpoint }: IApiKeyRegister) => {
9277
};
9378

9479
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+
>
9687
<Box
9788
sx={{
98-
"& .title-text": {
99-
marginLeft: "27px",
100-
fontWeight: 600,
101-
},
89+
fontSize: 14,
90+
display: "flex",
91+
flexFlow: "column",
92+
marginBottom: "30px",
10293
}}
10394
>
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.
10896
</Box>
10997
<Box
11098
sx={{
111-
display: "flex",
112-
flexFlow: {
113-
xs: "column",
114-
md: "row",
115-
},
99+
flex: "1",
116100
}}
117101
>
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+
/>
155111

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+
/>
192128
</Box>
193-
<RegisterHelpBox />
194129
</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>
196139
);
197140
};
198141

199-
export default withStyles(styles)(ApiKeyRegister);
142+
export default ApiKeyRegister;

0 commit comments

Comments
 (0)