File tree 2 files changed +38
-1
lines changed 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ export default function Project() {
92
92
const handleDelete = async ( ) => {
93
93
toast . success ( "Destroy sent successfully" ) ;
94
94
try {
95
+ // Update Project request status
95
96
const requestTypeData = {
96
97
projectid : projectId ,
97
98
status : "destroy" ,
@@ -112,6 +113,42 @@ export default function Project() {
112
113
) ;
113
114
}
114
115
116
+ const projectData = {
117
+ projectid : projectId ,
118
+ statuspm : "Pending" ,
119
+ statusops : "Pending" ,
120
+ } ;
121
+
122
+ const resProject = await fetch ( "/api/project" , {
123
+ method : "PUT" ,
124
+ headers : {
125
+ "Content-Type" : "application/json" ,
126
+ } ,
127
+ body : JSON . stringify ( projectData ) ,
128
+ } ) ;
129
+
130
+ if ( ! resProject . ok ) {
131
+ const errorMessage = await resRequesttype . text ( ) ;
132
+ throw new Error (
133
+ `Project API failed: ${ resRequesttype . status } - ${ errorMessage } `
134
+ ) ;
135
+ }
136
+
137
+ const resRequest = await fetch ( "/api/request" , {
138
+ method : "PUT" ,
139
+ headers : {
140
+ "Content-Type" : "application/json" ,
141
+ } ,
142
+ body : JSON . stringify ( projectData ) ,
143
+ } ) ;
144
+
145
+ if ( ! resRequest . ok ) {
146
+ const errorMessage = await resRequesttype . text ( ) ;
147
+ throw new Error (
148
+ `Project API failed: ${ resRequesttype . status } - ${ errorMessage } `
149
+ ) ;
150
+ }
151
+
115
152
router . push ( "/projectlist" ) ;
116
153
} catch ( error ) {
117
154
console . error ( "Error while deleting resource:" , error ) ;
Original file line number Diff line number Diff line change @@ -193,7 +193,6 @@ export default function ProjectMG() {
193
193
return ;
194
194
} else if ( event === "Approved" ) {
195
195
toast . success ( "Request approved" ) ;
196
- sendMessageToQueue ( projectId , "create-vm" ) ;
197
196
198
197
try {
199
198
const res = await fetch ( `/api/request/?projectId=${ projectId } ` , {
@@ -209,6 +208,7 @@ export default function ProjectMG() {
209
208
210
209
const data = await res . json ( ) ;
211
210
if ( data [ 0 ] . statuspm === event ) {
211
+ sendMessageToQueue ( projectId , "create-vm" ) ;
212
212
try {
213
213
const res = await fetch (
214
214
`/api/triggerdag/?dagId=idp&projectId=${ projectId } ` ,
You can’t perform that action at this time.
0 commit comments