Skip to content

Commit be60569

Browse files
authored
Changed Object Browser components to use new mds components (#2796)
1 parent 51226a7 commit be60569

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1187
-1506
lines changed

portal-ui/src/StyleHandler.tsx

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
Theme,
2121
ThemeProvider,
2222
} from "@mui/material/styles";
23-
import withStyles from "@mui/styles/withStyles";
2423
import theme from "./theme/main";
2524
import "react-virtualized/styles.css";
2625
import "react-grid-layout/css/styles.css";
@@ -46,48 +45,19 @@ const StyleHandler = ({ children }: IStyleHandler) => {
4645
(state: AppState) => state.system.overrideStyles
4746
);
4847

49-
let thm = theme;
50-
let globalBody: any = {};
51-
let rowColor: any = { color: "#393939" };
52-
let detailsListPanel: any = { backgroundColor: "#fff" };
48+
let thm = undefined;
5349

5450
if (colorVariants) {
5551
thm = generateOverrideTheme(colorVariants);
56-
57-
globalBody = {
58-
backgroundColor: `${colorVariants.backgroundColor}!important`,
59-
};
60-
rowColor = { color: `${colorVariants.fontColor}!important` };
61-
detailsListPanel = {
62-
backgroundColor: colorVariants.backgroundColor,
63-
color: colorVariants.fontColor,
64-
};
6552
}
6653

67-
// Kept for Compatibility purposes. Once mds migration is complete then this will be removed
68-
const GlobalCss = withStyles({
69-
// @global is handled by jss-plugin-global.
70-
"@global": {
71-
body: {
72-
...globalBody,
73-
},
74-
".rowLine": {
75-
...rowColor,
76-
},
77-
".detailsListPanel": {
78-
...detailsListPanel,
79-
},
80-
},
81-
})(() => null);
82-
8354
// ThemeHandler is needed for MDS components theming. Eventually we will remove Theme Provider & use only mds themes.
8455
return (
8556
<Fragment>
8657
<GlobalStyles />
87-
<GlobalCss />
8858
<StyledEngineProvider injectFirst>
89-
<ThemeProvider theme={thm}>
90-
<ThemeHandler>{children}</ThemeHandler>
59+
<ThemeProvider theme={theme}>
60+
<ThemeHandler customTheme={thm}>{children}</ThemeHandler>
9161
</ThemeProvider>
9262
</StyledEngineProvider>
9363
</Fragment>

portal-ui/src/common/types.ts

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,58 @@ export interface IBytesCalc {
4848
}
4949

5050
export interface IEmbeddedCustomButton {
51-
backgroundColor?: string;
52-
textColor?: string;
53-
hoverColor?: string;
54-
hoverText?: string;
55-
activeColor?: string;
56-
activeText?: string;
51+
backgroundColor: string;
52+
textColor: string;
53+
hoverColor: string;
54+
hoverText: string;
55+
activeColor: string;
56+
activeText: string;
57+
disabledColor: string;
58+
disabledText: string;
59+
}
60+
61+
export interface IEmbeddedCustomTable {
62+
border: string;
63+
disabledBorder: string;
64+
disabledBG: string;
65+
selected: string;
66+
deletedDisabled: string;
67+
hoverColor: string;
68+
}
69+
70+
export interface IEmbeddedInputBox {
71+
border: string;
72+
hoverBorder: string;
73+
textColor: string;
74+
backgroundColor: string;
75+
}
76+
77+
export interface IEmbeddedSwitch {
78+
switchBackground: string;
79+
bulletBorderColor: string;
80+
bulletBGColor: string;
81+
disabledBackground: string;
82+
disabledBulletBorderColor: string;
83+
disabledBulletBGColor: string;
5784
}
5885

5986
export interface IEmbeddedCustomStyles {
6087
backgroundColor: string;
6188
fontColor: string;
89+
secondaryFontColor: string;
90+
borderColor: string;
91+
loaderColor: string;
92+
boxBackground: string;
93+
okColor: string;
94+
errorColor: string;
95+
warnColor: string;
96+
linkColor: string;
97+
disabledLinkColor: string;
98+
hoverLinkColor: string;
99+
tableColors: IEmbeddedCustomTable;
62100
buttonStyles: IEmbeddedCustomButton;
101+
secondaryButtonStyles: IEmbeddedCustomButton;
102+
regularButtonStyles: IEmbeddedCustomButton;
103+
inputBox: IEmbeddedInputBox;
104+
switch: IEmbeddedSwitch;
63105
}

portal-ui/src/index.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ code {
1212

1313
/* Chrome, Safari, Edge, Opera */
1414
input.removeArrows::-webkit-outer-spin-button,
15-
input.removeArrows::-webkit-inner-spin-button {
15+
input.removeArrows::-webkit-inner-spin-button,
16+
.removeArrows input::-webkit-outer-spin-button,
17+
.removeArrows input::-webkit-inner-spin-button {
1618
-webkit-appearance: none;
1719
margin: 0;
1820
}
1921

2022
/* Firefox */
21-
input.removeArrows[type="number"] {
23+
input.removeArrows[type="number"],
24+
.removeArrows input[type="number"] {
2225
-moz-appearance: textfield;
2326
}

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/ActionsListSection.tsx

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

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/CreatePathModal.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616

1717
import React, { useEffect, useState } from "react";
1818
import { useNavigate } from "react-router-dom";
19-
import { Button, CreateNewPathIcon } from "mds";
19+
import { Button, CreateNewPathIcon, InputBox, Grid } from "mds";
2020
import ModalWrapper from "../../../../Common/ModalWrapper/ModalWrapper";
21-
import { Grid } from "@mui/material";
22-
import InputBoxWrapper from "../../../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
2321
import { Theme } from "@mui/material/styles";
2422
import createStyles from "@mui/styles/createStyles";
2523
import {
@@ -155,7 +153,7 @@ const CreatePathModal = ({
155153
</div>
156154
</Grid>
157155
<Grid item xs={12} className={classes.formFieldRow}>
158-
<InputBoxWrapper
156+
<InputBox
159157
value={pathUrl}
160158
label={"New Folder Path"}
161159
id={"folderPath"}

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/DeleteMultipleObjects.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
import React, { Fragment, useState } from "react";
18-
import { DialogContentText } from "@mui/material";
19-
2018
import { ErrorResponseHandler } from "../../../../../../common/types";
2119
import useApi from "../../../../Common/Hooks/useApi";
2220
import ConfirmDialog from "../../../../Common/ModalWrapper/ConfirmDialog";
23-
import { ConfirmDeleteIcon } from "mds";
24-
import FormSwitchWrapper from "../../../../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper";
25-
21+
import { ConfirmDeleteIcon, Switch } from "mds";
2622
import { setErrorSnackMessage } from "../../../../../../systemSlice";
2723
import { AppState, useAppDispatch } from "../../../../../../store";
2824
import { hasPermission } from "../../../../../../common/SecureComponent";
@@ -113,14 +109,14 @@ const DeleteObject = ({
113109
onConfirm={onConfirmDelete}
114110
onClose={onClose}
115111
confirmationContent={
116-
<DialogContentText>
112+
<Fragment>
117113
Are you sure you want to delete the selected {selectedObjects.length}{" "}
118114
objects?{" "}
119115
{isVersionedDelete && (
120116
<Fragment>
121117
<br />
122118
<br />
123-
<FormSwitchWrapper
119+
<Switch
124120
label={"Delete All Versions"}
125121
indicatorLabels={["Yes", "No"]}
126122
checked={deleteVersions}
@@ -139,7 +135,7 @@ const DeleteObject = ({
139135
marginTop: 10,
140136
}}
141137
>
142-
<FormSwitchWrapper
138+
<Switch
143139
label={"Bypass Governance Mode"}
144140
indicatorLabels={["Yes", "No"]}
145141
checked={bypassGovernance}
@@ -176,7 +172,7 @@ const DeleteObject = ({
176172
)}
177173
</Fragment>
178174
)}
179-
</DialogContentText>
175+
</Fragment>
180176
}
181177
/>
182178
);

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/DeleteNonCurrent.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@
1616

1717
import React, { Fragment, useEffect, useState } from "react";
1818

19-
import { DialogContentText } from "@mui/material";
20-
import Grid from "@mui/material/Grid";
2119
import { ErrorResponseHandler } from "../../../../../../common/types";
2220
import { decodeURLString } from "../../../../../../common/utils";
23-
import { ConfirmDeleteIcon } from "mds";
21+
import { ConfirmDeleteIcon, Switch, Grid, InputBox } from "mds";
2422
import ConfirmDialog from "../../../../Common/ModalWrapper/ConfirmDialog";
2523
import api from "../../../../../../common/api";
26-
import InputBoxWrapper from "../../../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
2724
import { setErrorSnackMessage } from "../../../../../../systemSlice";
2825
import { AppState, useAppDispatch } from "../../../../../../store";
29-
import FormSwitchWrapper from "../../../../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper";
3026
import { hasPermission } from "../../../../../../common/SecureComponent";
3127
import { IAM_SCOPES } from "../../../../../../common/SecureComponent/permissions";
3228
import { useSelector } from "react-redux";
@@ -105,7 +101,7 @@ const DeleteNonCurrentVersions = ({
105101
disabled: typeConfirm !== "YES, PROCEED" || deleteLoading,
106102
}}
107103
confirmationContent={
108-
<DialogContentText>
104+
<Fragment>
109105
Are you sure you want to delete all the non-current versions for:{" "}
110106
<b>{decodeURLString(selectedObject)}</b>? <br />
111107
{canBypass && (
@@ -115,7 +111,7 @@ const DeleteNonCurrentVersions = ({
115111
marginTop: 10,
116112
}}
117113
>
118-
<FormSwitchWrapper
114+
<Switch
119115
label={"Bypass Governance Mode"}
120116
indicatorLabels={["Yes", "No"]}
121117
checked={bypassGovernance}
@@ -132,8 +128,10 @@ const DeleteNonCurrentVersions = ({
132128
)}
133129
<br />
134130
To continue please type <b>YES, PROCEED</b> in the box.
131+
<br />
132+
<br />
135133
<Grid item xs={12}>
136-
<InputBoxWrapper
134+
<InputBox
137135
id="type-confirm"
138136
name="retype-tenant"
139137
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
@@ -143,7 +141,7 @@ const DeleteNonCurrentVersions = ({
143141
value={typeConfirm}
144142
/>
145143
</Grid>
146-
</DialogContentText>
144+
</Fragment>
147145
}
148146
/>
149147
);

0 commit comments

Comments
 (0)