Skip to content

Commit

Permalink
Update button position
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccaalpert committed Jan 25, 2020
1 parent 85e99e1 commit d800ee1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export type OperatorHubCSVAnnotations = {
description?: string;
categories?: string;
capabilities?: CapabilityLevel;
'marketplace.openshift.io/action-text'?: string;
'marketplace.openshift.io/remote-workflow'?: string;
};

type OperatorHubSpec = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import * as React from 'react';
import * as _ from 'lodash';
import * as classNames from 'classnames';
import { Modal } from 'patternfly-react';
import { Button } from '@patternfly/react-core';
import { ExternalLinkAltIcon, CheckCircleIcon } from '@patternfly/react-icons';
import {
CatalogItemHeader,
PropertiesSidePanel,
PropertyItem,
} from '@patternfly/react-catalog-view-extension';
import { PropertiesSidePanel, PropertyItem } from '@patternfly/react-catalog-view-extension';
import { CheckCircleIcon } from '@patternfly/react-icons';
import { Link } from 'react-router-dom';
Expand Down Expand Up @@ -68,7 +60,6 @@ export const OperatorHubItemDetails: React.SFC<OperatorHubItemDetailsProps> = ({
installed,
provider,
providerType,
obj,
longDescription,
description,
version,
Expand All @@ -79,15 +70,6 @@ export const OperatorHubItemDetails: React.SFC<OperatorHubItemDetailsProps> = ({
capabilityLevel,
} = item;
const notAvailable = <span className="properties-side-panel-pf-property-label">N/A</span>;
const actionText =
_.get(obj, [
'status',
'channels',
'0',
'currentCSVDesc',
'annotations',
'marketplace.openshift.io/action-text',
]) || 'Install';

const getHintBlock = () => {
if (installed) {
Expand Down Expand Up @@ -150,16 +132,7 @@ export const OperatorHubItemDetails: React.SFC<OperatorHubItemDetailsProps> = ({
<PropertyItem label="Repository" value={repository || notAvailable} />
<PropertyItem label="Container Image" value={containerImage || notAvailable} />
<PropertyItem label="Created At" value={createdAt || notAvailable} />
<PropertyItem
label="Support"
value={
!ibmSupportLink ? (
<ExternalLink href={ibmSupportLink} text="Get Support" />
) : (
support || notAvailable
)
}
/>
<PropertyItem label="Support" value={support || notAvailable} />
</PropertiesSidePanel>
<div className="co-catalog-page__overlay-description">
{getHintBlock()}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as React from 'react';
import { Link } from 'react-router-dom';
import * as classNames from 'classnames';
import * as _ from 'lodash';
import LazyLoad from 'react-lazyload';
import { Button, Modal } from '@patternfly/react-core';
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import { CatalogItemHeader, CatalogTile } from '@patternfly/react-catalog-view-extension';
import {
COMMUNITY_PROVIDERS_WARNING_LOCAL_STORAGE_KEY,
Expand Down Expand Up @@ -313,9 +315,13 @@ export const OperatorHubTileView: React.FC<OperatorHubTileViewProps> = (props) =
);
};

const {marketplaceActionText, marketplaceRemoteWorkflow} = detailsItem;
const actionText = marketplaceActionText || 'Install';

const createLink =
detailsItem &&
`/operatorhub/subscribe?pkg=${detailsItem.obj.metadata.name}&catalog=${detailsItem.catalogSource}&catalogNamespace=${detailsItem.catalogSourceNamespace}&targetNamespace=${detailsItem.namespace}`;
`/operatorhub/subscribe?pkg=${detailsItem.obj.metadata.name}&catalog=${detailsItem.catalogSource}&catalogNamespace=${detailsItem.catalogSourceNamespace}&targetNamespace=${props.namespace}`;

const uninstallLink = () =>
detailsItem &&
`/k8s/ns/${detailsItem.subscription.metadata.namespace}/${SubscriptionModel.plural}/${detailsItem.subscription.metadata.name}?showDelete=true`;
Expand Down Expand Up @@ -345,12 +351,26 @@ export const OperatorHubTileView: React.FC<OperatorHubTileViewProps> = (props) =
vendor={`${detailsItem.version} provided by ${detailsItem.provider}`}
/>
<div className="co-catalog-page__button">
{marketplaceRemoteWorkflow && (
<Link
className="pf-c-button pf-c-external pf-m-primary co-catalog-page__overlay-purchase"
to={marketplaceRemoteWorkflow}
>
Purchase&nbsp;&nbsp;
<ExternalLinkAltIcon />
</Link>
)}
{!detailsItem.installed ? (
<Link
className="pf-c-button pf-m-primary co-catalog-page__overlay-create"
className={classNames(
'pf-c-button',
{ 'pf-m-secondary': marketplaceRemoteWorkflow },
{ 'pf-m-primary': !marketplaceRemoteWorkflow },
'co-catalog-page__overlay-create',
)}
to={createLink}
>
Install
{actionText}
</Link>
) : (
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export const OperatorHubList: React.SFC<OperatorHubListProps> = (props) => {
createdAt,
support,
capabilities: capabilityLevel,
'marketplace.openshift.io/action-text': marketplaceActionText,
'marketplace.openshift.io/remote-workflow': marketplaceRemoteWorkflow,
} = currentCSVAnnotations;

return {
Expand Down Expand Up @@ -85,6 +87,8 @@ export const OperatorHubList: React.SFC<OperatorHubListProps> = (props) => {
createdAt,
support,
capabilityLevel,
marketplaceActionText,
marketplaceRemoteWorkflow,
};
},
);
Expand Down
4 changes: 2 additions & 2 deletions frontend/public/components/catalog/_catalog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ $co-modal-ignore-warning-icon-width: 30px;
}

&__overlay-purchase {
margin-bottom: 10px;
display: inline-flex !important;
margin-right: var(--pf-global--spacer--sm);
overflow-x: hidden;
text-overflow: ellipsis;
width: 100%;
}

&__overlay-description {
Expand Down
15 changes: 0 additions & 15 deletions frontend/public/components/catalog/catalog-item-details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,13 @@ export class CatalogTileDetails extends React.Component {
<li key={plan.metadata.uid}>{plan.spec.description || plan.spec.externalName}</li>
));

const ibmSupportLink = _.get(obj, [
'status',
'channels',
'0',
'currentCSVDesc',
'annotations',
'marketplace.openshift.io/support-workflow',
]);

return (
<div className="modal-body">
<div className="modal-body-content">
<div className="modal-body-inner-shadow-covers">
<div className="co-catalog-page__overlay-body">
<PropertiesSidePanel>
{tileProvider && <PropertyItem label="Provider" value={tileProvider} />}
{ibmSupportLink && (
<PropertyItem
label="Support"
value={<ExternalLink href={ibmSupportLink} text="Get Support" />}
/>
)}
{supportUrl && <PropertyItem label="Support" value={supportUrlLink} />}
{creationTimestamp && (
<PropertyItem
Expand Down

0 comments on commit d800ee1

Please sign in to comment.