@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
22import { shallowEqual } from 'react-redux' ;
33import { useParams } from 'react-router-dom' ;
44import { PageHeader , Result , Button } from 'antd' ;
5-
5+ import { RedoOutlined } from '@ant-design/icons' ;
66import { useAppSelector , useAppDispatch } from '../../redux/hooks' ;
77import {
88 DeploymentType ,
@@ -48,10 +48,13 @@ export default (): JSX.Element => {
4848 envs,
4949 env,
5050 currentDeployment,
51+ branch,
5152 branches,
5253 branchStatuses,
54+ commit,
5355 commits,
5456 commitStatuses,
57+ tag,
5558 tags,
5659 tagStatuses,
5760 deploying,
@@ -73,6 +76,24 @@ export default (): JSX.Element => {
7376 // eslint-disable-next-line
7477 } , [ dispatch ] ) ;
7578
79+ const onClickRefresh = ( ) => {
80+ dispatch ( fetchTags ( ) ) ;
81+ if ( tag ) {
82+ dispatch ( checkTag ( ) ) ;
83+ }
84+
85+ dispatch ( fetchBranches ( ) ) ;
86+ if ( branch ) {
87+ dispatch ( checkBranch ( ) ) ;
88+ // Fetch commits only when a branch is selected.
89+ dispatch ( fetchCommits ( ) ) ;
90+ }
91+
92+ if ( commit ) {
93+ dispatch ( checkCommit ( ) ) ;
94+ }
95+ } ;
96+
7697 const onSelectEnv = ( env : Env ) => {
7798 dispatch ( actions . setEnv ( env ) ) ;
7899 dispatch ( fetchCurrentDeploymentOfEnv ( env ) ) ;
@@ -150,6 +171,7 @@ export default (): JSX.Element => {
150171 }
151172 return (
152173 < RepoDeploy
174+ onClickRefresh = { onClickRefresh }
153175 envs = { envs }
154176 onSelectEnv = { onSelectEnv }
155177 onChangeType = { onChangeType }
@@ -178,9 +200,11 @@ interface RepoDeployProps
178200 extends DeployFormProps ,
179201 Omit < DynamicPayloadModalProps , 'visible' | 'env' | 'onClickCancel' > {
180202 env ?: Env ;
203+ onClickRefresh ( ) : void ;
181204}
182205
183206function RepoDeploy ( {
207+ onClickRefresh,
184208 // Properities for the DeployForm component.
185209 envs,
186210 onSelectEnv,
@@ -226,7 +250,19 @@ function RepoDeploy({
226250 return (
227251 < div >
228252 < div >
229- < PageHeader title = "Deploy" />
253+ < PageHeader
254+ title = "Deploy"
255+ extra = { [
256+ < Button
257+ key = "1"
258+ type = "text"
259+ shape = "circle"
260+ size = "large"
261+ icon = { < RedoOutlined /> }
262+ onClick = { onClickRefresh }
263+ /> ,
264+ ] }
265+ />
230266 </ div >
231267 < div style = { { padding : '16px 0px' } } >
232268 < DeployForm
0 commit comments