From 55c63c5cb848479f4f95054d2fc1b064cd3fea7e Mon Sep 17 00:00:00 2001 From: noah Date: Tue, 8 Nov 2022 23:08:46 +0900 Subject: [PATCH] Add the refresh button for deploy --- ui/src/views/repoDeploy/index.tsx | 40 +++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/ui/src/views/repoDeploy/index.tsx b/ui/src/views/repoDeploy/index.tsx index 8937d609..8ed773d1 100644 --- a/ui/src/views/repoDeploy/index.tsx +++ b/ui/src/views/repoDeploy/index.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'; import { shallowEqual } from 'react-redux'; import { useParams } from 'react-router-dom'; import { PageHeader, Result, Button } from 'antd'; - +import { RedoOutlined } from '@ant-design/icons'; import { useAppSelector, useAppDispatch } from '../../redux/hooks'; import { DeploymentType, @@ -48,10 +48,13 @@ export default (): JSX.Element => { envs, env, currentDeployment, + branch, branches, branchStatuses, + commit, commits, commitStatuses, + tag, tags, tagStatuses, deploying, @@ -73,6 +76,24 @@ export default (): JSX.Element => { // eslint-disable-next-line }, [dispatch]); + const onClickRefresh = () => { + dispatch(fetchTags()); + if (tag) { + dispatch(checkTag()); + } + + dispatch(fetchBranches()); + if (branch) { + dispatch(checkBranch()); + // Fetch commits only when a branch is selected. + dispatch(fetchCommits()); + } + + if (commit) { + dispatch(checkCommit()); + } + }; + const onSelectEnv = (env: Env) => { dispatch(actions.setEnv(env)); dispatch(fetchCurrentDeploymentOfEnv(env)); @@ -150,6 +171,7 @@ export default (): JSX.Element => { } return ( { env?: Env; + onClickRefresh(): void; } function RepoDeploy({ + onClickRefresh, // Properities for the DeployForm component. envs, onSelectEnv, @@ -226,7 +250,19 @@ function RepoDeploy({ return (
- + } + onClick={onClickRefresh} + />, + ]} + />