Skip to content

Commit

Permalink
added FF + updated Edit UI URL (#135)
Browse files Browse the repository at this point in the history
* - disabled IA correction according to FF
- moved feature flags file to utils/
- added new feature flags
- deleted obsolete code

* - added Business ID as route parameter to Edit UI URL
  • Loading branch information
severinbeauvais authored Sep 1, 2020
1 parent 4e25a05 commit 268b207
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
10 changes: 8 additions & 2 deletions src/components/Dashboard/FilingHistoryList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
// Libraries
import axios from '@/axios-auth'
import { mapGetters, mapState } from 'vuex'
import { featureFlags } from '@/utils'
// Components
import ColinFiling from './ColinFiling.vue'
Expand Down Expand Up @@ -877,7 +878,7 @@ export default {
case FilingTypes.INCORPORATION_APPLICATION:
// redirect to Edit web app to correct this Incorporation Application
const editUrl = sessionStorage.getItem('EDIT_URL')
const url = `${editUrl}correction/?filingId=${item.filingId}`
const url = `${editUrl}${this.entityIncNo}/correction?corrected-id=${item.filingId}`
// assume Correct URL is always reachable
window.location.assign(url)
break
Expand Down Expand Up @@ -1085,7 +1086,12 @@ export default {
/** Whether to disable correction for this history item. */
disableCorrection (item: HistoryItemIF): boolean {
return (this.disableChanges || item.isCorrection || item.isFutureEffectiveIa || item.isColinFiling)
// feature flag code to disable correction for an Incorp App
const disableThisIaCorrection = (item.filingType === FilingTypes.INCORPORATION_APPLICATION &&
!featureFlags.getFlag('correction-ui-enabled'))
return (this.disableChanges || item.isCorrection || item.isFutureEffectiveIa || item.isColinFiling ||
disableThisIaCorrection)
}
},
Expand Down
2 changes: 0 additions & 2 deletions src/components/Dashboard/TodoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,6 @@ import { FilingStatus, FilingTypes } from '@/enums'
import { ANNUAL_REPORT, CORRECTION, STANDALONE_ADDRESSES, STANDALONE_DIRECTORS } from '@/constants'
import { FilingIF, TaskItemIF } from '@/interfaces'
import { featureFlags } from '@/common/FeatureFlags'
export default {
name: 'TodoList',
Expand Down
8 changes: 1 addition & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'vuetify/dist/vuetify.min.css'
import Vuelidate from 'vuelidate'
import Affix from 'vue-affix'
import Vue2Filters from 'vue2-filters' // needed by SbcFeeSummary
import { fetchConfig } from '@/utils'
import { fetchConfig, initLDClient } from '@/utils'
import { getVueRouter } from '@/router'
import { getVuexStore } from '@/store'
import '@/registerServiceWorker'
Expand All @@ -16,7 +16,6 @@ import '@/assets/styles/layout.scss'
import '@/assets/styles/overrides.scss'
import KeycloakService from 'sbc-common-components/src/services/keycloak.services'
import App from '@/App.vue'
import { initLDClient, featureFlags } from '@/common/FeatureFlags'
import * as Sentry from '@sentry/browser'
import * as Integrations from '@sentry/integrations'

Expand Down Expand Up @@ -46,11 +45,6 @@ async function start () {
await initLDClient()
}

// if this is a draft Incorp App, check if we are allowing user to go to Create UI
if (sessionStorage.getItem('TEMP_REG_NUMBER') && !featureFlags.getFlag('bcrs-create-ui-enabled')) {
throw new Error('create-ui is disabled')
}

// configure Keycloak Service
console.info('Starting Keycloak service...') // eslint-disable-line no-console
await KeycloakService.setKeycloakConfigUrl(sessionStorage.getItem('KEYCLOAK_CONFIG_PATH'))
Expand Down
4 changes: 2 additions & 2 deletions src/common/FeatureFlags.ts → src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { initialize, LDFlagSet } from 'launchdarkly-js-client-sdk'

/** bcrs-create-ui-enabled = whether user is allowed to go to Create UI */
const defaultFlagSet = {
'bcrs-create-ui-enabled': true
'correction-ui-enabled': true,
'alteration-ui-enabled': true
}

class FeatureFlags {
Expand Down
1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './feature-flags'
export * from './fetch-config'
export * from './sleep'
1 change: 0 additions & 1 deletion src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ import { CoaWarningDialog } from '@/components/dialogs'
// Enums, Constants and Interfaces
import { EntityStatus, FilingStatus } from '@/enums'
import { STANDALONE_ADDRESSES, STANDALONE_DIRECTORS } from '@/constants'
import { featureFlags } from '@/common/FeatureFlags'
import { HistoryItemIF, TaskItemIF } from '@/interfaces'
export default {
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/FilingHistoryList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,7 @@ describe('Filing History List - redirections', () => {
// init data
sessionStorage.setItem('EDIT_URL', `${process.env.VUE_APP_PATH}/edit/`)
store.state.keycloakRoles = ['staff']
store.state.entityIncNo = 'BC1234567'
store.state.filings = [
{
filing: {
Expand Down Expand Up @@ -1778,7 +1779,7 @@ describe('Filing History List - redirections', () => {
await flushPromises()

// verify redirection
const createUrl = 'business/edit/correction/?filingId=85114'
const createUrl = 'business/edit/BC1234567/correction?corrected-id=85114'
expect(window.location.assign).toHaveBeenCalledWith(createUrl)

wrapper.destroy()
Expand Down

0 comments on commit 268b207

Please sign in to comment.