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

Commit 8031672

Browse files
author
Noah Hanjun Lee
authored
Fix to handle review events in the deployment page (#213)
* Add the event handler for review in the page * Fix the style of status steps
1 parent 28d57de commit 8031672

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

internal/server/router.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ func NewRouter(c *RouterConfig) *gin.Engine {
9393
r := gin.New()
9494

9595
r.Use(cors.New(cors.Config{
96-
AllowOrigins: []string{"http://localhost:3000"},
97-
// AllowAllOrigins: true,
96+
// AllowOrigins: []string{"http://localhost:3000"},
97+
AllowAllOrigins: true,
9898
AllowCredentials: true,
9999
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"},
100100
AllowHeaders: []string{"Origin", "Authorization", "Accept", "Content-Length", "Content-Type"},

ui/src/components/DeployConfirm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default function DeployConfirm(props: DeployConfirmProps): JSX.Element {
5050
<Form.Item
5151
{...layout}
5252
label="Status"
53-
style={(props.deployment.statuses && props.deployment.statuses.length > 0)? {marginBottom: 0} : {}}
53+
style={(props.deployment.statuses && props.deployment.statuses.length > 0)? {marginBottom: 0} : {marginBottom: 12}}
5454
>
5555
{(props.deployment.statuses && props.deployment.statuses.length > 0)?
5656
<Collapse ghost>

ui/src/components/DeploymentStatusSteps.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ interface DeploymentStatusStepsProps {
1111

1212
export default function DeploymentStatusSteps(props: DeploymentStatusStepsProps): JSX.Element {
1313
return (
14-
<Timeline
15-
style={{
16-
position: "relative",
17-
top: 15,
18-
paddingBottom: 0
19-
}}
20-
>
14+
<Timeline>
2115
{props.statuses.map((status, idx) => {
2216
return (
2317
<Timeline.Item

ui/src/redux/deployment.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ export const deploymentSlice = createSlice({
187187
}
188188

189189
state.deployment = event.deployment
190+
},
191+
handleReviewEvent: (state, action: PayloadAction<Event>) => {
192+
state.reviews = state.reviews.map((review) => {
193+
return (review.id === action.payload.review?.id)? action.payload.review : review
194+
})
190195
}
191196
},
192197
extraReducers: builder => {

ui/src/views/Deployment.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export default function DeploymentView(): JSX.Element {
5959

6060
const sub = subscribeEvents((event) => {
6161
dispatch(slice.actions.handleDeploymentEvent(event))
62+
dispatch(slice.actions.handleReviewEvent(event))
6263
})
6364

6465
return () => {

0 commit comments

Comments
 (0)