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

Bug 1798858: Fix bug where installed operators list status is missin… #4270

Merged
merged 1 commit into from
Feb 14, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,20 @@ export const Status: React.FC<StatusProps> = ({ status, title, children, iconOnl
return <StatusIconAndText {...statusProps} icon={<ClipboardListIcon />} />;

case 'ContainerCreating':
case 'UpgradePending':
return <ProgressStatus {...statusProps} />;

case 'In Progress':
case 'Installing':
case 'InstallReady':
case 'Replacing':
case 'Running':
case 'Updating':
case 'Upgrading':
return <StatusIconAndText {...statusProps} icon={<SyncAltIcon />} />;

case 'Cancelled':
case 'Deleting':
case 'Expired':
case 'Not Ready':
case 'Terminating':
Expand All @@ -58,13 +62,15 @@ export const Status: React.FC<StatusProps> = ({ status, title, children, iconOnl
case 'InstallCheckFailed':
case 'Lost':
case 'Rejected':
case 'UpgradeFailed':
return <ErrorStatus {...statusProps}>{children}</ErrorStatus>;

case 'Accepted':
case 'Active':
case 'Bound':
case 'Complete':
case 'Completed':
case 'Copied':
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed as this is a status.reason status.

case 'Created':
case 'Enabled':
case 'Succeeded':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,7 @@ import { Helmet } from 'react-helmet';
import { AddCircleOIcon } from '@patternfly/react-icons';
import { Alert, Card, CardBody, CardFooter, CardHeader } from '@patternfly/react-core';
import * as UIActions from '@console/internal/actions/ui';
import {
ALL_NAMESPACES_KEY,
ErrorStatus,
ProgressStatus,
Status,
SuccessStatus,
WarningStatus,
getNamespace,
getUID,
} from '@console/shared';
import { ALL_NAMESPACES_KEY, Status, WarningStatus, getNamespace, getUID } from '@console/shared';
import {
DetailsPage,
Table,
Expand Down Expand Up @@ -78,7 +69,6 @@ import {
InstallPlanKind,
PackageManifestKind,
SubscriptionKind,
SubscriptionState,
} from '../types';
import { subscriptionForCSV, getSubscriptionStatus } from '../status/csv-status';
import { getInternalObjects, isInternalObject } from '../utils';
Expand All @@ -88,8 +78,6 @@ import { operatorGroupFor, operatorNamespaceFor } from './operator-group';
import { SubscriptionDetails, catalogSourceForSubscription } from './subscription';
import { ClusterServiceVersionLogo, referenceForProvidedAPI, providedAPIsFor } from './index';

const FAILED_SUBSCRIPTION_STATES = ['Unknown', SubscriptionState.SubscriptionStateFailed];

const isSubscription = (obj) => referenceFor(obj) === referenceForModel(SubscriptionModel);
const isCSV = (obj) => referenceFor(obj) === referenceForModel(ClusterServiceVersionModel);
const tableColumnClasses = [
Expand Down Expand Up @@ -184,11 +172,15 @@ const ClusterServiceVersionStatus: React.FC<ClusterServiceVersionStatusProps> =
obj,
subscription,
}) => {
const statusString = _.get(obj, 'status.reason', ClusterServiceVersionPhase.CSVPhaseUnknown);
const showSuccessIcon = statusString === 'Copied' || statusString === 'InstallSucceeded';
const status = _.get(obj, 'status.phase');
Copy link
Member Author

@rhamilto rhamilto Feb 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI does not use a default value (if status.phase does not exist, nothing is shown).

const subscriptionStatus = getSubscriptionStatus(subscription);

if (obj.metadata.deletionTimestamp) {
return <>Disabling</>;
return (
<span className="co-icon-and-text">
<Status status={ClusterServiceVersionPhase.CSVPhaseDeleting} />
</span>
);
}

if (catalogSourceMissing) {
Expand All @@ -202,16 +194,14 @@ const ClusterServiceVersionStatus: React.FC<ClusterServiceVersionStatusProps> =

return (
<>
{_.get(obj, 'status.phase') !== ClusterServiceVersionPhase.CSVPhaseFailed ? (
<span className={classNames({ 'co-icon-and-text': showSuccessIcon })}>
{showSuccessIcon && <SuccessStatus title={statusString} />}
</span>
) : (
<span className="co-icon-and-text">
<ErrorStatus title={statusString} />
</span>
)}
{subscription && <span className="text-muted">{subscriptionStatus.title}</span>}
{status ? (
<>
<span className="co-icon-and-text">
<Status status={status} />
</span>
{subscription && <span className="text-muted">{subscriptionStatus.title}</span>}
</>
) : null}
</>
);
};
Expand Down Expand Up @@ -305,7 +295,7 @@ export const ClusterServiceVersionTableRow = withFallback<ClusterServiceVersionT
},
);

export const FailedSubscriptionTableRow: React.FC<FailedSubscriptionTableRowProps> = ({
const SubscriptionTableRow: React.FC<SubscriptionTableRowProps> = ({
catalogSourceMissing,
key,
obj,
Expand All @@ -326,22 +316,11 @@ export const FailedSubscriptionTableRow: React.FC<FailedSubscriptionTableRowProp
</>
);
}
if (FAILED_SUBSCRIPTION_STATES.includes(subscriptionState)) {
return (
<span className="co-icon-and-text">
<ErrorStatus title={subscriptionState} />
</span>
);
}

if (subscriptionState === SubscriptionState.SubscriptionStateUpgradePending) {
return (
<span className="co-icon-and-text">
<ProgressStatus title={subscriptionState} />
</span>
);
}
return 'Unknown';
return (
<span className="co-icon-and-text">
<Status status={subscriptionState} />
</span>
);
};

return (
Expand All @@ -363,14 +342,14 @@ export const FailedSubscriptionTableRow: React.FC<FailedSubscriptionTableRowProp
<ResourceLink kind="Namespace" title={namespace} name={namespace} />
</TableData>

{/* Status */}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was overlooked in #3712.

<TableData className={tableColumnClasses[3]}>{getStatus()}</TableData>

{/* Deployment */}
<TableData className={tableColumnClasses[2]}>
<span className="text-muted">None</span>
</TableData>

{/* Status */}
<TableData className={tableColumnClasses[3]}>{getStatus()}</TableData>

{/* Provided APIs */}
<TableData className={tableColumnClasses[4]}>
<span className="text-muted">None</span>
Expand Down Expand Up @@ -405,7 +384,7 @@ const InstalledOperatorTableRow: React.FC<InstalledOperatorTableRowProps> = ({
subscription={subscription}
/>
) : (
<FailedSubscriptionTableRow
<SubscriptionTableRow
{...rest}
catalogSourceMissing={catalogSourceMissing}
obj={subscription as SubscriptionKind}
Expand Down Expand Up @@ -962,7 +941,7 @@ export type ClusterServiceVersionTableRowProps = {
subscription: SubscriptionKind;
};

export type FailedSubscriptionTableRowProps = {
type SubscriptionTableRowProps = {
catalogSourceMissing: boolean;
index: number;
key?: string;
Expand Down