Skip to content

Commit

Permalink
[AXON-41] Add error boundary to all pages except JIRA
Browse files Browse the repository at this point in the history
  • Loading branch information
sdzh-atlassian committed Dec 26, 2024
1 parent 3a11fea commit 6d24736
Show file tree
Hide file tree
Showing 11 changed files with 2,758 additions and 2,582 deletions.
18 changes: 18 additions & 0 deletions src/analyticsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ export enum AnalyticsChannels {
AtlascodeUiErrors = 'atlascode.ui.errors',
}

export enum AnalyticsView {
OnboardingPage = 'onboarding',
SettingsPage = 'settings',
WelcomePage = 'welcome',

BitbucketIssuePage = 'bitbucketIssue',
PullRequestPage = 'pullRequest',

CreateBitbucketIssuePage = 'createBitbucketIssue',
CreatePullRequestPage = 'createPullRequest',

PipelineSummaryPage = 'pipelineSummary',

StartWorkPage = 'startWork',

Other = 'other',
}

export type UIAnalyticsContext = {
view: string;
};
Expand Down
381 changes: 198 additions & 183 deletions src/react/atlascode/bbissue/BitbucketIssuePage.tsx

Large diffs are not rendered by default.

227 changes: 117 additions & 110 deletions src/react/atlascode/bbissue/CreateBitbucketIssuePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import {
CreateBitbucketIssueControllerContext,
useCreateBitbucketIssueController,
} from './createBitbucketIssueController';
import { AtlascodeErrorBoundary } from '../common/ErrorBoundary';
import { AnalyticsView } from 'src/analyticsTypes';

const priorityIcon = {
trivial: <RadioButtonUncheckedIcon />,
Expand Down Expand Up @@ -129,120 +131,125 @@ const CreateBitbucketIssuePage: React.FunctionComponent = () => {

return (
<CreateBitbucketIssueControllerContext.Provider value={controller}>
<Container maxWidth="lg" hidden={state.site === emptyBitbucketSite}>
<AppBar position="relative">
<Toolbar>
<Typography variant="h3" className={classes.title}>
Create issue - {state.site.ownerSlug}/{state.site.repoSlug}
</Typography>
<Box className={classes.grow} />
<Tooltip title="Create in browser...">
<IconButton
href={`https://bitbucket.org/${state.site.ownerSlug}/${state.site.repoSlug}/issues/new`}
>
<LaunchIcon />
</IconButton>
</Tooltip>
<RefreshButton loading={state.isSomethingLoading} onClick={controller.refresh} />
</Toolbar>
</AppBar>
<Grid container spacing={1}>
<Grid item xs={12}>
<Paper className={classes.paper100}>
<Box margin={2}>
<ErrorDisplay />
<PMFDisplay postMessageFunc={controller.postMessage} />
<form onSubmit={submitForm}>
<Grid container spacing={1} direction="column">
<Grid item xs={12}>
<TextField
required
fullWidth
size="small"
label="Title"
name="title"
value={title}
onChange={handleTitleChange}
/>
</Grid>
<Grid item xs={12}>
<TextField
fullWidth
multiline
size="small"
rows={4}
value={description}
onChange={handleDescriptionChange}
label="Description"
name="description"
/>
</Grid>
<Grid item xs={12}>
<TextField
select
size="small"
label="Kind"
name="kind"
value={kind}
onChange={handleKindChange}
>
{Object.getOwnPropertyNames(typeIcon).map((name) => (
<MenuItem key={name} value={name}>
<Grid container spacing={1} direction="row">
<Grid item>{typeIcon[name]}</Grid>
<Grid item>
<Typography>{name}</Typography>
<AtlascodeErrorBoundary
context={{ view: AnalyticsView.CreateBitbucketIssuePage }}
postMessageFunc={controller.postMessage}
>
<Container maxWidth="lg" hidden={state.site === emptyBitbucketSite}>
<AppBar position="relative">
<Toolbar>
<Typography variant="h3" className={classes.title}>
Create issue - {state.site.ownerSlug}/{state.site.repoSlug}
</Typography>
<Box className={classes.grow} />
<Tooltip title="Create in browser...">
<IconButton
href={`https://bitbucket.org/${state.site.ownerSlug}/${state.site.repoSlug}/issues/new`}
>
<LaunchIcon />
</IconButton>
</Tooltip>
<RefreshButton loading={state.isSomethingLoading} onClick={controller.refresh} />
</Toolbar>
</AppBar>
<Grid container spacing={1}>
<Grid item xs={12}>
<Paper className={classes.paper100}>
<Box margin={2}>
<ErrorDisplay />
<PMFDisplay postMessageFunc={controller.postMessage} />
<form onSubmit={submitForm}>
<Grid container spacing={1} direction="column">
<Grid item xs={12}>
<TextField
required
fullWidth
size="small"
label="Title"
name="title"
value={title}
onChange={handleTitleChange}
/>
</Grid>
<Grid item xs={12}>
<TextField
fullWidth
multiline
size="small"
rows={4}
value={description}
onChange={handleDescriptionChange}
label="Description"
name="description"
/>
</Grid>
<Grid item xs={12}>
<TextField
select
size="small"
label="Kind"
name="kind"
value={kind}
onChange={handleKindChange}
>
{Object.getOwnPropertyNames(typeIcon).map((name) => (
<MenuItem key={name} value={name}>
<Grid container spacing={1} direction="row">
<Grid item>{typeIcon[name]}</Grid>
<Grid item>
<Typography>{name}</Typography>
</Grid>
</Grid>
</Grid>
</MenuItem>
))}
</TextField>
</Grid>
<Grid item xs={12}>
<TextField
select
size="small"
label="Priority"
name="priority"
value={priority}
onChange={handlePriorityChange}
>
{Object.getOwnPropertyNames(priorityIcon).map((name) => (
<MenuItem key={name} value={name}>
<Grid container spacing={1} direction="row">
<Grid item>{priorityIcon[name]}</Grid>
<Grid item>
<Typography>{name}</Typography>
</MenuItem>
))}
</TextField>
</Grid>
<Grid item xs={12}>
<TextField
select
size="small"
label="Priority"
name="priority"
value={priority}
onChange={handlePriorityChange}
>
{Object.getOwnPropertyNames(priorityIcon).map((name) => (
<MenuItem key={name} value={name}>
<Grid container spacing={1} direction="row">
<Grid item>{priorityIcon[name]}</Grid>
<Grid item>
<Typography>{name}</Typography>
</Grid>
</Grid>
</Grid>
</MenuItem>
))}
</TextField>
</Grid>
<Grid item xs={12}>
<Button
variant="contained"
color="primary"
type="submit"
endIcon={
submitState === 'submitting' ? (
<CircularProgress
color="inherit"
size={theme.typography.fontSize}
/>
) : null
}
>
Submit
</Button>
</MenuItem>
))}
</TextField>
</Grid>
<Grid item xs={12}>
<Button
variant="contained"
color="primary"
type="submit"
endIcon={
submitState === 'submitting' ? (
<CircularProgress
color="inherit"
size={theme.typography.fontSize}
/>
) : null
}
>
Submit
</Button>
</Grid>
</Grid>
</Grid>
</form>
</Box>
</Paper>
</form>
</Box>
</Paper>
</Grid>
</Grid>
</Grid>
</Container>
</Container>
</AtlascodeErrorBoundary>
</CreateBitbucketIssueControllerContext.Provider>
);
};
Expand Down
6 changes: 5 additions & 1 deletion src/react/atlascode/config/ConfigPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
import WorkIcon from '@material-ui/icons/Work';
import equal from 'fast-deep-equal/es6';
import { AtlascodeErrorBoundary } from '../common/ErrorBoundary';
import { AnalyticsView } from 'src/analyticsTypes';

const useStyles = makeStyles(
(theme: Theme) =>
Expand Down Expand Up @@ -170,7 +171,10 @@ const ConfigPage: React.FunctionComponent = () => {
return (
<ConfigControllerContext.Provider value={controller}>
<AuthDialogControllerContext.Provider value={authDialogController}>
<AtlascodeErrorBoundary postMessageFunc={controller.postMessage} context={{ view: 'config' }}>
<AtlascodeErrorBoundary
context={{ view: AnalyticsView.SettingsPage }}
postMessageFunc={controller.postMessage}
>
<Container maxWidth="xl">
<AppBar position="relative">
<Toolbar>
Expand Down
Loading

0 comments on commit 6d24736

Please sign in to comment.