Configurable domain page details#3294
Conversation
Add two new config flags (both default true for backward compatibility): - showCloudAccountDetails: controls visibility of AWS Account ID, GCP Project ID, and Onboard to AWS button in domain details header - useSignedDomainsForAdminDomains: when false, admin-domains service skips the getSignedDomains call and returns domain names only from getDomainList, useful when the UI service identity lacks permission to call getSignedDomains Signed-off-by: dma <dma@yahooinc.com> Made-with: Cursor
The admin-domains service should always use getSignedDomains. The previous authorization issue that prompted this flag has been resolved by configuring the ZMS authorized_services and Okta authority. Made-with: Cursor Signed-off-by: dma <dma@yahooinc.com>
showMicrosegmentation and showCloudAccountDetails were missing from the appConfig initialization in module.exports.load, causing them to always be undefined. Since the feature-flag service checks `appConfig.showMicrosegmentation !== false`, undefined !== false evaluated to true, making the flags impossible to disable via config. Made-with: Cursor Signed-off-by: dma <dma@yahooinc.com>
Add selector tests for selectShowCloudAccountDetails covering default, disabled, and unset cases. Add DomainDetails component tests verifying cloud account info is hidden when the flag is false and shown when true. Made-with: Cursor Signed-off-by: dma <dma@yahooinc.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new feature flag, showCloudAccountDetails, to conditionally render cloud account information and onboarding options within the DomainDetails component. The changes include adding a new Redux selector, updating the default configuration, and modifying the server-side API handlers to support this flag. Feedback was provided to improve the readability of the conditional rendering in the UI by grouping adjacent sections with a React.Fragment and using more idiomatic React patterns.
| {this.props.showCloudAccountDetails ? ( | ||
| <SectionDiv> | ||
| <ValueDiv> | ||
| {this.props.domainDetails.account | ||
| ? this.props.domainDetails.account | ||
| : 'N/A'} | ||
| </ValueDiv> | ||
| <LabelDiv>AWS ACCOUNT ID</LabelDiv> | ||
| </SectionDiv> | ||
| ) : null} | ||
| {this.props.showCloudAccountDetails ? ( | ||
| <SectionDiv> | ||
| <ValueDiv> | ||
| {this.props.domainDetails.gcpProject | ||
| ? this.props.domainDetails.gcpProject | ||
| : 'N/A'} | ||
| </ValueDiv> | ||
| <LabelDiv>GCP PROJECT ID</LabelDiv> | ||
| </SectionDiv> | ||
| ) : null} |
There was a problem hiding this comment.
The showCloudAccountDetails check is repeated for two adjacent sections. These can be grouped together using a React.Fragment to improve readability and reduce redundancy. Additionally, using the logical AND (&&) operator is more idiomatic in React for conditional rendering when no fallback is needed.
| {this.props.showCloudAccountDetails ? ( | |
| <SectionDiv> | |
| <ValueDiv> | |
| {this.props.domainDetails.account | |
| ? this.props.domainDetails.account | |
| : 'N/A'} | |
| </ValueDiv> | |
| <LabelDiv>AWS ACCOUNT ID</LabelDiv> | |
| </SectionDiv> | |
| ) : null} | |
| {this.props.showCloudAccountDetails ? ( | |
| <SectionDiv> | |
| <ValueDiv> | |
| {this.props.domainDetails.gcpProject | |
| ? this.props.domainDetails.gcpProject | |
| : 'N/A'} | |
| </ValueDiv> | |
| <LabelDiv>GCP PROJECT ID</LabelDiv> | |
| </SectionDiv> | |
| ) : null} | |
| {this.props.showCloudAccountDetails && ( | |
| <React.Fragment> | |
| <SectionDiv> | |
| <ValueDiv> | |
| {this.props.domainDetails.account | |
| ? this.props.domainDetails.account | |
| : 'N/A'} | |
| </ValueDiv> | |
| <LabelDiv>AWS ACCOUNT ID</LabelDiv> | |
| </SectionDiv> | |
| <SectionDiv> | |
| <ValueDiv> | |
| {this.props.domainDetails.gcpProject | |
| ? this.props.domainDetails.gcpProject | |
| : 'N/A'} | |
| </ValueDiv> | |
| <LabelDiv>GCP PROJECT ID</LabelDiv> | |
| </SectionDiv> | |
| </React.Fragment> | |
| )} |
Made-with: Cursor Signed-off-by: dma <dma@yahooinc.com>
Group adjacent showCloudAccountDetails conditionals into a single check using React.Fragment and the && operator for idiomatic React conditional rendering. Made-with: Cursor Signed-off-by: dma <dma@yahooinc.com>
Description
Contribution Checklist:
Attach Screenshots (Optional)