Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,22 @@ describe('ConnectionForm Component', function () {
);
});

context('protectConnectionStrings', function () {
it('should not render the banner by default', function () {
renderForm();
expect(
screen.queryByTestId('protect-connection-strings-banner')
).to.be.null;
});

it('renders a banner if protectConnectionStrings === true', function () {
renderForm({
protectConnectionStrings: true,
});
expect(screen.getByTestId('protect-connection-strings-banner')).to.exist;
});
});

// TODO(COMPASS-7762)
context.skip('when preferences.showFavoriteActions === false', function () {
it('should not render the favorite button', function () {
Expand Down
15 changes: 13 additions & 2 deletions packages/connection-form/src/components/connection-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const headingWithHiddenButtonStyles = css({
},
});

const disabledConnectedConnectionBannerStyles = css({
const bannerStyles = css({
marginTop: spacing[400],
paddingRight: 0,
});
Expand Down Expand Up @@ -500,7 +500,7 @@ function ConnectionForm({
{disableEditingConnectedConnection && onDisconnectClicked && (
<Banner
data-testid="disabled-connected-connection-banner"
className={disabledConnectedConnectionBannerStyles}
className={bannerStyles}
>
<div className={disabledConnectedConnectionContentStyles}>
<div>
Expand All @@ -521,6 +521,17 @@ function ConnectionForm({
</div>
</Banner>
)}
{protectConnectionStrings && !disableEditingConnectedConnection && (
<Banner
data-testid="protect-connection-strings-banner"
className={bannerStyles}
>
Advanced Connection Options are hidden while the &quot;Protect
Connection String Secrets&quot; setting is enabled. Disable the
setting to configure Advanced Connection Options or edit your
connection string.
</Banner>
)}
<ConnectionStringInput
connectionString={connectionOptions.connectionString}
enableEditingConnectionString={enableEditingConnectionString}
Expand Down
Loading