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

[release-4.4] Bug 1808414: Fix UI crash when deleting revisions #4552

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
3 changes: 2 additions & 1 deletion frontend/packages/console-shared/src/utils/pod-ring-utils.ts
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
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
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
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
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
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
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
Expand Up @@ -724,7 +724,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
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