Skip to content

Commit

Permalink
add feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
pearl-truss committed Oct 23, 2023
1 parent 6121942 commit 90f7ac0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
7 changes: 7 additions & 0 deletions services/app-web/src/common-code/featureFlags/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ const featureFlags = {
flag: 'cms-questions',
defaultValue: false,
},
/**
* Enables CMS to add, view, edit and delete MC-CRS record numbers
*/
MCCRS_RECORD_NUMBER: {
flag: 'mccrs-record-number',
defaultValue: false,
},
/**
* Enables packages with shared rates dropdown on rate details page. This was an early version of rates across subs functionality.
*/
Expand Down
16 changes: 12 additions & 4 deletions services/app-web/src/pages/App/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ const CMSUserRoutes = ({
featureFlags.RATE_REVIEWS_DASHBOARD.flag,
featureFlags.RATE_REVIEWS_DASHBOARD.defaultValue
)

const showMCCRSRecordNumber = ldClient?.variation(
featureFlags.MCCRS_RECORD_NUMBER.flag,
featureFlags.MCCRS_RECORD_NUMBER.defaultValue
)

return (
<AuthenticatedRouteWrapper authMode={authMode} setAlert={setAlert}>
<Routes>
Expand Down Expand Up @@ -206,10 +212,12 @@ const CMSUserRoutes = ({
path={RoutesRecord.SUBMISSIONS_SUMMARY}
element={<SubmissionSummary />}
/>
<Route
path={RoutesRecord.SUBMISSIONS_MCCRSID}
element={<MccrsId />}
/>
{showMCCRSRecordNumber && (
<Route
path={RoutesRecord.SUBMISSIONS_MCCRSID}
element={<MccrsId />}
/>
)}
</Route>

<Route
Expand Down
2 changes: 1 addition & 1 deletion services/app-web/src/pages/MccrsId/MccrsId.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { MccrsId } from './MccrsId'

describe('MCCRSID', () => {
beforeEach(() => {
ldUseClientSpy({ 'cms-questions': false })
ldUseClientSpy({ 'mccrs-record-number': true })
})
afterEach(() => {
jest.resetAllMocks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { testS3Client } from '../../testHelpers/s3Helpers'
describe('SubmissionSummary', () => {
beforeEach(() => {
ldUseClientSpy({ 'cms-questions': false })
ldUseClientSpy({ 'mccrs-record-number': true })
})
afterEach(() => {
jest.resetAllMocks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ export const SubmissionSummary = (): React.ReactElement => {
featureFlags.CMS_QUESTIONS.defaultValue
)

const showMCCRSRecordNumber = ldClient?.variation(
featureFlags.MCCRS_RECORD_NUMBER.flag,
featureFlags.MCCRS_RECORD_NUMBER.defaultValue
)

const { pkg, currentRevision, packageData, user, documentDates } =
useOutletContext<SideNavOutletContextType>()

Expand Down Expand Up @@ -162,7 +167,7 @@ export const SubmissionSummary = (): React.ReactElement => {

<SubmissionTypeSummarySection
subHeaderComponent={
isCMSUser ? (
isCMSUser && showMCCRSRecordNumber ? (
<div className={styles.subHeader}>
{pkg.mccrsID && (
<span>
Expand Down

0 comments on commit 90f7ac0

Please sign in to comment.