Skip to content

Commit fd4be5a

Browse files
authored
[Cherry-Pick-Main][UI] UI V2024.3.0 prerelease bug-fix (#49)
1 parent c18aad4 commit fd4be5a

File tree

22 files changed

+220
-70
lines changed

22 files changed

+220
-70
lines changed

src/ui/src/components/CaptureImportForm/CaptureImportForm.jsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ const PipelineImportForm = ({
103103
let captureConfigurationFormData = getCaptureConfigurationFormData();
104104
if (_.isEmpty(metadataFormData) && _.isEmpty(captureConfigurationFormData?.options)) {
105105
await createDefaultMetadata(projectUUID);
106+
107+
metadataFormData = getCaptureMetadataFormData();
108+
captureConfigurationFormData = getCaptureConfigurationFormData();
106109
}
107-
metadataFormData = getCaptureMetadataFormData();
108-
captureConfigurationFormData = getCaptureConfigurationFormData();
110+
109111
setCaptureMetadataFormData(metadataFormData);
110112
setCaptureConfigurationFromData(captureConfigurationFormData);
111113
setActiveStep(STEP_FORM);

src/ui/src/components/ControlPanel/ControlPanel.jsx

+16-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ License along with SensiML Piccolo AI. If not, see <https://www.gnu.org/licenses
1818
*/
1919

2020
import React from "react";
21-
import { Box, Grid, Typography } from "@mui/material";
21+
import { Box, Grid, IconButton, Typography } from "@mui/material";
2222
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
2323
import makeStyles from "@mui/styles/makeStyles";
2424

25+
import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
26+
2527
import { filterTruncateMiddle } from "filters";
2628
import { UIControlPanel } from "components/UIPanels";
2729
import { IconButtonRounded } from "components/UIButtons";
@@ -51,7 +53,14 @@ const useStyles = () =>
5153
},
5254
}))();
5355

54-
const ControlPanel = ({ title, subtitle, onClickBack, actionsBtns, turncateLenght = 0 }) => {
56+
const ControlPanel = ({
57+
title,
58+
subtitle,
59+
onClickBack,
60+
onShowInformation,
61+
actionsBtns,
62+
turncateLenght = 0,
63+
}) => {
5564
const classes = useStyles();
5665

5766
return (
@@ -70,6 +79,11 @@ const ControlPanel = ({ title, subtitle, onClickBack, actionsBtns, turncateLengh
7079
) : null}
7180
<Typography variant={"h2"} classes={{ root: classes.titleRoot }}>
7281
{title && filterTruncateMiddle(title, turncateLenght)}
82+
{onShowInformation ? (
83+
<IconButton onClick={onShowInformation}>
84+
<InfoOutlinedIcon color="primary" />
85+
</IconButton>
86+
) : null}
7387
</Typography>
7488
<Box alignItems="center" ml={2}>
7589
{subtitle}

src/ui/src/components/ControlPanel/ControlPanelStyles.js

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import makeStyles from "@mui/styles/makeStyles";
2121

2222
const useStyles = () =>
2323
makeStyles((theme) => ({
24+
headerInfoIconButton: {
25+
marginLeft: theme.spacing(1),
26+
marginTop: theme.spacing(1),
27+
},
2428
grid: {},
2529
controlPanelWrapper: {
2630
display: "flex",

src/ui/src/components/Layout/LayoutConstants.js

+13-10
Original file line numberDiff line numberDiff line change
@@ -98,24 +98,16 @@ const MENU_ITEMS_INFO = {
9898
subItems: [
9999
{
100100
title: i18n.t("layout:nav-drawer.menu-item-feature-extractor"),
101+
tooltip: i18n.t("layout:nav-drawer.menu-item-pipeline-fe-tooltip"),
101102
id: "navFeatureExtractor",
102103
orderIndex: 1,
103104
iconfn: (iconProps) => <FilterAltOutlinedIcon {...iconProps} />,
104105
getPath: (params = {}) =>
105106
generatePath(ROUTES.MAIN.MODEL_BUILD.child.FEATURE_EXTRACTOR.path, { ...params }),
106107
},
107-
{
108-
title: i18n.t("layout:nav-drawer.menu-item-pipeline-automl"),
109-
id: "navPipelineAutoML",
110-
orderIndex: 2,
111-
iconfn: (iconProps) => <AutoModeOutlinedIcon {...iconProps} />,
112-
getPath: (params = {}) =>
113-
generatePath(ROUTES.MAIN.MODEL_BUILD.child.AUTOML.path, {
114-
...params,
115-
}),
116-
},
117108
{
118109
title: i18n.t("layout:nav-drawer.menu-item-pipeline-custom"),
110+
tooltip: i18n.t("layout:nav-drawer.menu-item-pipeline-custom-tooltip"),
119111
id: "navPipelineCustom",
120112
orderIndex: 3,
121113
iconfn: (iconProps) => <ModelTrainingOutlinedIcon {...iconProps} fontSize="medium" />,
@@ -124,6 +116,17 @@ const MENU_ITEMS_INFO = {
124116
...params,
125117
}),
126118
},
119+
{
120+
title: i18n.t("layout:nav-drawer.menu-item-pipeline-automl"),
121+
tooltip: i18n.t("layout:nav-drawer.menu-item-pipeline-automl-tooltip"),
122+
id: "navPipelineAutoML",
123+
orderIndex: 2,
124+
iconfn: (iconProps) => <AutoModeOutlinedIcon {...iconProps} />,
125+
getPath: (params = {}) =>
126+
generatePath(ROUTES.MAIN.MODEL_BUILD.child.AUTOML.path, {
127+
...params,
128+
}),
129+
},
127130
],
128131
},
129132
MODELS: {

src/ui/src/components/Layout/NavDrawer.jsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,22 @@ const NavDrawer = ({
196196
...(selectedPipeline && { pipelineUUID: selectedPipeline }),
197197
})}
198198
>
199-
<ListItem sx={{ pt: 0.5, pb: 0.5 }} id={subItem.id}>
200-
<Tooltip title={subItem.title} aria-label="add">
199+
<Tooltip
200+
title={subItem.tooltip || subItem.title}
201+
placement="right"
202+
aria-label={subItem.title}
203+
>
204+
<ListItem sx={{ pt: 0.5, pb: 0.5 }} id={subItem.id}>
201205
<ListItemIcon className={classes.iconButton}>
202206
{getIsPathHasStatus(subItem.getPath()) ? (
203207
<StatusRunningIcon status={pipelineRunningStatus} />
204208
) : (
205209
subItem.iconfn(getMenuProps(subItem.orderIndex))
206210
)}
207211
</ListItemIcon>
208-
</Tooltip>
209-
<ListItemText primary={subItem.title} />
210-
</ListItem>
212+
<ListItemText primary={subItem.title} />
213+
</ListItem>
214+
</Tooltip>
211215
</NavLink>
212216
) : null}
213217
</Box>

src/ui/src/components/PipelineBuilderV1/DrawerInformationMessage.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ License along with SensiML Piccolo AI. If not, see <https://www.gnu.org/licenses
1919

2020
/* eslint-disable no-unused-vars */
2121
import React from "react";
22-
import filters from "filters";
2322
import { useTranslation } from "react-i18next";
2423

2524
import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
26-
import { Alert, AlertTitle, Drawer, Box, Button, Typography } from "@mui/material";
25+
import { Drawer, Box, Button, Typography } from "@mui/material";
2726
import { useTheme } from "@mui/material/styles";
2827
import useStyles from "./BuildModeStyle";
2928

src/ui/src/components/PipelineBuilderV1/PipelineBuilder.jsx

+10-11
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ const PipelineBuilder = ({
145145
labelColors,
146146
classMap,
147147
selectLabelValuesColors,
148-
selectLabelValuesByName,
149148
onCloseAlertBuilder,
150149
onCreateNewStep,
151150
onDeleteStep,
@@ -802,11 +801,11 @@ const PipelineBuilder = ({
802801
[selectedSteps, activeEditStep, pipelineStatus, isOptimizationRunning],
803802
);
804803

805-
const CardInformationIcon = () => (
804+
const CardInformationIcon = ({ step }) => (
806805
<Tooltip title={t("flow-builder.card-step-help-info")} placement="top">
807806
<Link
808807
className={`${classes.cardInfoIcon}`}
809-
onClick={(_e) => handleStepInfo(pipelineSettings)}
808+
onClick={(_e) => handleStepInfo(step)}
810809
data-test="info-link"
811810
>
812811
<InfoOutlinedIcon style={{ color: theme.colorEditIcons }} fontSize="xsmall" />
@@ -900,7 +899,7 @@ const PipelineBuilder = ({
900899
<>
901900
<Box display={"flex"} alignItems={"center"}>
902901
<span>{step.name}</span>
903-
<CardInformationIcon />
902+
<CardInformationIcon step={step} />
904903
</Box>
905904
{[
906905
PIPELINE_STEP_TYPES.CLASSIFIER,
@@ -925,7 +924,7 @@ const PipelineBuilder = ({
925924
FunctionSubType: step.name,
926925
})}
927926
</span>
928-
<CardInformationIcon />
927+
<CardInformationIcon step={step} />
929928
</Box>
930929
</>
931930
)}
@@ -1124,13 +1123,13 @@ const PipelineBuilder = ({
11241123
isOpen={isOpenDialogDistribution}
11251124
labelColors={labelColors}
11261125
data={cacheDistributionData?.data || {}}
1127-
featureSummary={featureStatsData.feature_summary}
1128-
featureStatistics={featureStatsData.feature_statistics}
1129-
featureVectorData={featureStatsData.feature_data}
1130-
features={_.keys(featureStatsData.feature_data)}
1131-
labelColumn={featureStatsData.label_column}
1126+
featureVectorData={featureStatsData?.featureVectorData || {}}
1127+
featureStatistics={featureStatsData?.featureStatistics || {}}
1128+
featureSummary={featureStatsData?.featureSummary || {}}
1129+
features={featureStatsData?.featureNames || {}}
1130+
labelColumn={featureStatsData?.labelColumn || ""}
1131+
labelValues={featureStatsData?.labelValues || []}
11321132
selectLabelValuesColors={selectLabelValuesColors}
1133-
labelValues={selectLabelValuesByName(featureStatsData.label_column || "Label")}
11341133
classMap={classMap}
11351134
classes={classes}
11361135
isLoadFeatures={cacheDistributionData?.step?.isLoadFeatures}

src/ui/src/components/PipelineImportForm/PipelineImportForm.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ const PipelineImportForm = ({
5353
};
5454

5555
const handleCreate = (pipelineName, queryName, isUseSessionPreprocessor, replacedColumns) => {
56+
const disableAutoML = pipelineJson.hyper_params?.params?.disable_automl || false;
5657
onSubmit({
5758
pipelineName,
5859
pipelineJson,
60+
isAutoMLOptimization: !disableAutoML,
5961
queryName,
6062
replacedColumns,
6163
isUseSessionPreprocessor,

src/ui/src/components/PipelineTemplateCreateForm/PipelineTemplateCreateForm.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ const PipelineTemplateCreateForm = ({
6767
};
6868

6969
const handleCreate = (pipelineName, queryName, isUseSessionPreprocessor, replacedColumns) => {
70+
const disableAutoML = pipelineJson.hyper_params?.params?.disable_automl || false;
7071
onSubmit({
7172
pipelineName,
73+
isAutoMLOptimization: !disableAutoML,
7274
pipelineJson,
7375
queryName,
7476
replacedColumns,

src/ui/src/containers/BuildModel/TheBuilderScreen/TheBuilderScreen.jsx

+62-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-unused-vars */
12
/*
23
Copyright 2017-2024 SensiML Corporation
34
@@ -16,8 +17,32 @@ Affero General Public License for more details.
1617
You should have received a copy of the GNU Affero General Public
1718
License along with SensiML Piccolo AI. If not, see <https://www.gnu.org/licenses/>.
1819
*/
20+
import React, { useEffect, useState } from "react";
21+
import {
22+
Button,
23+
Box,
24+
CircularProgress,
25+
Typography,
26+
Link,
27+
Tooltip,
28+
FormControlLabel,
29+
Checkbox,
30+
Stack,
31+
} from "@mui/material";
1932

20-
import { useEffect } from "react";
33+
import makeStyles from "@mui/styles/makeStyles";
34+
import DialogInformation from "components/DialogInformation";
35+
36+
const useStyles = (navBarIsOpen) =>
37+
makeStyles((theme) => ({
38+
infoTitle: {
39+
marginBottom: theme.spacing(4),
40+
marginTop: theme.spacing(2),
41+
fontSize: theme.spacing(4),
42+
fontWeight: 500,
43+
textAlign: "center",
44+
},
45+
}))();
2146

2247
const TheBuilderScreen = ({
2348
children,
@@ -35,6 +60,9 @@ const TheBuilderScreen = ({
3560
setSelectedPipelineName,
3661
...props
3762
}) => {
63+
const classes = useStyles();
64+
const [dialogInformationData, setDialogInformationData] = useState({});
65+
3866
const stopOptimizationChecker = () => {
3967
clearOptimizationLogs();
4068
clearPipelineResults();
@@ -58,15 +86,39 @@ const TheBuilderScreen = ({
5886
];
5987
}, []);
6088

61-
return children({
62-
clearAlertBuilder,
63-
clearOptimizationLogs,
64-
clearPipelineResults,
65-
clearPipelineStatus,
66-
clearQueryCacheStatus,
67-
pipelineData,
68-
...props,
69-
});
89+
const handleShowInformation = (title, text) => {
90+
setDialogInformationData({ title, text });
91+
};
92+
93+
const handleCloseNewStepDialogInformation = () => {
94+
setDialogInformationData({});
95+
};
96+
97+
return (
98+
<>
99+
{children({
100+
clearAlertBuilder,
101+
clearOptimizationLogs,
102+
clearPipelineResults,
103+
clearPipelineStatus,
104+
clearQueryCacheStatus,
105+
pipelineData,
106+
onShowInformation: handleShowInformation,
107+
...props,
108+
})}
109+
<DialogInformation
110+
isOpen={Boolean(dialogInformationData.title)}
111+
onClose={handleCloseNewStepDialogInformation}
112+
>
113+
<Typography variant="h2" className={classes.infoTitle}>
114+
{dialogInformationData.title}
115+
</Typography>
116+
<Typography paragraph>
117+
<p style={{ whiteSpace: "pre-wrap" }}>{dialogInformationData.text}</p>
118+
</Typography>
119+
</DialogInformation>
120+
</>
121+
);
70122
};
71123

72124
export default TheBuilderScreen;

src/ui/src/containers/BuildModel/TheClassificationScreen/TheClassificationScreen.jsx

+16
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const TheClassificationScreen = ({
111111

112112
exportPipeline,
113113
getPipelineStepFeatureStats,
114+
onShowInformation,
114115
}) => {
115116
const routersHistory = useHistory();
116117
const scrollTop = useRef();
@@ -393,6 +394,21 @@ const TheClassificationScreen = ({
393394
<div className={classes.topPanelTopOverlap} />
394395
<Box className={classes.topPanelWrapper}>
395396
<BuilderPipelinePanel
397+
title={
398+
isAutoML
399+
? t("model-builder.pipeline-panel-header-automl")
400+
: t("model-builder.pipeline-panel-header-custom")
401+
}
402+
onShowInformation={() => {
403+
onShowInformation(
404+
isAutoML
405+
? t("model-builder.pipeline-panel-header-automl")
406+
: t("model-builder.pipeline-panel-header-custom"),
407+
isAutoML
408+
? t("model-builder.pipeline-panel-automl-description")
409+
: t("model-builder.pipeline-panel-custom-description"),
410+
);
411+
}}
396412
pipelineData={pipelineData}
397413
handleChangePipeline={handleChangePipeline}
398414
getIsReadyToOptimize={getIsReadyToOptimize}

0 commit comments

Comments
 (0)