Skip to content

Commit

Permalink
21574 - Local Filing Return to Dashboard (#692)
Browse files Browse the repository at this point in the history
* add new dashboard url

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated standalone office address change

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated standalone office address change -2

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated standalone director  change

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated AGM

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated Amalg and ContIn

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated Continuation-out and Amalg selection

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated vaults.env

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated common mixin

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated filing ID param

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated navigateToBusinessDashboard function and check condition

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated comments

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* fixed save resume bug

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated bannerbreadcrumb breadcrumbs

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated bannerbreadcrumb breadcrumbs 2

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated configuration store

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* added unit tests for new dashboard navigate

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* updated version number

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

* remove Obsolete comment.

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>

---------

Signed-off-by: Qin <Arwen.Qin@gov.bc.ca>
  • Loading branch information
ArwenQin authored Sep 10, 2024
1 parent 29cc2f6 commit 2ab102b
Show file tree
Hide file tree
Showing 24 changed files with 339 additions and 80 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ VUE_APP_DASHBOARD_URL="https://dev.business.bcregistry.gov.bc.ca/"
VUE_APP_SITEMINDER_LOGOUT_URL="https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi"
VUE_APP_BUSINESS_CREATE_URL="https://dev.create.business.bcregistry.gov.bc.ca/"
VUE_APP_BUSINESS_EDIT_URL="https://dev.edit.business.bcregistry.gov.bc.ca/"
VUE_APP_BUSINESS_DASH_URL="https://business-dashboard-dev.web.app/"

#vaults API
VUE_APP_AUTH_API_URL="https://auth-api-dev.apps.silver.devops.gov.bc.ca"
Expand Down
1 change: 1 addition & 0 deletions devops/vaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ VUE_APP_DASHBOARD_URL="op://web-url/$APP_ENV/business/DASHBOARD_URL"
VUE_APP_SITEMINDER_LOGOUT_URL="op://web-url/$APP_ENV/siteminder/SITEMINDER_LOGOUT_URL"
VUE_APP_BUSINESS_CREATE_URL="op://web-url/$APP_ENV/business-create/BUSINESS_CREATE_URL"
VUE_APP_BUSINESS_EDIT_URL="op://web-url/$APP_ENV/business-edit/BUSINESS_EDIT_URL"
VUE_APP_BUSINESS_DASH_URL="op://web-url/$APP_ENV/business-dash/BUSINESS_DASH_URL"

#vaults API
VUE_APP_AUTH_API_URL="op://API/$APP_ENV/auth-api/AUTH_API_URL"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-filings-ui",
"version": "7.3.22",
"version": "7.3.23",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down
6 changes: 2 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ import {
} from '@/components/dialogs'
import {
ConfigJson,
getDashboardBreadcrumb,
getMyBusinessRegistryBreadcrumb,
getRegistryDashboardBreadcrumb,
getStaffDashboardBreadcrumb
Expand Down Expand Up @@ -309,10 +310,7 @@ export default class App extends Mixins(
get breadcrumbs (): Array<BreadcrumbIF> {
const breadcrumbs = this.$route?.meta?.breadcrumb
const crumbs: Array<BreadcrumbIF> = [
{
text: this.getEntityName || 'Unknown Name',
to: { name: Routes.DASHBOARD }
},
getDashboardBreadcrumb(this.getEntityName, this.getBusinessDashUrl, this.getIdentifier),
...(breadcrumbs || [])
]
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/configuration-state-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface ConfigurationStateIF {
VUE_APP_BUSINESS_EDIT_URL: string,
VUE_APP_BUSINESS_FILING_LD_CLIENT_ID: string,
VUE_APP_BUSINESSES_URL: string,
VUE_APP_BUSINESS_DASH_URL: string,
VUE_APP_CORPORATE_ONLINE_URL: string,
VUE_APP_DASHBOARD_URL: string,
VUE_APP_HOTJAR_ID: string
Expand Down
27 changes: 27 additions & 0 deletions src/mixins/common-mixin.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { Component, Vue } from 'vue-property-decorator'
import { isEqual } from 'lodash'
import omit from 'lodash.omit'
import { Getter } from 'pinia-class'
import { useConfigurationStore } from '@/stores'
import { GetFeatureFlag, navigate } from '@/utils'
import { Routes } from '@/enums'

/**
* Mixin that provides some useful common utilities.
*/
@Component({})
export default class CommonMixin extends Vue {
@Getter(useConfigurationStore) getBusinessDashUrl!: string

/** True if Vitest is running the code. */
get isVitestRunning (): boolean {
return (import.meta.env.VITEST !== undefined)
Expand Down Expand Up @@ -68,4 +74,25 @@ export default class CommonMixin extends Vue {
}
return true
}

/**
* Navigates to the dashboard page, optionally with a filing ID.
* @param identifier The identifier to include in the dashboard URL
* @param filingId The filing ID to include in the dashboard URL (optional, defaults to null)
*/
protected navigateToBusinessDashboard (identifier: string, filingId: number = null): void {
if (GetFeatureFlag('use-business-dashboard')) {
let dashboardUrl = `${this.getBusinessDashUrl}/${identifier}`
if (filingId !== null) {
dashboardUrl += `?filing_id=${filingId.toString()}`
}
navigate(dashboardUrl)
} else {
const route: any = { name: Routes.DASHBOARD }
if (filingId !== null) {
route.query = { filing_id: filingId.toString() }
}
this.$router.push(route).catch(() => {}) // Ignore potential navigation abort errors
}
}
}
16 changes: 16 additions & 0 deletions src/resources/BreadcrumbResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { BreadcrumbIF } from '@bcrs-shared-components/interfaces'
import { Routes } from '@/enums'
import { createPinia, setActivePinia } from 'pinia'
import { useAuthenticationStore } from '@/stores'
import { GetFeatureFlag } from '@/utils'

setActivePinia(createPinia())
const authenticationStore = useAuthenticationStore()
Expand Down Expand Up @@ -44,3 +45,18 @@ export function getDigitalCredentialBreadcrumb (): BreadcrumbIF {
to: { name: Routes.DIGITAL_CREDENTIALS }
}
}

/** Returns the breadcrumb to the appropriate dashboard based on the feature flag. */
export function getDashboardBreadcrumb (entityName: string, businessDashUrl: string, identifier: string): BreadcrumbIF {
if (GetFeatureFlag('use-business-dashboard')) {
return {
text: entityName || 'Unknown Name',
href: `${businessDashUrl}/${identifier}`
}
} else {
return {
text: entityName || 'Unknown Name',
to: { name: Routes.DASHBOARD }
}
}
}
4 changes: 4 additions & 0 deletions src/stores/configurationStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export const useConfigurationStore = defineStore('configuration', {
return state.configuration?.VUE_APP_BUSINESSES_URL || ''
},

getBusinessDashUrl (state: ConfigurationStateIF): string {
return state.configuration?.VUE_APP_BUSINESS_DASH_URL || ''
},

getCorporateOnlineUrl (state: ConfigurationStateIF): string {
return state.configuration?.VUE_APP_CORPORATE_ONLINE_URL || ''
},
Expand Down
3 changes: 2 additions & 1 deletion src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const defaultFlagSet: LDFlagSet = {
'supported-correction-entities': [],
'supported-dissolution-entities': [],
'supported-put-back-on-entities': [],
'supported-restoration-entities': []
'supported-restoration-entities': [],
'use-business-dashboard': false
}

/**
Expand Down
17 changes: 7 additions & 10 deletions src/views/AgmExtension.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ import AgmExtensionHelp from '@/components/AgmExtension/AgmExtensionHelp.vue'
import ExtensionRequest from '@/components/AgmExtension/ExtensionRequest.vue'
import { CommonMixin, DateMixin, FilingMixin, ResourceLookupMixin } from '@/mixins'
import { LegalServices } from '@/services/'
import { Routes, SaveErrorReasons } from '@/enums'
import { SaveErrorReasons } from '@/enums'
import { FilingCodes, FilingTypes } from '@bcrs-shared-components/enums'
import { AgmExtEvalIF, ConfirmDialogType, EmptyAgmExtEval } from '@/interfaces'
import { useBusinessStore, useConfigurationStore, useFilingHistoryListStore, useRootStore } from '@/stores'
Expand Down Expand Up @@ -274,11 +274,10 @@ export default class AgmExtension extends Mixins(CommonMixin, DateMixin, FilingM
// this is the id of THIS filing
// it must be 0 (meaning new filing) -- we do not support resuming a draft filing
// otherwise, go back to dashboard
this.filingId = +this.$route.query.filingId // number or NaN
// if required data isn't set, go back to dashboard
if (!this.getIdentifier || this.filingId !== 0) {
this.$router.push({ name: Routes.DASHBOARD })
if (this.filingId !== 0) {
this.navigateToBusinessDashboard(this.getIdentifier)
}
}
Expand Down Expand Up @@ -384,7 +383,7 @@ export default class AgmExtension extends Mixins(CommonMixin, DateMixin, FilingM
navigate(payUrl)
} else {
// route to dashboard with filing id parameter
this.$router.push({ name: Routes.DASHBOARD, query: { filing_id: this.filingId.toString() } })
this.navigateToBusinessDashboard(this.getIdentifier, this.filingId)
}
} else {
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -476,8 +475,7 @@ export default class AgmExtension extends Mixins(CommonMixin, DateMixin, FilingM
// check if there are no data changes
if (!this.haveChanges || force) {
// route to dashboard
this.$router.push({ name: Routes.DASHBOARD })
.catch(() => {}) // ignore error in case navigation was aborted
this.navigateToBusinessDashboard(this.getIdentifier)
return
}
Expand All @@ -500,8 +498,7 @@ export default class AgmExtension extends Mixins(CommonMixin, DateMixin, FilingM
// ignore changes
this.haveChanges = false
// route to dashboard
this.$router.push({ name: Routes.DASHBOARD })
.catch(() => {}) // ignore error in case navigation was aborted
this.navigateToBusinessDashboard(this.getIdentifier)
})
}
Expand Down
17 changes: 7 additions & 10 deletions src/views/AgmLocationChg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ import { ConfirmDialog, PaymentErrorDialog } from '@/components/dialogs'
import { CommonMixin, DateMixin, FilingMixin, ResourceLookupMixin } from '@/mixins'
import { ExpandableHelp } from '@bcrs-shared-components/expandable-help'
import { LegalServices } from '@/services/'
import { Routes, SaveErrorReasons } from '@/enums'
import { SaveErrorReasons } from '@/enums'
import { FilingCodes, FilingTypes } from '@bcrs-shared-components/enums'
import { ConfirmDialogType } from '@/interfaces'
import { useBusinessStore, useConfigurationStore, useRootStore } from '@/stores'
Expand Down Expand Up @@ -407,11 +407,10 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, Filin
// this is the id of THIS filing
// it must be 0 (meaning new filing) -- we do not support resuming a draft filing
// otherwise, go back to dashboard
this.filingId = +this.$route.query.filingId // number or NaN
// if required data isn't set, go back to dashboard
if (!this.getIdentifier || this.filingId !== 0) {
this.$router.push({ name: Routes.DASHBOARD })
if (this.filingId !== 0) {
this.navigateToBusinessDashboard(this.getIdentifier)
}
}
Expand Down Expand Up @@ -501,7 +500,7 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, Filin
navigate(payUrl)
} else {
// route to dashboard with filing id parameter
this.$router.push({ name: Routes.DASHBOARD, query: { filing_id: this.filingId.toString() } })
this.navigateToBusinessDashboard(this.getIdentifier, this.filingId)
}
} else {
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -583,8 +582,7 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, Filin
// check if there are no data changes
if (!this.haveChanges || force) {
// route to dashboard
this.$router.push({ name: Routes.DASHBOARD })
.catch(() => {}) // ignore error in case navigation was aborted
this.navigateToBusinessDashboard(this.getIdentifier)
return
}
Expand All @@ -607,8 +605,7 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, Filin
// ignore changes
this.haveChanges = false
// route to dashboard
this.$router.push({ name: Routes.DASHBOARD })
.catch(() => {}) // ignore error in case navigation was aborted
this.navigateToBusinessDashboard(this.getIdentifier)
})
}
Expand Down
16 changes: 8 additions & 8 deletions src/views/AmalgamationOut.vue
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ import { ConfirmDialog, ResumeErrorDialog, SaveErrorDialog }
from '@/components/dialogs'
import { CommonMixin, DateMixin, FilingMixin, ResourceLookupMixin } from '@/mixins'
import { EnumUtilities, LegalServices } from '@/services/'
import { EffectOfOrderTypes, FilingStatus, Routes, SaveErrorReasons } from '@/enums'
import { EffectOfOrderTypes, FilingStatus, SaveErrorReasons } from '@/enums'
import { FilingCodes, FilingTypes } from '@bcrs-shared-components/enums'
import { ConfirmDialogType } from '@/interfaces'
import { CourtOrderPoa } from '@bcrs-shared-components/court-order-poa'
Expand Down Expand Up @@ -515,8 +515,8 @@ export default class AmalgamationOut extends Mixins(CommonMixin, DateMixin, Fili
this.filingId = +this.$route.query.filingId // number or NaN
// if required data isn't set, go back to dashboard
if (!this.getIdentifier || isNaN(this.filingId)) {
this.$router.push({ name: Routes.DASHBOARD })
if (isNaN(this.filingId)) {
this.navigateToBusinessDashboard(this.getIdentifier)
}
}
Expand Down Expand Up @@ -680,6 +680,8 @@ export default class AmalgamationOut extends Mixins(CommonMixin, DateMixin, Fili
onClickSaveResumeFinish (): void {
// safety check
if (this.filingId > 0) {
// changes were saved, so clear flag
this.haveChanges = false
// changes were saved, so go to dashboard
this.goToDashboard(true)
} else {
Expand Down Expand Up @@ -760,7 +762,7 @@ export default class AmalgamationOut extends Mixins(CommonMixin, DateMixin, Fili
navigate(payUrl)
} else {
// route to dashboard with filing id parameter
this.$router.push({ name: Routes.DASHBOARD, query: { filing_id: this.filingId.toString() } })
this.navigateToBusinessDashboard(this.getIdentifier, this.filingId)
}
} else {
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -860,8 +862,7 @@ export default class AmalgamationOut extends Mixins(CommonMixin, DateMixin, Fili
// check if there are no data changes
if (!this.haveChanges || force) {
// route to dashboard
this.$router.push({ name: Routes.DASHBOARD })
.catch(() => {}) // ignore error in case navigation was aborted
this.navigateToBusinessDashboard(this.getIdentifier)
return
}
Expand All @@ -884,8 +885,7 @@ export default class AmalgamationOut extends Mixins(CommonMixin, DateMixin, Fili
// ignore changes
this.haveChanges = false
// route to dashboard
this.$router.push({ name: Routes.DASHBOARD })
.catch(() => {}) // ignore error in case navigation was aborted
this.navigateToBusinessDashboard(this.getIdentifier)
})
}
Expand Down
8 changes: 7 additions & 1 deletion src/views/AmalgamationSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
import { AmalgamationTypes, CorrectNameOptions, FilingTypes } from '@bcrs-shared-components/enums'
import { AmlRoles, AmlTypes, Routes } from '@/enums'
import { LegalServices } from '@/services'
import { navigate } from '@/utils'
import { GetFeatureFlag, navigate } from '@/utils'
import { TechnicalErrorDialog } from '@/components/dialogs'
@Component({
Expand All @@ -162,6 +162,7 @@ import { TechnicalErrorDialog } from '@/components/dialogs'
export default class AmalgamationSelection extends Vue {
@Getter(useAuthenticationStore) getAccountId!: string
@Getter(useConfigurationStore) getCreateUrl!: string
@Getter(useConfigurationStore) getBusinessDashUrl!: string
@Getter(useRootStore) getBusinessEmail!: string
@Getter(useRootStore) getFullPhoneNumber!: string
@Getter(useBusinessStore) getIdentifier!: string
Expand All @@ -188,6 +189,11 @@ export default class AmalgamationSelection extends Vue {
created (): void {
// if required data isn't set, go back to dashboard
if (!this.getIdentifier) {
if (GetFeatureFlag('use-business-dashboard')) {
const dashboardUIUrl = `${this.getBusinessDashUrl}/${this.getIdentifier}`
navigate(dashboardUIUrl)
return
}
this.$router.push({ name: Routes.DASHBOARD })
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/views/AnnualReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ import { ConfirmDialog, FetchErrorDialog, PaymentErrorDialog, ResumeErrorDialog,
StaffPaymentDialog } from '@/components/dialogs'
import { CommonMixin, DateMixin, FilingMixin, ResourceLookupMixin } from '@/mixins'
import { LegalServices } from '@/services/'
import { FilingStatus, Routes, SaveErrorReasons } from '@/enums'
import { FilingStatus, SaveErrorReasons } from '@/enums'
import { FilingCodes, FilingTypes, StaffPaymentOptions } from '@bcrs-shared-components/enums'
import { ConfirmDialogType, StaffPaymentIF } from '@/interfaces'
import { useBusinessStore, useConfigurationStore, useRootStore } from '@/stores'
Expand Down Expand Up @@ -915,6 +915,8 @@ export default class AnnualReport extends Mixins(CommonMixin, DateMixin, FilingM
onClickSaveResumeFinish (): void {
// safety check
if (this.filingId > 0) {
// changes were saved, so clear flag
this.haveChanges = false
// changes were saved, so go to dashboard
this.goToDashboard(true)
} else {
Expand Down Expand Up @@ -988,7 +990,7 @@ export default class AnnualReport extends Mixins(CommonMixin, DateMixin, FilingM
navigate(payUrl)
} else {
// route to dashboard with filing id parameter
this.$router.push({ name: Routes.DASHBOARD, query: { filing_id: this.filingId.toString() } })
this.navigateToBusinessDashboard(this.getIdentifier, this.filingId)
}
} else {
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -1155,8 +1157,7 @@ export default class AnnualReport extends Mixins(CommonMixin, DateMixin, FilingM
// check if there are no data changes
if (!this.haveChanges || force) {
// route to dashboard
this.$router.push({ name: Routes.DASHBOARD })
.catch(() => {}) // ignore error in case navigation was aborted
this.navigateToBusinessDashboard(this.getIdentifier)
return
}
Expand All @@ -1179,8 +1180,7 @@ export default class AnnualReport extends Mixins(CommonMixin, DateMixin, FilingM
// ignore changes
this.haveChanges = false
// route to dashboard
this.$router.push({ name: Routes.DASHBOARD })
.catch(() => {}) // ignore error in case navigation was aborted
this.navigateToBusinessDashboard(this.getIdentifier)
})
}
Expand Down
Loading

0 comments on commit 2ab102b

Please sign in to comment.