-
-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: action events UI #6358
Merged
Merged
chore: action events UI #6358
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import { | |
TokenGeneration, | ||
useIncomingWebhooksForm, | ||
} from './IncomingWebhooksForm/useIncomingWebhooksForm'; | ||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; | ||
|
||
const StyledHeader = styled('div')(({ theme }) => ({ | ||
display: 'flex', | ||
|
@@ -158,7 +159,10 @@ export const IncomingWebhooksModal = ({ | |
> | ||
<StyledHeader> | ||
<StyledTitle>{title}</StyledTitle> | ||
<Link onClick={onOpenEvents}>View events</Link> | ||
<ConditionallyRender | ||
condition={editing} | ||
show={<Link onClick={onOpenEvents}>View events</Link>} | ||
/> | ||
Comment on lines
+162
to
+165
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ New issue: Large Method Why does this problem occur?Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function. Read more. To ignore this warning click here. |
||
</StyledHeader> | ||
<StyledForm onSubmit={onSubmit}> | ||
<IncomingWebhooksForm | ||
|
43 changes: 43 additions & 0 deletions
43
...ProjectActionsEventsModal/ProjectActionsEventsDetails.tsx/ProjectActionsEventsDetails.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Alert, styled } from '@mui/material'; | ||
import { IActionSetEvent } from 'interfaces/action'; | ||
import { ProjectActionsEventsDetailsAction } from './ProjectActionsEventsDetailsAction'; | ||
import { ProjectActionsEventsDetailsSource } from './ProjectActionsEventsDetailsSource/ProjectActionsEventsDetailsSource'; | ||
|
||
const StyledDetails = styled('div')(({ theme }) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: theme.spacing(2), | ||
padding: theme.spacing(2), | ||
})); | ||
|
||
export const ProjectActionsEventsDetails = ({ | ||
state, | ||
actionSet: { actions }, | ||
observableEvent, | ||
}: IActionSetEvent) => { | ||
const stateText = | ||
state === 'failed' | ||
? `${ | ||
actions.filter(({ state }) => state !== 'success').length | ||
} out of ${actions.length} actions were not successfully executed` | ||
: 'All actions were successfully executed'; | ||
|
||
return ( | ||
<StyledDetails> | ||
<Alert severity={state === 'failed' ? 'error' : 'success'}> | ||
{stateText} | ||
</Alert> | ||
<ProjectActionsEventsDetailsSource | ||
observableEvent={observableEvent} | ||
/> | ||
{actions.map((action, i) => ( | ||
<ProjectActionsEventsDetailsAction | ||
key={action.id} | ||
action={action} | ||
> | ||
Action {i + 1} | ||
</ProjectActionsEventsDetailsAction> | ||
))} | ||
</StyledDetails> | ||
); | ||
}; |
110 changes: 110 additions & 0 deletions
110
...tActionsEventsModal/ProjectActionsEventsDetails.tsx/ProjectActionsEventsDetailsAction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { CheckCircleOutline, ErrorOutline } from '@mui/icons-material'; | ||
import { Alert, CircularProgress, Divider, styled } from '@mui/material'; | ||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; | ||
import { IActionEvent } from 'interfaces/action'; | ||
import { ReactNode } from 'react'; | ||
|
||
const StyledAction = styled('div', { | ||
shouldForwardProp: (prop) => prop !== 'state', | ||
})<{ state?: IActionEvent['state'] }>(({ theme, state }) => ({ | ||
padding: theme.spacing(2), | ||
border: `1px solid ${theme.palette.divider}`, | ||
borderRadius: theme.shape.borderRadiusMedium, | ||
...(state === 'not started' && { | ||
backgroundColor: theme.palette.background.elevation1, | ||
}), | ||
})); | ||
|
||
const StyledHeader = styled('div')({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
}); | ||
|
||
const StyledHeaderRow = styled('div')({ | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
width: '100%', | ||
}); | ||
|
||
const StyledHeaderState = styled('div')(({ theme }) => ({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
fontSize: theme.fontSizes.smallBody, | ||
gap: theme.spacing(2), | ||
})); | ||
|
||
export const StyledSuccessIcon = styled(CheckCircleOutline)(({ theme }) => ({ | ||
color: theme.palette.success.main, | ||
})); | ||
|
||
export const StyledFailedIcon = styled(ErrorOutline)(({ theme }) => ({ | ||
color: theme.palette.error.main, | ||
})); | ||
|
||
const StyledAlert = styled(Alert)(({ theme }) => ({ | ||
marginTop: theme.spacing(2), | ||
})); | ||
|
||
const StyledDivider = styled(Divider)(({ theme }) => ({ | ||
margin: theme.spacing(2, 0), | ||
})); | ||
|
||
const StyledActionBody = styled('div')(({ theme }) => ({ | ||
fontSize: theme.fontSizes.smallBody, | ||
})); | ||
|
||
const StyledActionLabel = styled('p')(({ theme }) => ({ | ||
fontWeight: theme.fontWeight.bold, | ||
marginBottom: theme.spacing(0.5), | ||
})); | ||
|
||
const StyledPropertyLabel = styled('span')(({ theme }) => ({ | ||
color: theme.palette.text.secondary, | ||
})); | ||
|
||
interface IProjectActionsEventsDetailsActionProps { | ||
action: IActionEvent; | ||
children: ReactNode; | ||
} | ||
|
||
export const ProjectActionsEventsDetailsAction = ({ | ||
action: { state, details, action, executionParams }, | ||
children, | ||
}: IProjectActionsEventsDetailsActionProps) => { | ||
const actionState = | ||
state === 'success' ? ( | ||
<StyledSuccessIcon /> | ||
) : state === 'failed' ? ( | ||
<StyledFailedIcon /> | ||
) : state === 'started' ? ( | ||
<CircularProgress size={20} /> | ||
) : ( | ||
<span>Not started</span> | ||
); | ||
|
||
return ( | ||
<StyledAction state={state}> | ||
<StyledHeader> | ||
<StyledHeaderRow> | ||
<div>{children}</div> | ||
<StyledHeaderState>{actionState}</StyledHeaderState> | ||
</StyledHeaderRow> | ||
<ConditionallyRender | ||
condition={Boolean(details)} | ||
show={<StyledAlert severity='error'>{details}</StyledAlert>} | ||
/> | ||
</StyledHeader> | ||
<StyledDivider /> | ||
<StyledActionBody> | ||
<StyledActionLabel>{action}</StyledActionLabel> | ||
{Object.entries(executionParams).map(([property, value]) => ( | ||
<div key={property}> | ||
<StyledPropertyLabel>{property}:</StyledPropertyLabel>{' '} | ||
{value} | ||
</div> | ||
))} | ||
</StyledActionBody> | ||
</StyledAction> | ||
); | ||
}; |
22 changes: 22 additions & 0 deletions
22
...EventsDetails.tsx/ProjectActionsEventsDetailsSource/ProjectActionsEventsDetailsSource.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { IObservableEvent } from 'interfaces/action'; | ||
import { ProjectActionsEventsDetailsSourceIncomingWebhook } from './ProjectActionsEventsDetailsSourceIncomingWebhook'; | ||
|
||
interface IProjectActionsEventsDetailsSourceProps { | ||
observableEvent: IObservableEvent; | ||
} | ||
|
||
export const ProjectActionsEventsDetailsSource = ({ | ||
observableEvent, | ||
}: IProjectActionsEventsDetailsSourceProps) => { | ||
const { source } = observableEvent; | ||
|
||
if (source === 'incoming-webhook') { | ||
return ( | ||
<ProjectActionsEventsDetailsSourceIncomingWebhook | ||
observableEvent={observableEvent} | ||
/> | ||
); | ||
} | ||
|
||
return null; | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this and the display change above affect other UI components? I'm just worried this might cause unnoticed changes a few days prior a release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SidePanelList
is a new component introduced in #6317 so I wouldn't worry about it.The only other place where we're using it, Incoming webhook events, also looks correct with this change.