Skip to content

Commit

Permalink
Merge pull request #4537 from jeff-phillips-18/no-revisions
Browse files Browse the repository at this point in the history
Bug 1808076: Fix UI crash when deleting revisions
  • Loading branch information
openshift-merge-robot committed Feb 28, 2020
2 parents 9424e9b + 39dab55 commit e355e91
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 19 deletions.
3 changes: 2 additions & 1 deletion frontend/packages/console-shared/src/utils/pod-ring-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ export const podRingLabel = (
): PodRingLabelType => {
const {
spec: { replicas },
status: { availableReplicas },
status,
kind,
} = obj;
const { availableReplicas } = status || {};

const isPending = (pods?.length === 1 && pods[0].status?.phase === 'Pending') || replicas;
const pluralize = replicas > 1 || replicas === 0 ? 'pods' : 'pod';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ export type HelmReleaseProps = {
WithDndDropProps;

const HelmRelease: React.FC<HelmReleaseProps> = (props) => {
if (
props.element.isCollapsed() ||
!props.element.getData().groupResources ||
!props.element.getData().groupResources.length
) {
if (props.element.isCollapsed()) {
return <HelmReleaseNode {...props} />;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const HelmReleaseGroup: React.FC<HelmReleaseGroupProps> = ({
);
const refs = useCombineRefs(dragNodeRef, dndDropRef, hoverRef);
const [filtered] = useSearchFilter(element.getLabel());
const hasChildren = element.getChildren()?.length > 0;
return (
<>
<NodeShadows />
Expand Down Expand Up @@ -69,6 +70,11 @@ const HelmReleaseGroup: React.FC<HelmReleaseGroupProps> = ({
: NODE_SHADOW_FILTER_ID,
)}
/>
{!hasChildren && (
<text x={x + width / 2} y={y + height / 2} dy="0.35em" textAnchor="middle">
No Resources
</text>
)}
</g>
</Layer>
{element.getLabel() && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ const KnativeService: React.FC<KnativeServiceProps> = (props) => {
name: resourceObj.metadata.name,
namespace: resourceObj.metadata.namespace,
});
if (
props.element.isCollapsed() ||
!props.element.getData().groupResources ||
!props.element.getData().groupResources.length
) {
if (props.element.isCollapsed()) {
return <KnativeServiceNode {...props} editAccess={editAccess} />;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const KnativeServiceGroup: React.FC<KnativeServiceGroupProps> = ({
);

const nodeRefs = useCombineRefs(innerHoverRef, dragNodeRef);
const hasChildren = element.getChildren()?.length > 0;
const { data } = element.getData();
const hasDataUrl = !!data.url;
useAnchor(
Expand Down Expand Up @@ -139,6 +140,11 @@ const KnativeServiceGroup: React.FC<KnativeServiceGroupProps> = ({
: NODE_SHADOW_FILTER_ID,
)}
/>
{!hasChildren && (
<text x={x + width / 2} y={y + height / 2} dy="0.35em" textAnchor="middle">
No Revisions
</text>
)}
</g>
</Layer>
{hasDataUrl && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ export type OperatorBackedServiceProps = {
const OperatorBackedService: React.FC<OperatorBackedServiceProps> = (
props: OperatorBackedServiceProps,
) => {
if (
props.element.isCollapsed() ||
!props.element.getData().groupResources ||
!props.element.getData().groupResources.length
) {
if (props.element.isCollapsed()) {
return <OperatorBackedServiceNode {...props} />;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const OperatorBackedServiceGroup: React.FC<OperatorBackedServiceGroupProps> = ({
);

const nodeRefs = useCombineRefs(innerHoverRef, dragNodeRef);
const hasChildren = element.getChildren()?.length > 0;
const { data } = element.getData();
const [filtered] = useSearchFilter(element.getLabel());
const { x, y, width, height } = element.getBounds();
Expand Down Expand Up @@ -82,6 +83,11 @@ const OperatorBackedServiceGroup: React.FC<OperatorBackedServiceGroupProps> = ({
: NODE_SHADOW_FILTER_ID,
)}
/>
{!hasChildren && (
<text x={x + width / 2} y={y + height / 2} dy="0.35em" textAnchor="middle">
No Resources
</text>
)}
</g>
</Layer>
{(data.kind || element.getLabel()) && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ export const topologyModelFromDataModel = (
((d.type === TYPE_KNATIVE_SERVICE && !filters.display.knativeServices) ||
(d.type === TYPE_OPERATOR_BACKED_SERVICE && !filters.display.operatorGrouping)),
children: d.children,
group: d.children?.length > 0,
group: true,
shape: NodeShape.rect,
style: {
padding: d.type === TYPE_KNATIVE_SERVICE ? KNATIVE_GROUP_NODE_PADDING : GROUP_PADDING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ type DeploymentOverviewListProps = {
current: PodControllerOverviewItem;
};

const DeploymentOverviewList: React.FC<DeploymentOverviewListProps> = ({ current: { obj } }) => {
const DeploymentOverviewList: React.FC<DeploymentOverviewListProps> = ({ current }) => {
const { obj } = current || {};
const namespace = obj?.metadata?.namespace;
const deploymentData = obj?.metadata?.ownerReferences[0];
return (
Expand All @@ -23,7 +24,7 @@ const DeploymentOverviewList: React.FC<DeploymentOverviewListProps> = ({ current
</li>
</ul>
) : (
<span className="text-muted">No Deploymennt found for this resource.</span>
<span className="text-muted">No Deployment found for this resource.</span>
)}
</>
);
Expand Down

0 comments on commit e355e91

Please sign in to comment.