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

Commit e7733f9

Browse files
author
Noah Lee
authored
Add the refresh button for deploy (#500)
1 parent 12ec42d commit e7733f9

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

Diff for: ui/src/views/repoDeploy/index.tsx

+38-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
22
import { shallowEqual } from 'react-redux';
33
import { useParams } from 'react-router-dom';
44
import { PageHeader, Result, Button } from 'antd';
5-
5+
import { RedoOutlined } from '@ant-design/icons';
66
import { useAppSelector, useAppDispatch } from '../../redux/hooks';
77
import {
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

183206
function 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

Comments
 (0)