Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2037771: Cockpit registration dialog: enable insights by default #2929

Merged
merged 1 commit into from
Jan 17, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions cockpit/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ let registerDialogDetails = {
proxy_server: '',
proxy_user: '',
proxy_password: '',
insights: false
insights: true
};

function dismissStatusError() {
Expand Down Expand Up @@ -76,7 +76,7 @@ function openRegisterDialog() {
password: '',
activation_keys: '',
org: '',
insights: false,
insights: true,
insights_available: subscriptionsClient.insightsAvailable,
insights_detected: false,
register_method: 'account',
Expand Down
18 changes: 15 additions & 3 deletions cockpit/src/subscriptions-register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,17 @@ class SubscriptionRegisterDialog extends React.Component {
<FormGroup key="0" fieldId="subscription-insights" label={_("Insights")} hasNoPaddingTop>
<Checkbox id="subscription-insights" isChecked={this.props.insights}
label={ Insights.arrfmt(_("Connect this system to $0."), Insights.link) }
isDisabled={ insights_checkbox_disabled } onChange={value => this.props.onChange('insights', value)} />
{(this.props.insights && !this.props.insights_detected) && <p>{ Insights.arrfmt(_("The $0 package will be installed."), <strong>{subscriptionsClient.insightsPackage}</strong>)}</p>}
isDisabled={ insights_checkbox_disabled }
onChange={value => this.props.onChange('insights', value)}
/>
{(this.props.insights && !this.props.insights_detected) &&
<p>
{ Insights.arrfmt(
_("The $0 package will be installed."),
<strong>{subscriptionsClient.insightsPackage}</strong>
)}
</p>
}
</FormGroup>,
];

Expand Down Expand Up @@ -165,7 +174,10 @@ class SubscriptionRegisterDialog extends React.Component {
<FormGroup className="control-label" label={_("Subscriptions")} hasNoPaddingTop>
<Checkbox id="subscription-auto-attach-use" isChecked={this.props.auto_attach}
label={_("Attach automatically")}
onChange={value => this.props.onChange('auto_attach', value)}
onChange={value => {
this.props.onChange('auto_attach', value);
this.props.insights && !value && this.props.onChange('insights', value);
}}
/>
</FormGroup>
{ insights }
Expand Down
10 changes: 10 additions & 0 deletions integration-tests/check-subscriptions
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ class TestSubscriptions(SubscriptionsCase):
b.set_input_text("#subscription-register-username", "doc")
b.set_input_text("#subscription-register-password", "wrongpass")

# Do not try to connect to insights
b.set_checked("#subscription-insights", False)

# try to register
dialog_register_button_sel = "footer .pf-m-primary"
b.click(dialog_register_button_sel)
Expand Down Expand Up @@ -281,6 +284,9 @@ class TestSubscriptions(SubscriptionsCase):
b.set_val("#subscription-register-url", "custom")
b.set_input_text("#subscription-register-url-custom", CANDLEPIN_URL)

# Do not try to connect to insights
b.set_checked("#subscription-insights", False)

# select registration method "activation key"
activation_key_checkbox = "#subscription-register-activation-key-method"
b.click(activation_key_checkbox)
Expand Down Expand Up @@ -369,6 +375,10 @@ class TestSubscriptions(SubscriptionsCase):
b.set_input_text("#subscription-register-username", "admin")
b.set_input_text("#subscription-register-password", "admin")
b.set_input_text("#subscription-register-org", "admin")

# Do not try to connect to insights
b.set_checked("#subscription-insights", False)

dialog_register_button_sel = "footer .pf-m-primary"
b.click(dialog_register_button_sel)
b.wait_not_present(dialog_register_button_sel)
Expand Down