aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/components/CloseBugButton/CloseBugButton.tsx
diff options
context:
space:
mode:
authorCláudio <claudio.engdist@gmail.com>2021-02-02 20:27:48 -0300
committerCláudio <claudio.engdist@gmail.com>2021-02-02 20:27:48 -0300
commitb7ec2404b031257ea30f46d4d7f92a498ac906db (patch)
tree017aaf872e4dd15ccd0ab186f333a8874a358b8a /webui/src/components/CloseBugButton/CloseBugButton.tsx
parent7b1b77dc444518a07779e836ec0c4c6b9406bbf9 (diff)
downloadgit-bug-b7ec2404b031257ea30f46d4d7f92a498ac906db.tar.gz
Fix #546
- Fixing code review requests
Diffstat (limited to 'webui/src/components/CloseBugButton/CloseBugButton.tsx')
-rw-r--r--webui/src/components/CloseBugButton/CloseBugButton.tsx16
1 files changed, 11 insertions, 5 deletions
diff --git a/webui/src/components/CloseBugButton/CloseBugButton.tsx b/webui/src/components/CloseBugButton/CloseBugButton.tsx
index 9aca6fdd..19f56cab 100644
--- a/webui/src/components/CloseBugButton/CloseBugButton.tsx
+++ b/webui/src/components/CloseBugButton/CloseBugButton.tsx
@@ -2,22 +2,24 @@ import React from 'react';
import Button from '@material-ui/core/Button';
+import { BugFragment } from 'src/pages/bug/Bug.generated';
import { TimelineDocument } from 'src/pages/bug/TimelineQuery.generated';
import { useCloseBugMutation } from './CloseBug.generated';
interface Props {
- bugId: string;
+ bug: BugFragment;
+ disabled: boolean;
}
-function CloseBugButton({ bugId }: Props) {
+function CloseBugButton({ bug, disabled }: Props) {
const [closeBug, { loading, error }] = useCloseBugMutation();
function closeBugAction() {
closeBug({
variables: {
input: {
- prefix: bugId,
+ prefix: bug.id,
},
},
refetchQueries: [
@@ -25,7 +27,7 @@ function CloseBugButton({ bugId }: Props) {
{
query: TimelineDocument,
variables: {
- id: bugId,
+ id: bug.id,
first: 100,
},
},
@@ -39,7 +41,11 @@ function CloseBugButton({ bugId }: Props) {
return (
<div>
- <Button variant="contained" onClick={() => closeBugAction()}>
+ <Button
+ variant="contained"
+ onClick={() => closeBugAction()}
+ disabled={bug.status === 'CLOSED' || disabled}
+ >
Close issue
</Button>
</div>