Skip to content

Commit 623ab00

Browse files
committed
AXON-762: added ErrorDisplay
1 parent b904c53 commit 623ab00

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/react/atlascode/startwork/v3/StartWorkPageV3.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { emptyTransition, Transition } from '@atlassianlabs/jira-pi-common-models';
22
import { Box, Button, CircularProgress, Typography } from '@material-ui/core';
3-
import React, { useCallback, useEffect, useState } from 'react';
3+
import React, { useCallback, useContext, useEffect, useState } from 'react';
44
import { AnalyticsView } from 'src/analyticsTypes';
55

66
import { StartWorkActionType } from '../../../../lib/ipc/fromUI/startWork';
77
import { RepoData } from '../../../../lib/ipc/toUI/startWork';
88
import { Branch } from '../../../../typings/git';
99
import { AtlascodeErrorBoundary } from '../../common/ErrorBoundary';
10+
import { ErrorControllerContext } from '../../common/errorController';
11+
import { ErrorDisplay } from '../../common/ErrorDisplay';
1012
import { StartWorkControllerContext, useStartWorkController } from '../startWorkController';
1113
import {
1214
CreateBranchSection,
@@ -19,6 +21,7 @@ import { generateBranchName, getDefaultSourceBranch } from './utils/branchUtils'
1921

2022
const StartWorkPageV3: React.FunctionComponent = () => {
2123
const [state, controller] = useStartWorkController();
24+
const errorController = useContext(ErrorControllerContext);
2225
const [pushBranchEnabled, setPushBranchEnabled] = useState(true);
2326
const [localBranch, setLocalBranch] = useState('');
2427
const [sourceBranch, setSourceBranch] = useState<Branch>({ type: 0, name: '' });
@@ -141,18 +144,20 @@ const StartWorkPageV3: React.FunctionComponent = () => {
141144
setSnackbarOpen(true);
142145
} catch (error) {
143146
console.error('Error creating branch:', error);
147+
errorController.showError(error);
144148
setSubmitState('initial');
145149
}
146150
}, [
151+
selectedRepository,
147152
controller,
148153
transitionIssueEnabled,
149154
selectedTransition,
150155
branchSetupEnabled,
151-
pushBranchEnabled,
152-
localBranch,
153156
sourceBranch,
154-
selectedRepository,
157+
localBranch,
155158
upstream,
159+
pushBranchEnabled,
160+
errorController,
156161
]);
157162

158163
const formState = {
@@ -200,6 +205,10 @@ const StartWorkPageV3: React.FunctionComponent = () => {
200205

201206
{submitState === 'submit-success' && <SuccessAlert submitResponse={submitResponse} />}
202207

208+
<Box marginBottom={2}>
209+
<ErrorDisplay />
210+
</Box>
211+
203212
<TaskInfoSection state={state} controller={controller} />
204213
<CreateBranchSection
205214
state={state}

0 commit comments

Comments
 (0)