Skip to content

Commit b76dd6f

Browse files
committed
feat: Adds error message to complete search step
This displays the error message that was returned from the backend in the page as red text. At best it will give the user something to cut and paste when they send us an email.
1 parent fbbd402 commit b76dd6f

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

src/components/CustomSearch/CompleteStep.jsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React from "react";
22
import { Link } from "react-router-dom";
33
import PropTypes from "prop-types";
4-
import { Button } from "antd";
4+
import { Button, Typography } from "antd";
55
import StepTitle from "./StepTitle";
66

7-
export default function CompleteStep({ state, matches, resultsUrl }) {
7+
const { Text } = Typography;
8+
9+
export default function CompleteStep({ state, matches, resultsUrl, errorMessage }) {
810
let content = "";
911

1012
const handleView = () => {
@@ -38,6 +40,10 @@ export default function CompleteStep({ state, matches, resultsUrl }) {
3840
</Button>
3941
</>
4042
);
43+
} else if (state === "error") {
44+
content = (
45+
<Text type="danger">{errorMessage}</Text>
46+
);
4147
}
4248

4349
return (
@@ -51,9 +57,11 @@ export default function CompleteStep({ state, matches, resultsUrl }) {
5157
CompleteStep.propTypes = {
5258
state: PropTypes.string.isRequired,
5359
matches: PropTypes.number,
54-
resultsUrl: PropTypes.string.isRequired
60+
resultsUrl: PropTypes.string.isRequired,
61+
errorMessage: PropTypes.string
5562
};
5663

5764
CompleteStep.defaultProps = {
58-
matches: 0
65+
matches: 0,
66+
errorMessage: ""
5967
};

src/components/CustomSearch/SearchSteps.jsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@ import ColorDepthSearchStep from "./ColorDepthSearchStep";
99
import CompleteStep from "./CompleteStep";
1010
import "./SearchSteps.css";
1111

12-
// const { Step } = Steps;
13-
14-
/* const steps = [
15-
"Files Uploaded",
16-
"Image Alignment",
17-
"Mask Selection",
18-
"Color Depth Search",
19-
"Complete"
20-
]; */
21-
2212
function stepState(step, current, error) {
2313
if (step === current && error) {
2414
return "error";
@@ -46,9 +36,6 @@ export default function SearchSteps({ search }) {
4636

4737
return (
4838
<div className="searchSteps">
49-
{/* <Steps size="small" current={currentStep} status={status}>
50-
{formattedSteps}
51-
</Steps> */}
5239
<Row>
5340
<Col xs={5}>
5441
<FileUploadStep
@@ -87,6 +74,7 @@ export default function SearchSteps({ search }) {
8774
resultsUrl={searchLink}
8875
matches={search.nTotalMatches}
8976
state={stepState(4, currentStep, errorMessage)}
77+
errorMessage={errorMessage}
9078
/>
9179
</Col>
9280
</Row>

src/components/CustomSearch/SearchSteps.stories.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,14 @@ StepOneAfterAlignmentWithLSM.args = {
190190
alignStarted: "2022-12-01T15:22:07.092Z",
191191
},
192192
};
193+
194+
export const CompleteStepWithErrors = Template.bind({});
195+
CompleteStepWithErrors.args = {
196+
search: {
197+
errorMessage: "It went badly, like really badly, there was a lot of smoke and some of the servers will never recover. I don't think they are going to bring the data center back online for months",
198+
nTotalMatches: 0,
199+
step: 4,
200+
},
201+
};
202+
203+

src/components/CustomSearch/StepTitle.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
}
1111

1212
.stepIconError {
13-
color: #008b94;
13+
color: #ff4d4f;
1414
}

0 commit comments

Comments
 (0)