Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Fix to handle review events in the deployment page #213

Merged
merged 2 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/server/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ func NewRouter(c *RouterConfig) *gin.Engine {
r := gin.New()

r.Use(cors.New(cors.Config{
AllowOrigins: []string{"http://localhost:3000"},
// AllowAllOrigins: true,
// AllowOrigins: []string{"http://localhost:3000"},
AllowAllOrigins: true,
AllowCredentials: true,
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"},
AllowHeaders: []string{"Origin", "Authorization", "Accept", "Content-Length", "Content-Type"},
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/DeployConfirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function DeployConfirm(props: DeployConfirmProps): JSX.Element {
<Form.Item
{...layout}
label="Status"
style={(props.deployment.statuses && props.deployment.statuses.length > 0)? {marginBottom: 0} : {}}
style={(props.deployment.statuses && props.deployment.statuses.length > 0)? {marginBottom: 0} : {marginBottom: 12}}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes a look normal.

image

>
{(props.deployment.statuses && props.deployment.statuses.length > 0)?
<Collapse ghost>
Expand Down
8 changes: 1 addition & 7 deletions ui/src/components/DeploymentStatusSteps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ interface DeploymentStatusStepsProps {

export default function DeploymentStatusSteps(props: DeploymentStatusStepsProps): JSX.Element {
return (
<Timeline
style={{
position: "relative",
top: 15,
paddingBottom: 0
}}
>
<Timeline>
{props.statuses.map((status, idx) => {
return (
<Timeline.Item
Expand Down
5 changes: 5 additions & 0 deletions ui/src/redux/deployment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ export const deploymentSlice = createSlice({
}

state.deployment = event.deployment
},
handleReviewEvent: (state, action: PayloadAction<Event>) => {
state.reviews = state.reviews.map((review) => {
return (review.id === action.payload.review?.id)? action.payload.review : review
})
}
},
extraReducers: builder => {
Expand Down
1 change: 1 addition & 0 deletions ui/src/views/Deployment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default function DeploymentView(): JSX.Element {

const sub = subscribeEvents((event) => {
dispatch(slice.actions.handleDeploymentEvent(event))
dispatch(slice.actions.handleReviewEvent(event))
})

return () => {
Expand Down