diff --git a/ui/src/__tests__/components/header/DomainDetails.test.js b/ui/src/__tests__/components/header/DomainDetails.test.js
index 5fea6139b46..64ef27272d0 100644
--- a/ui/src/__tests__/components/header/DomainDetails.test.js
+++ b/ui/src/__tests__/components/header/DomainDetails.test.js
@@ -123,6 +123,60 @@ describe('DomainDetails', () => {
expect(screen.getByText(organization)).toBeInTheDocument();
});
+ it('should hide cloud account details when showCloudAccountDetails is false', () => {
+ const domainMetadata = {
+ modified: '2020-02-12T21:44:37.792Z',
+ ypmId: 'test',
+ org: 'test',
+ auditEnabled: true,
+ account: 'aws-account-123',
+ gcpProject: 'gcp-project-456',
+ environment: 'qa',
+ };
+ const domainData = buildDomainDataForState(domainMetadata);
+ const state = {
+ ...getStateWithDomainData(domainData),
+ domains: {
+ featureFlag: {
+ enabled: true,
+ showCloudAccountDetails: false,
+ },
+ },
+ };
+
+ renderWithRedux(, state);
+
+ expect(screen.queryByText('AWS ACCOUNT ID')).toBeNull();
+ expect(screen.queryByText('GCP PROJECT ID')).toBeNull();
+ expect(screen.queryByText('Onboard to AWS')).toBeNull();
+ });
+
+ it('should show cloud account details when showCloudAccountDetails is true', () => {
+ const domainMetadata = {
+ modified: '2020-02-12T21:44:37.792Z',
+ ypmId: 'test',
+ org: 'test',
+ auditEnabled: true,
+ account: 'aws-account-123',
+ environment: 'qa',
+ };
+ const domainData = buildDomainDataForState(domainMetadata);
+ const state = {
+ ...getStateWithDomainData(domainData),
+ domains: {
+ featureFlag: {
+ enabled: true,
+ showCloudAccountDetails: true,
+ },
+ },
+ };
+
+ renderWithRedux(, state);
+
+ expect(screen.getByText('AWS ACCOUNT ID')).toBeInTheDocument();
+ expect(screen.getByText('GCP PROJECT ID')).toBeInTheDocument();
+ });
+
it('shows N/A when organization is empty and orgDomain is empty', () => {
const organization = '';
const orgDomain = '';
diff --git a/ui/src/__tests__/redux/selectors/domains.test.js b/ui/src/__tests__/redux/selectors/domains.test.js
index 1027f8e2014..d49bfbf01fb 100644
--- a/ui/src/__tests__/redux/selectors/domains.test.js
+++ b/ui/src/__tests__/redux/selectors/domains.test.js
@@ -24,6 +24,7 @@ import {
selectShowInstances,
selectShowProviders,
selectShowMicrosegmentation,
+ selectShowCloudAccountDetails,
selectUserLink,
selectHeaderDetails,
selectProductMasterLink,
@@ -192,6 +193,30 @@ describe('test domains selectors', () => {
expect(selectShowMicrosegmentation(state)).toEqual(false);
});
});
+ describe('test selectShowCloudAccountDetails selector', () => {
+ it('should return true by default', () => {
+ expect(selectShowCloudAccountDetails(stateWithDomainsData)).toEqual(
+ true
+ );
+ });
+ it('should return false when explicitly disabled', () => {
+ const state = {
+ domains: {
+ featureFlag: {
+ enabled: true,
+ showCloudAccountDetails: false,
+ },
+ },
+ };
+ expect(selectShowCloudAccountDetails(state)).toEqual(false);
+ });
+ it('should return true when not set in object', () => {
+ const state = {
+ domains: { featureFlag: { enabled: true } },
+ };
+ expect(selectShowCloudAccountDetails(state)).toEqual(true);
+ });
+ });
describe('test selectUserLink selector', () => {
it('should return user link', () => {
const userLink = {
diff --git a/ui/src/components/header/DomainDetails.js b/ui/src/components/header/DomainDetails.js
index a3003f12033..bce901ecc0e 100644
--- a/ui/src/components/header/DomainDetails.js
+++ b/ui/src/components/header/DomainDetails.js
@@ -37,6 +37,7 @@ import {
import {
selectProductMasterLink,
selectTimeZone,
+ selectShowCloudAccountDetails,
} from '../../redux/selectors/domains';
import { makeRolesExpires } from '../../redux/actions/roles';
import { makePoliciesExpires } from '../../redux/actions/policies';
@@ -548,22 +549,26 @@ class DomainDetails extends React.Component {
AUDIT ENABLED
-
-
- {this.props.domainDetails.account
- ? this.props.domainDetails.account
- : 'N/A'}
-
- AWS ACCOUNT ID
-
-
-
- {this.props.domainDetails.gcpProject
- ? this.props.domainDetails.gcpProject
- : 'N/A'}
-
- GCP PROJECT ID
-
+ {this.props.showCloudAccountDetails && (
+
+
+
+ {this.props.domainDetails.account
+ ? this.props.domainDetails.account
+ : 'N/A'}
+
+ AWS ACCOUNT ID
+
+
+
+ {this.props.domainDetails.gcpProject
+ ? this.props.domainDetails.gcpProject
+ : 'N/A'}
+
+ GCP PROJECT ID
+
+
+ )}
More Details
- {showOnBoardToAWS && (
+ {this.props.showCloudAccountDetails && showOnBoardToAWS ? (
- )}
- {this.state.showOnBoardToAWSModal ? (
+ ) : null}
+ {this.props.showCloudAccountDetails &&
+ this.state.showOnBoardToAWSModal ? (
{
auditEnabled: selectDomainAuditEnabled(state),
timeZone: selectTimeZone(state),
userList: selectAllUsers(state),
+ showCloudAccountDetails: selectShowCloudAccountDetails(state),
};
};
diff --git a/ui/src/config/default-config.js b/ui/src/config/default-config.js
index 19536582a7e..4a3f36c575e 100644
--- a/ui/src/config/default-config.js
+++ b/ui/src/config/default-config.js
@@ -154,6 +154,7 @@ const config = {
statusPath: process.env.UI_SESSION_SECRET_PATH || 'keys/cookie-session',
featureFlag: true,
showMicrosegmentation: true,
+ showCloudAccountDetails: true,
pageFeatureFlag: {
microsegmentation: {
policyValidation: true,
diff --git a/ui/src/redux/selectors/domains.js b/ui/src/redux/selectors/domains.js
index 53629db60d2..f47997cd535 100644
--- a/ui/src/redux/selectors/domains.js
+++ b/ui/src/redux/selectors/domains.js
@@ -98,6 +98,14 @@ export const selectShowMicrosegmentation = (state) => {
if (ff && typeof ff === 'object') return ff.showMicrosegmentation !== false;
return true;
};
+
+export const selectShowCloudAccountDetails = (state) => {
+ const ff = state.domains.featureFlag;
+ if (ff && typeof ff === 'object')
+ return ff.showCloudAccountDetails !== false;
+ return true;
+};
+
export const selectAuthorityAttributes = (state) => {
return state.domains.authorityAttributes
? state.domains.authorityAttributes
diff --git a/ui/src/server/handlers/api.js b/ui/src/server/handlers/api.js
index e1296819563..48171960fa9 100644
--- a/ui/src/server/handlers/api.js
+++ b/ui/src/server/handlers/api.js
@@ -2625,6 +2625,8 @@ Fetchr.registerService({
showInstances: appConfig.servicePageConfig?.showInstances !== false,
showProviders: appConfig.servicePageConfig?.showProviders !== false,
showMicrosegmentation: appConfig.showMicrosegmentation !== false,
+ showCloudAccountDetails:
+ appConfig.showCloudAccountDetails !== false,
});
},
});
@@ -3490,6 +3492,8 @@ module.exports.load = function (config, secrets) {
zmsLoginUrl: config.zmsLoginUrl,
timeZone: config.timeZone,
featureFlag: config.featureFlag,
+ showMicrosegmentation: config.showMicrosegmentation,
+ showCloudAccountDetails: config.showCloudAccountDetails,
pageFeatureFlag: config.pageFeatureFlag,
serviceHeaderLinks: config.serviceHeaderLinks,
templates: config.templates,