@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
2
2
import { shallowEqual } from 'react-redux' ;
3
3
import { useParams } from 'react-router-dom' ;
4
4
import { PageHeader , Result , Button } from 'antd' ;
5
-
5
+ import { RedoOutlined } from '@ant-design/icons' ;
6
6
import { useAppSelector , useAppDispatch } from '../../redux/hooks' ;
7
7
import {
8
8
DeploymentType ,
@@ -48,10 +48,13 @@ export default (): JSX.Element => {
48
48
envs,
49
49
env,
50
50
currentDeployment,
51
+ branch,
51
52
branches,
52
53
branchStatuses,
54
+ commit,
53
55
commits,
54
56
commitStatuses,
57
+ tag,
55
58
tags,
56
59
tagStatuses,
57
60
deploying,
@@ -73,6 +76,24 @@ export default (): JSX.Element => {
73
76
// eslint-disable-next-line
74
77
} , [ dispatch ] ) ;
75
78
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
+
76
97
const onSelectEnv = ( env : Env ) => {
77
98
dispatch ( actions . setEnv ( env ) ) ;
78
99
dispatch ( fetchCurrentDeploymentOfEnv ( env ) ) ;
@@ -150,6 +171,7 @@ export default (): JSX.Element => {
150
171
}
151
172
return (
152
173
< RepoDeploy
174
+ onClickRefresh = { onClickRefresh }
153
175
envs = { envs }
154
176
onSelectEnv = { onSelectEnv }
155
177
onChangeType = { onChangeType }
@@ -178,9 +200,11 @@ interface RepoDeployProps
178
200
extends DeployFormProps ,
179
201
Omit < DynamicPayloadModalProps , 'visible' | 'env' | 'onClickCancel' > {
180
202
env ?: Env ;
203
+ onClickRefresh ( ) : void ;
181
204
}
182
205
183
206
function RepoDeploy ( {
207
+ onClickRefresh,
184
208
// Properities for the DeployForm component.
185
209
envs,
186
210
onSelectEnv,
@@ -226,7 +250,19 @@ function RepoDeploy({
226
250
return (
227
251
< div >
228
252
< 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
+ />
230
266
</ div >
231
267
< div style = { { padding : '16px 0px' } } >
232
268
< DeployForm
0 commit comments