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

Fixes #36782 - Update UI in preparation for SCA-only #10753

Merged
merged 1 commit into from
Sep 29, 2023
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
4 changes: 4 additions & 0 deletions app/views/overrides/organizations/_edit_override.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
tag1 + tag2
end %>

<div class="alert alert-warning" role="alert">
<%= _('Simple Content Access will be required for all organizations in Katello 4.12.') %>
</div>

<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
</div>
<div id="non-sca-banner" bst-alert="warning" ng-if="!simpleContentAccessEnabled">
<span translate>
This organization is not using <a target="_blank" href="https://access.redhat.com/articles/simple-content-access">Simple Content Access.</a> Entitlement-based subscription management is deprecated and will be removed in a future version.
This organization is not using <a target="_blank" href="https://access.redhat.com/articles/simple-content-access">Simple Content Access.</a> Entitlement-based subscription management is deprecated and will be removed in Katello 4.12.
</span>
</div>
48 changes: 37 additions & 11 deletions webpack/scenes/Subscriptions/SubscriptionsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { translate as __ } from 'foremanReact/common/I18n';
import { propsToCamelCase } from 'foremanReact/common/helpers';
import { isEmpty } from 'lodash';
import { Grid, Row, Col, Alert } from 'patternfly-react';
import { Popover, Flex, FlexItem } from '@patternfly/react-core';
import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons';
import ModalProgressBar from 'foremanReact/components/common/ModalProgressBar';
import PermissionDenied from 'foremanReact/components/PermissionDenied';
import ManageManifestModal from './Manifest/';
Expand Down Expand Up @@ -204,42 +206,66 @@ class SubscriptionsPage extends Component {
const emptyStateData = isManifestImported
? {
header: __('There are no Subscriptions to display'),
description: __('Add Subscriptions using the Add Subscriptions button.'),
description: __('Add subscriptions using the Add Subscriptions button.'),
action: {
title: __('Add subscriptions'),
url: 'subscriptions/add',
},
}
: {
header: __('There are no Subscriptions to display'),
description: __('Import a Manifest to manage your Entitlements.'),
description: __('Import a subscription manifest to give hosts access to Red Hat content.'),
action: {
onClick: () => openManageManifestModal(),
title: __('Import a Manifest'),
},
};

const SCAAlert = (
<Alert ouiaId="sca-alert" type={simpleContentAccess ? 'info' : 'warning'}>
<Alert ouiaId="sca-alert" type="warning">
<FormattedMessage
id="sca-alert"
values={{
subscriptionsService: <a href={SUBSCRIPTIONS_SERVICE_DOC_URL} target="_blank" rel="noreferrer">{__('Subscriptions service')}</a>,
br: <br />,
scaLink: <a href={SCA_URL} target="_blank" rel="noreferrer">{__('Simple Content Access')}</a>,
}}
defaultMessage={simpleContentAccess ? __(`This organization has Simple Content Access enabled.
Hosts are not required to have subscriptions attached to access repositories.
{br}
Learn more about your overall subscription usage with the {subscriptionsService}.`) : __('This organization is not using {scaLink}. Entitlement-based subscription management is deprecated and will be removed in a future version.')}
defaultMessage={__('This organization is not using {scaLink}. Entitlement-based subscription management is deprecated and will be removed in Katello 4.12.')}
/>
</Alert>
);

const SCAPopoverContent = (
<FormattedMessage
id="sca-popover-content"
values={{
br: <br />,
subscriptionsService: <a href={SUBSCRIPTIONS_SERVICE_DOC_URL} target="_blank" rel="noreferrer">{__('Subscriptions service')}</a>,
}}
defaultMessage={__(`This page shows the subscriptions available from this organization's subscription manifest.
{br}
Learn more about your overall subscription usage with the {subscriptionsService}.`)}
/>
);
return (
<Grid bsClass="container-fluid">
<Row>
<Col sm={12}>
<h1>{__('Subscriptions')}</h1>
<Flex alignItems={{ default: 'alignItemsBaseline' }}>
<FlexItem>
<h1>{__('Subscriptions')}</h1>
</FlexItem>
{isManifestImported && (
<FlexItem>
<Popover
aria-label="sca-popover"
bodyContent={SCAPopoverContent}
>
<span style={{ cursor: 'pointer', position: 'relative', top: '-0.2em' }}>
<OutlinedQuestionCircleIcon>Toggle popover</OutlinedQuestionCircleIcon>
</span>
</Popover>
</FlexItem>
)}
</Flex>

<SubscriptionsToolbar
canManageSubscriptionAllocations={canManageSubscriptionAllocations}
Expand Down Expand Up @@ -274,7 +300,7 @@ class SubscriptionsPage extends Component {
/>

<div id="subscriptions-table" className="modal-container">
{!this.props.organization?.loading && SCAAlert}
{!this.props.organization?.loading && !simpleContentAccess ? SCAAlert : null}
<SubscriptionsTable
canManageSubscriptionAllocations={canManageSubscriptionAllocations}
loadSubscriptions={this.props.loadSubscriptions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@ exports[`subscriptions page should render 1`] = `
componentClass="div"
sm={12}
>
<h1>
Subscriptions
</h1>
<Flex
alignItems={
Object {
"default": "alignItemsBaseline",
}
}
>
<FlexItem>
<h1>
Subscriptions
</h1>
</FlexItem>
</Flex>
<SubscriptionsToolbar
autocompleteQueryParams={
Object {
Expand Down Expand Up @@ -71,25 +81,17 @@ exports[`subscriptions page should render 1`] = `
type="warning"
>
<FormattedMessage
defaultMessage="This organization is not using {scaLink}. Entitlement-based subscription management is deprecated and will be removed in a future version."
defaultMessage="This organization is not using {scaLink}. Entitlement-based subscription management is deprecated and will be removed in Katello 4.12."
id="sca-alert"
values={
Object {
"br": <br />,
"scaLink": <a
href="https://access.redhat.com/articles/simple-content-access"
rel="noreferrer"
target="_blank"
>
Simple Content Access
</a>,
"subscriptionsService": <a
href="https://access.redhat.com/documentation/en-us/subscription_central/2021/html-single/getting_started_with_the_subscriptions_service/index"
rel="noreferrer"
target="_blank"
>
Subscriptions service
</a>,
}
}
/>
Expand All @@ -102,7 +104,7 @@ exports[`subscriptions page should render 1`] = `
"onClick": [Function],
"title": "Import a Manifest",
},
"description": "Import a Manifest to manage your Entitlements.",
"description": "Import a subscription manifest to give hosts access to Red Hat content.",
"header": "There are no Subscriptions to display",
}
}
Expand Down