@@ -12,7 +12,8 @@ import {
1212 OPEN ,
1313 REJECTED ,
1414 MERGED ,
15- SUBMITTED
15+ SUBMITTED ,
16+ CLOSE
1617} from "../components/constants"
1718import ProgressBar from 'react-bootstrap/ProgressBar'
1819import { extractID , status , iconTypes , getDays } from "../components/utils"
@@ -71,12 +72,13 @@ export const ChangeRequestsPage = () => {
7172 }
7273
7374
74- const countType = { [ OPEN ] : 0 , [ SUBMITTED ] :0 , [ REJECTED ] :0 , [ MERGED ] :0 }
75+ const countType = { [ OPEN ] : 0 , [ SUBMITTED ] :0 , [ REJECTED ] :0 , [ MERGED ] :0 , [ CLOSE ] : 0 }
7576 const activeClassNameType = {
7677 [ OPEN ] : "text-decoration-underline text-light" ,
7778 [ SUBMITTED ] : "text-decoration-underline text-warning" ,
7879 [ REJECTED ] : "text-decoration-underline text-danger" ,
79- [ MERGED ] : "text-decoration-underline success__color"
80+ [ MERGED ] : "text-decoration-underline success__color" ,
81+ [ CLOSE ] : "text-decoration-underline text-danger" ,
8082 }
8183
8284 function getActiveClassName ( filter , status ) {
@@ -120,6 +122,12 @@ export const ChangeRequestsPage = () => {
120122 < span className = { `${ getActiveClassName ( filter , REJECTED ) } ` } > { countType [ REJECTED ] } { REJECTED } </ span >
121123 </ small >
122124 </ Button >
125+ < Button variant = "dark" onClick = { ( e ) => displayCRs ( CLOSE ) } className = "btn bg-transparent border-0 text-gray" >
126+ < small className = "text-gray fw-bold" >
127+ { iconTypes [ CLOSE ] }
128+ < span className = { `${ getActiveClassName ( filter , CLOSE ) } ` } > { countType [ CLOSE ] } { CLOSE } </ span >
129+ </ small >
130+ </ Button >
123131 </ Stack >
124132 </ React . Fragment >
125133 }
@@ -142,6 +150,11 @@ export const ChangeRequestsPage = () => {
142150 setShowUpdateChangeRequestID ( id )
143151 }
144152
153+ const closeCR = ( id ) => {
154+ setUpdateOperation ( CLOSE )
155+ setShowUpdateChangeRequestID ( id )
156+ }
157+
145158 const reopenCR = ( id ) => {
146159 setUpdateOperation ( OPEN )
147160 setShowUpdateChangeRequestID ( id )
@@ -165,12 +178,14 @@ export const ChangeRequestsPage = () => {
165178 </ Button >
166179 < Button className = "bg-success text-dark mr-4 btn btn-sm" onClick = { ( ) => goToDiffPage ( item ) } >
167180 View Diff</ Button >
181+ < Button className = "bg-danger text-dark mr-4 btn btn-sm" title = "you are closing your CR" onClick = { ( ) => closeCR ( id ) } > Close</ Button >
168182
169183 </ React . Fragment >
170184 case SUBMITTED :
171185 return < React . Fragment >
172186 < Button title = "go to diff page to review" className = "btn btn-warning mr-2 btn-sm text-dark" onClick = { ( ) => goToDiffPage ( item ) } > Review</ Button >
173187 < Button className = "bg-light text-dark mr-4 btn btn-sm" onClick = { ( ) => reopenCR ( id ) } > Reopen</ Button >
188+ < Button className = "bg-danger text-dark mr-4 btn btn-sm" title = "you are closing your CR" onClick = { ( ) => closeCR ( id ) } > Close</ Button >
174189 </ React . Fragment >
175190 case REJECTED :
176191 return < React . Fragment >
@@ -182,6 +197,8 @@ export const ChangeRequestsPage = () => {
182197 < Button className = "bg-success text-dark mr-4 btn btn-sm" onClick = { ( ) => goToDiffPage ( item ) } > View Approved Diff</ Button >
183198 < Button className = "bg-light text-dark mr-4 btn btn-sm" onClick = { ( ) => reopenCR ( id ) } > Reopen</ Button >
184199 </ React . Fragment >
200+ case CLOSE :
201+ return ""
185202 }
186203 }
187204
0 commit comments