From aaf421144541d584456091b0f29c61180819f3ef Mon Sep 17 00:00:00 2001 From: noah Date: Mon, 8 Nov 2021 21:46:37 +0900 Subject: [PATCH 1/2] Add the event handler for review in the page --- internal/server/router.go | 4 ++-- ui/src/redux/deployment.tsx | 5 +++++ ui/src/views/Deployment.tsx | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/server/router.go b/internal/server/router.go index 2b292776..19837457 100644 --- a/internal/server/router.go +++ b/internal/server/router.go @@ -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"}, diff --git a/ui/src/redux/deployment.tsx b/ui/src/redux/deployment.tsx index a1f3e080..9c95b65d 100644 --- a/ui/src/redux/deployment.tsx +++ b/ui/src/redux/deployment.tsx @@ -187,6 +187,11 @@ export const deploymentSlice = createSlice({ } state.deployment = event.deployment + }, + handleReviewEvent: (state, action: PayloadAction) => { + state.reviews = state.reviews.map((review) => { + return (review.id === action.payload.review?.id)? action.payload.review : review + }) } }, extraReducers: builder => { diff --git a/ui/src/views/Deployment.tsx b/ui/src/views/Deployment.tsx index d8d1093a..08985791 100644 --- a/ui/src/views/Deployment.tsx +++ b/ui/src/views/Deployment.tsx @@ -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 () => { From 28d2774ac4a0cc48cf6fe2a9d74d026c6b96b39e Mon Sep 17 00:00:00 2001 From: noah Date: Mon, 8 Nov 2021 21:56:04 +0900 Subject: [PATCH 2/2] Fix the style of status steps --- ui/src/components/DeployConfirm.tsx | 2 +- ui/src/components/DeploymentStatusSteps.tsx | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ui/src/components/DeployConfirm.tsx b/ui/src/components/DeployConfirm.tsx index 41dd4985..ef1a9820 100644 --- a/ui/src/components/DeployConfirm.tsx +++ b/ui/src/components/DeployConfirm.tsx @@ -50,7 +50,7 @@ export default function DeployConfirm(props: DeployConfirmProps): JSX.Element { 0)? {marginBottom: 0} : {}} + style={(props.deployment.statuses && props.deployment.statuses.length > 0)? {marginBottom: 0} : {marginBottom: 12}} > {(props.deployment.statuses && props.deployment.statuses.length > 0)? diff --git a/ui/src/components/DeploymentStatusSteps.tsx b/ui/src/components/DeploymentStatusSteps.tsx index 3b24ef72..64ca30b4 100644 --- a/ui/src/components/DeploymentStatusSteps.tsx +++ b/ui/src/components/DeploymentStatusSteps.tsx @@ -11,13 +11,7 @@ interface DeploymentStatusStepsProps { export default function DeploymentStatusSteps(props: DeploymentStatusStepsProps): JSX.Element { return ( - + {props.statuses.map((status, idx) => { return (