Skip to content

Commit bbf4027

Browse files
authored
Migrated Speedtest components to mds (#3015)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
1 parent dbffc5f commit bbf4027

File tree

6 files changed

+319
-440
lines changed

6 files changed

+319
-440
lines changed

portal-ui/src/screens/Console/Common/FormComponents/common/styleLibrary.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -825,42 +825,6 @@ export const deleteDialogStyles: any = {
825825
},
826826
};
827827

828-
export const advancedFilterToggleStyles: any = {
829-
advancedButton: {
830-
flexGrow: 1,
831-
alignItems: "flex-end",
832-
display: "flex",
833-
justifyContent: "flex-end",
834-
},
835-
advancedConfiguration: {
836-
color: "#2781B0",
837-
fontSize: 10,
838-
textDecoration: "underline",
839-
border: "none",
840-
backgroundColor: "transparent",
841-
cursor: "pointer",
842-
alignItems: "center",
843-
display: "flex",
844-
float: "right",
845-
846-
"&:hover": {
847-
color: "#07193E",
848-
},
849-
850-
"& svg": {
851-
width: 10,
852-
alignSelf: "center",
853-
marginLeft: 5,
854-
},
855-
},
856-
advancedOpen: {
857-
transform: "rotateZ(-90deg) translateX(-4px) translateY(2px)",
858-
},
859-
advancedClosed: {
860-
transform: "rotateZ(90deg)",
861-
},
862-
};
863-
864828
export const createTenantCommon: any = {
865829
fieldGroup: {
866830
border: "1px solid #EAEAEA",

portal-ui/src/screens/Console/Common/ObjectManager/ObjectHandled.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,14 @@ const ObjectHandled = ({
249249
error={objectToDisplay.failed}
250250
cancelled={objectToDisplay.cancelled}
251251
withLabel
252+
notificationLabel={
253+
objectToDisplay.errorMessage !== ""
254+
? objectToDisplay.errorMessage
255+
: ""
256+
}
252257
/>
253258
)}
254259
</div>
255-
{objectToDisplay.errorMessage !== "" && (
256-
<div className={classes.errorMessage}>
257-
<strong>Error: </strong>
258-
{objectToDisplay.errorMessage}
259-
</div>
260-
)}
261260
</div>
262261
</Fragment>
263262
);

portal-ui/src/screens/Console/Common/ProgressBarWrapper/ProgressBarWrapper.tsx

Lines changed: 25 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@
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 } from "react";
18-
import { styled } from "@mui/material/styles";
19-
import LinearProgress, {
20-
linearProgressClasses,
21-
LinearProgressProps,
22-
} from "@mui/material/LinearProgress";
23-
import Box from "@mui/material/Box";
17+
import React from "react";
18+
import { ProgressBar, ProgressBarProps } from "mds";
2419

2520
interface IProgressBarWrapper {
2621
value: number;
@@ -30,62 +25,28 @@ interface IProgressBarWrapper {
3025
size?: string;
3126
error?: boolean;
3227
cancelled?: boolean;
28+
notificationLabel?: string;
3329
}
3430

35-
const BorderLinearProgress = styled(LinearProgress)(() => ({
36-
height: 10,
37-
borderRadius: 5,
38-
[`&.${linearProgressClasses.colorPrimary}`]: {
39-
backgroundColor: "#f1f1f1",
40-
},
41-
[`& .${linearProgressClasses.bar}`]: {
42-
borderRadius: 5,
43-
},
44-
}));
45-
const SmallBorderLinearProgress = styled(BorderLinearProgress)(() => ({
46-
height: 6,
47-
borderRadius: 3,
48-
[`& .${linearProgressClasses.bar}`]: {
49-
borderRadius: 3,
50-
},
51-
}));
52-
5331
function LinearProgressWithLabel(
54-
props: { error: boolean; cancelled: boolean } & LinearProgressProps,
32+
props: { error: boolean; cancelled: boolean } & ProgressBarProps,
5533
) {
56-
let color = "#000";
57-
let size = 18;
34+
let label = "";
5835

5936
if (props.error) {
60-
color = "#C83B51";
61-
size = 14;
37+
label = `Error: ${props.notificationLabel || ""}`;
6238
} else if (props.cancelled) {
63-
color = "#FFBD62";
64-
size = 14;
39+
label = `Cancelled`;
6540
}
6641

6742
return (
68-
<Box sx={{ display: "flex", alignItems: "center" }}>
69-
<Box sx={{ width: "100%", mr: 3 }}>
70-
<BorderLinearProgress variant="determinate" {...props} />
71-
</Box>
72-
<Box
73-
sx={{
74-
minWidth: 35,
75-
fontSize: size,
76-
color: color,
77-
}}
78-
className={"value"}
79-
>
80-
{props.cancelled ? (
81-
"Cancelled"
82-
) : (
83-
<Fragment>
84-
{props.error ? "Failed" : `${Math.round(props.value || 0)}%`}
85-
</Fragment>
86-
)}
87-
</Box>
88-
</Box>
43+
<ProgressBar
44+
variant={"determinate"}
45+
value={props.value}
46+
color={props.color}
47+
progressLabel
48+
notificationLabel={label}
49+
/>
8950
);
9051
}
9152

@@ -97,22 +58,24 @@ const ProgressBarWrapper = ({
9758
size = "regular",
9859
error,
9960
cancelled,
61+
notificationLabel,
10062
}: IProgressBarWrapper) => {
10163
let color: any;
10264
if (error) {
103-
color = "error";
65+
color = "red";
10466
} else if (cancelled) {
105-
color = "warning";
67+
color = "orange";
10668
} else if (value === 100 && ready) {
107-
color = "success";
69+
color = "green";
10870
} else {
109-
color = "primary";
71+
color = "blue";
11072
}
111-
const propsComponent: LinearProgressProps = {
73+
const propsComponent: ProgressBarProps = {
11274
variant:
11375
indeterminate && !ready && !cancelled ? "indeterminate" : "determinate",
11476
value: ready ? 100 : value,
11577
color: color,
78+
notificationLabel: notificationLabel || "",
11679
};
11780
if (withLabel) {
11881
return (
@@ -124,10 +87,12 @@ const ProgressBarWrapper = ({
12487
);
12588
}
12689
if (size === "small") {
127-
return <SmallBorderLinearProgress {...propsComponent} />;
90+
return (
91+
<ProgressBar {...propsComponent} sx={{ height: 6, borderRadius: 6 }} />
92+
);
12893
}
12994

130-
return <BorderLinearProgress {...propsComponent} />;
95+
return <ProgressBar {...propsComponent} />;
13196
};
13297

13398
export default ProgressBarWrapper;

0 commit comments

Comments
 (0)