diff --git a/src/components/bcros/LoadingIcon.vue b/src/components/bcros/LoadingIcon.vue deleted file mode 100644 index 5bfa250e..00000000 --- a/src/components/bcros/LoadingIcon.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/src/components/bcros/LoadingModal.vue b/src/components/bcros/LoadingModal.vue new file mode 100644 index 00000000..7667d51b --- /dev/null +++ b/src/components/bcros/LoadingModal.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/components/bcros/businessDetails/Links.vue b/src/components/bcros/businessDetails/Links.vue index fb1382d4..f7f85e4e 100644 --- a/src/components/bcros/businessDetails/Links.vue +++ b/src/components/bcros/businessDetails/Links.vue @@ -22,8 +22,8 @@ const { isAllowedToFile, isDisableNonBenCorps } = useBcrosBusiness() const isCommentOpen = ref(false) const isDissolutionDialogOpen = ref(false) const { goToCreatePage } = useBcrosNavigate() +const ui = useBcrosDashboardUi() const filings = useBcrosFilings() -const isFetchingDataSpinner = ref(false) const isAllowedBusinessSummary = computed(() => !!currentBusinessIdentifier.value && @@ -122,7 +122,7 @@ const promptChangeBusinessInfo = () => { /** Request and Download Business Summary Document. */ const downloadBusinessSummary = async (): Promise => { - isFetchingDataSpinner.value = true + ui.fetchingData = true const businessId = currentBusiness.value.identifier const apiURL = useRuntimeConfig().public.legalApiURL const summaryDocument: DocumentI = { @@ -130,12 +130,16 @@ const downloadBusinessSummary = async (): Promise => { filename: `${businessId} Summary - ${todayIsoDateString()}.pdf`, link: `${apiURL}/businesses/${businessId}/documents/summary` } - - const blob = await fetchDocuments(summaryDocument.link) // todo: show alert box on error - if (blob) { - saveBlob(blob, summaryDocument.filename) + try { + const blob = await fetchDocuments(summaryDocument.link) + if (blob) { + saveBlob(blob, summaryDocument.filename) + } + } catch (error) { + console.error('Failed to download business summary.', error) + // TO-DO: #25125 - show the download error dialog } - isFetchingDataSpinner.value = false + ui.fetchingData = false } /** Creates a draft filing and navigates to the Create UI to file a company dissolution filing. */ @@ -183,24 +187,6 @@ const contacts = getContactInfo('registries') @@ -103,6 +105,7 @@ const { isAllowedToFile, isBaseCompany, isDisableNonBenCorps, isEntityCoop, isEn const { currentBusiness } = storeToRefs(useBcrosBusiness()) const { isBootstrapFiling } = useBcrosBusinessBootstrap() const { goToEditPage } = useBcrosNavigate() +const ui = useBcrosDashboardUi() const isCommentOpen = ref(false) const filings = useBcrosFilings() @@ -323,14 +326,24 @@ const actions: any[][] = [[ } ]] -const handleButtonClick = () => { +const handleButtonClick = async () => { // toggle expansion state isExpanded.value = !isExpanded.value // if the filing has documentsLink but the documents list is empty // (i.e., when View More is clicked for the first time), load the documents list if (filing.value.documents === undefined && filing.value.documentsLink) { - loadDocumentList(filing.value) + ui.fetchingData = true + + await loadDocumentList(filing.value).catch((error) => { + console.error('Failed to load the document list.', error) + // TO-DO: #25125 - show the download error dialog + }) + + // make the spinner display for another 250ms so it does not flash when the promise resolves quickly + await sleep(250) + + ui.fetchingData = false } } diff --git a/src/lang/en.json b/src/lang/en.json index f238a56a..a337674f 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -191,7 +191,8 @@ "act": "Act", "the": "The", "company": "Company", - "fetchingData": "Loading...", + "fetchingData": "Fetching Data", + "loadingDashboard": "Loading Dashboard", "notifications": "Notifications", "pendingNotifications": "No notifications | You have {n} pending approval | You have {n} pending approvals", "notificationSubLabel": "{n} team member require approval to access this account | {n} team members require approval to access this account" diff --git a/src/layouts/business.vue b/src/layouts/business.vue index 62ff8b0c..a34f2e63 100644 --- a/src/layouts/business.vue +++ b/src/layouts/business.vue @@ -1,8 +1,9 @@