Skip to content

Commit

Permalink
- app version = 4.7.16
Browse files Browse the repository at this point in the history
- display app info in console on startup
- added wait for startup error to display before alert
- updated My Business Registry breadcrumb
- updated Staff Dashboard breadcrumb
  • Loading branch information
Severin Beauvais committed Feb 22, 2024
1 parent 1db6273 commit 88d67c2
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
6 changes: 3 additions & 3 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-edit-ui",
"version": "4.7.15",
"version": "4.7.16",
"private": true,
"appName": "Edit UI",
"sbcName": "SBC Common Components",
Expand Down
6 changes: 4 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export default class App extends Mixins(CommonMixin, FilingTemplateMixin) {
haveData = false
/** The Update Current JS Date timer id. */
private updateCurrentJsDateId = 0
private updateCurrentJsDateId = null // may be number or NodeJS.Timeout
/** The route breadcrumbs list. */
get breadcrumbs (): Array<BreadcrumbIF> {
Expand Down Expand Up @@ -267,7 +267,9 @@ export default class App extends Mixins(CommonMixin, FilingTemplateMixin) {
/** The About text. */
get aboutText (): string {
return import.meta.env.ABOUT_TEXT
const aboutApp = import.meta.env.ABOUT_APP
const aboutSbc = import.meta.env.ABOUT_SBC
return `${aboutApp}<br>${aboutSbc}`
}
/** Get banner text. */
Expand Down
15 changes: 11 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import '@/assets/styles/overrides.scss'
import App from './App.vue'

// Helpers
import { GetFeatureFlag, InitLdClient, FetchConfig, Navigate } from '@/utils/'
import { GetFeatureFlag, InitLdClient, FetchConfig, Navigate, Sleep } from '@/utils/'
import KeycloakService from 'sbc-common-components/src/services/keycloak.services'

// get rid of "element implicitly has an 'any' type..."
Expand All @@ -41,8 +41,10 @@ Vue.use(Vuetify)
Vue.use(Affix)
Vue.use(Vuelidate)
Vue.use(Vue2Filters)

// Default options - https://github.com/apostrophecms/sanitize-html (under Default options)
Vue.use(VueSanitize)

const vuetify = new Vuetify({
iconfont: 'mdi',
theme: {
Expand All @@ -58,7 +60,8 @@ const vuetify = new Vuetify({
}
}
})
// For Vue 3: remove - consult assets team for a replacement.

// For Vue 3: remove - consult Assets team for a replacement.
Vue.use(TiptapVuetifyPlugin, {
vuetify,
iconsGroup: 'mdi'
Expand Down Expand Up @@ -110,7 +113,8 @@ async function start () {
}

// start Vue application
console.info('Starting app...') // eslint-disable-line no-console
const aboutApp = import.meta.env.ABOUT_APP
console.info(`Starting ${aboutApp}...`) // eslint-disable-line no-console
new Vue({
vuetify: vuetify,
router: getVueRouter(),
Expand All @@ -122,10 +126,13 @@ async function start () {
}

// execution and error handling
start().catch(error => {
start().catch(async (error) => {
console.error(error) // eslint-disable-line no-console
await Sleep(100) // wait for console error to be shown before alert

window.alert('There was an error starting this page. (See console for details.)\n' +
'Please try again later.')

// try to navigate to Business Registry home page
Navigate(sessionStorage.getItem('BUSINESSES_URL'))
})
13 changes: 10 additions & 3 deletions src/resources/BreadCrumbResources.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { BreadcrumbIF } from '@bcrs-shared-components/interfaces/'
import { createPinia, setActivePinia } from 'pinia'
import { useStore } from '@/store/store'

setActivePinia(createPinia())
const store = useStore()

/** Returns URL param string with Account ID if present, else empty string. */
function getParams (): string {
const accountId = JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id as string
return accountId ? `?accountid=${accountId}` : ''
}

/** Returns the breadcrumb to the entity (business) dashboard. */
export function getEntityDashboardBreadcrumb (): BreadcrumbIF {
const store = useStore()
const getOriginalLegalName = store.getOriginalLegalName
const getBusinessId = store.getBusinessId
return {
Expand All @@ -17,23 +21,26 @@ export function getEntityDashboardBreadcrumb (): BreadcrumbIF {
}
}

/** Returns the breadcrumb to the BC Registries dashboard. */
export function getRegistryDashboardBreadcrumb (): BreadcrumbIF {
return {
text: 'BC Registries Dashboard',
href: `${sessionStorage.getItem('REGISTRY_HOME_URL')}dashboard/${getParams()}`
}
}

/** Returns the breadcrumb to the My Business Registry page. */
export function getMyBusinessRegistryBreadcrumb (): BreadcrumbIF {
return {
text: 'My Business Registry',
href: `${sessionStorage.getItem('BUSINESSES_URL')}business/${getParams()}`
href: `${sessionStorage.getItem('BUSINESSES_URL')}account/${store.getAccountId}/business`
}
}

/** Returns the breadcrumb to the Staff dashboard. */
export function getStaffDashboardBreadcrumb (): BreadcrumbIF {
return {
text: 'Staff Dashboard',
href: `${sessionStorage.getItem('BUSINESSES_URL')}staff/${getParams()}`
href: `${sessionStorage.getItem('BUSINESSES_URL')}staff/dashboard/active`
}
}
11 changes: 4 additions & 7 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@ const appName = JSON.parse(packageJson).appName
const appVersion = JSON.parse(packageJson).version
const sbcName = JSON.parse(packageJson).sbcName
const sbcVersion = JSON.parse(packageJson).dependencies['sbc-common-components']
const aboutText1 = (appName && appVersion) ? `${appName} v${appVersion}` : ''
const aboutText2 = (sbcName && sbcVersion) ? `${sbcName} v${sbcVersion}` : ''
const aboutApp = (appName && appVersion) ? `${appName} v${appVersion}` : 'Unknown APP'
const aboutSbc = (sbcName && sbcVersion) ? `${sbcName} v${sbcVersion}` : 'Unknown SBC'

// https://vitejs.dev/config/
export default defineConfig(() => {
return {
define: {
'import.meta.env.ABOUT_TEXT':
(aboutText1 && aboutText2) ? `"${aboutText1}<br>${aboutText2}"`
: aboutText1 ? `"${aboutText1}"`
: aboutText2 ? `"${aboutText2}"`
: ''
'import.meta.env.ABOUT_APP': `"${aboutApp}"`,
'import.meta.env.ABOUT_SBC': `"${aboutSbc}"`
},
envPrefix: 'VUE_APP_', // Need to remove this after fixing vaults. Use import.meta.env with VUE_APP.
plugins: [
Expand Down

0 comments on commit 88d67c2

Please sign in to comment.