From 21a38faf9fd008458da386f7a6785205efc409a1 Mon Sep 17 00:00:00 2001 From: Navaneeth Suresh Date: Sat, 26 Sep 2020 16:33:04 +0530 Subject: [PATCH] Make title meaningful after component creation --- .../components/JobStatusModal/JobStatusModal.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/scaffolder/src/components/JobStatusModal/JobStatusModal.tsx b/plugins/scaffolder/src/components/JobStatusModal/JobStatusModal.tsx index 87b70a9553..c531e0ec2c 100644 --- a/plugins/scaffolder/src/components/JobStatusModal/JobStatusModal.tsx +++ b/plugins/scaffolder/src/components/JobStatusModal/JobStatusModal.tsx @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React, { useEffect } from 'react'; +import React, { useState, useEffect } from 'react'; import { Dialog, LinearProgress, @@ -43,16 +43,19 @@ export const JobStatusModal = ({ entity, }: Props) => { const job = useJobPolling(jobId); + const [dialogTitle, setDialogTitle] = useState('Creating component...'); useEffect(() => { - if (job?.status === 'COMPLETED') onComplete(job); - }, [job, onComplete]); + if (job?.status === 'COMPLETED') { + setDialogTitle('Successfully created component'); + onComplete(job); + } else if (job?.status === 'FAILED') + setDialogTitle('Failed to create component'); + }, [job, onComplete, setDialogTitle]); return ( - - Creating Component... - + {dialogTitle} {!job ? (