Skip to content

Commit

Permalink
EDSC-3971: Adding Feature Toggle for cmr-ordering and the EDSC databa…
Browse files Browse the repository at this point in the history
…se during down-time (#1707)

* EDSC-3971: Adding Feature Toggles for cmr-ordering components and for earthdata search's database
  • Loading branch information
eudoroolivares2016 authored Jan 25, 2024
1 parent eb28989 commit d4da4a8
Show file tree
Hide file tree
Showing 17 changed files with 323 additions and 74 deletions.
4 changes: 2 additions & 2 deletions bin/deploy-bamboo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ config="`jq '.application.analytics.gtmPropertyId = $newValue' --arg newValue $b
config="`jq '.application.granuleLinksPageSize = $newValue' --arg newValue $bamboo_GRANULE_LINKS_PAGE_SIZE <<< $config`"
config="`jq '.application.openSearchGranuleLinksPageSize = $newValue' --arg newValue $bamboo_OPEN_SEARCH_GRANULE_LINKS_PAGE_SIZE <<< $config`"
config="`jq '.application.disableEddDownload = $newValue' --arg newValue $bamboo_DISABLE_EDD_DOWNLOAD <<< $config`"
config="`jq '.application.disableOrdering = $newValue' --arg newValue $bamboo_DISABLE_ORDERING <<< $config`"
config="`jq '.application.disableDatabaseComponents = $newValue' --arg newValue $bamboo_DISABLE_DATABASE_COMPONENTS <<< $config`"
config="`jq '.application.macOSEddDownloadSize = $newValue' --arg newValue $bamboo_MACOS_EDD_DOWNLOAD_SIZE <<< $config`"
config="`jq '.application.windowsEddDownloadSize = $newValue' --arg newValue $bamboo_WINDOWS_EDD_DOWNLOAD_SIZE <<< $config`"
config="`jq '.application.linuxEddDownloadSize = $newValue' --arg newValue $bamboo_LINUX_EDD_DOWNLOAD_SIZE <<< $config`"
Expand Down Expand Up @@ -79,8 +81,6 @@ dockerRun() {
-e "CLOUDFRONT_BUCKET_NAME=$bamboo_CLOUDFRONT_BUCKET_NAME" \
-e "COLORMAP_JOB_ENABLED=$bamboo_COLORMAP_JOB_ENABLED" \
-e "DB_INSTANCE_CLASS=$bamboo_DB_INSTANCE_CLASS" \
-e "GEOCODING_INCLUDE_POLYGONS=$bamboo_GEOCODING_INCLUDE_POLYGONS" \
-e "GEOCODING_SERVICE=$bamboo_GEOCODING_SERVICE" \
-e "GIBS_JOB_ENABLED=$bamboo_GIBS_JOB_ENABLED" \
-e "LAMBDA_TIMEOUT=$bamboo_LAMBDA_TIMEOUT" \
-e "LOG_DESTINATION_ARN=$bamboo_LOG_DESTINATION_ARN" \
Expand Down
104 changes: 55 additions & 49 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
Expand Up @@ -59,7 +59,7 @@
"babel-jest": "^28.1.0",
"babel-plugin-istanbul": "^6.1.1",
"cookies": "^0.7.3",
"cypress": "^12.17.2",
"cypress": "^13.0.0",
"cypress-file-upload": "^5.0.8",
"enzyme": "^3.11.0",
"istanbul-instrumenter-loader": "^3.0.1",
Expand Down
2 changes: 2 additions & 0 deletions static.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"lambda": "eed-PORTAL-ENV-serverless-lambda"
},
"disableEddDownload": "false",
"disableOrdering": false,
"disableDatabaseComponents": false,
"macOSEddDownloadSize":130,
"windowsEddDownloadSize":100,
"linuxEddDownloadSize":90
Expand Down
31 changes: 19 additions & 12 deletions static/src/js/components/SecondaryToolbar/SecondaryToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class SecondaryToolbar extends Component {
projectCollectionIds,
location,
retrieval = {},
secondaryToolbarEnabled,
ursProfile
} = this.props

Expand Down Expand Up @@ -362,21 +363,26 @@ class SecondaryToolbar extends Component {
const showViewProjectLink = (!pathStartsWith(location.pathname, ['/projects', '/downloads']) && (projectCollectionIds.length > 0 || projectName))

return (
<nav className="secondary-toolbar">
{isPath(location.pathname, ['/projects']) && backToSearchLink}
{isDownloadPathWithId(location.pathname) && backToProjectLink}
<PortalFeatureContainer authentication>
<>
{showViewProjectLink && projectLink}
{showSaveProjectDropdown && saveProjectDropdown}
{!loggedIn ? loginLink : loggedInDropdown}
</>
</PortalFeatureContainer>
</nav>
secondaryToolbarEnabled
&& (
<nav className="secondary-toolbar">
{isPath(location.pathname, ['/projects']) && backToSearchLink}
{isDownloadPathWithId(location.pathname) && backToProjectLink}
<PortalFeatureContainer authentication>
<>
{showViewProjectLink && projectLink}
{showSaveProjectDropdown && saveProjectDropdown}
{!loggedIn ? loginLink : loggedInDropdown}
</>
</PortalFeatureContainer>
</nav>
)
)
}
}

SecondaryToolbar.defaultProps = { secondaryToolbarEnabled: true }

SecondaryToolbar.propTypes = {
authToken: PropTypes.string.isRequired,
earthdataEnvironment: PropTypes.string.isRequired,
Expand All @@ -390,7 +396,8 @@ SecondaryToolbar.propTypes = {
}).isRequired,
ursProfile: PropTypes.shape({
first_name: PropTypes.string
}).isRequired
}).isRequired,
secondaryToolbarEnabled: PropTypes.bool
}

export default SecondaryToolbar
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function setup(state, overrideProps) {
ursProfile: {
first_name: 'First'
},
secondaryToolbarEnabled: true,
...overrideProps
}

Expand Down Expand Up @@ -62,6 +63,22 @@ describe('SecondaryToolbar component', () => {
})
})

describe('when the secondary toolbar is meant to be disabled', () => {
describe('when the user is logged in', () => {
test('secondary toolbar components are not being rendered', () => {
const { enzymeWrapper } = setup('loggedIn', { secondaryToolbarEnabled: false })
expect(enzymeWrapper.find('.secondary-toolbar__user-dropdown').length).toBe(0)
})
})

describe('when the user is logged out', () => {
test('secondary toolbar components are not being rendered', () => {
const { enzymeWrapper } = setup('loggedOut', { secondaryToolbarEnabled: false })
expect(enzymeWrapper.find('.secondary-toolbar__user-dropdown').length).toBe(0)
})
})
})

describe('when logged in', () => {
beforeEach(() => {
jest.spyOn(getApplicationConfig, 'getApplicationConfig').mockImplementation(() => ({
Expand Down
Loading

0 comments on commit d4da4a8

Please sign in to comment.