OCPBUGS-67295: Fix icon display for duplicate operator names from different catalogs - #16898
OCPBUGS-67295: Fix icon display for duplicate operator names from different catalogs#16898ericahinkleRH wants to merge 1 commit into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@ericahinkleRH: This pull request references Jira Issue OCPBUGS-67295, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ericahinkleRH The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe icon resource URL now includes the package manifest catalog source in its query parameters. ChangesIcon resource URL
Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@ericahinkleRH: This pull request references Jira Issue OCPBUGS-67295, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@ericahinkleRH: This pull request references Jira Issue OCPBUGS-67295, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/public/components/resource-quota.jsx`:
- Around line 97-100: Update the binary-resource handling in the resource quota
formatter to use convertToBaseValue(value) for string inputs instead of
parseFloat(value), while preserving numeric inputs directly because non-string
values convert to null. Add coverage for Gi, Mi, and ephemeral-storage quantity
values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: bc19d6d4-6985-4262-8fa6-8f9b15777936
📒 Files selected for processing (3)
frontend/packages/operator-lifecycle-manager/src/components/index.tsxfrontend/public/components/__tests__/resource-quota.spec.tsxfrontend/public/components/resource-quota.jsx
| if (isBinaryResourceType(resourceType)) { | ||
| // Convert string to number for humanizeBinaryBytes | ||
| const numericValue = typeof value === 'string' ? parseFloat(value) : value; | ||
| return humanizeBinaryBytes(numericValue).string; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
ast-grep outline frontend/public/components/utils/units.js --items all --match 'convertToBaseValue|humanizeBinaryBytes'
rg -n -C 3 'convertToBaseValue|humanizeBinaryBytes|parseFloat' \
frontend/public/components/utils/units.js \
frontend/public/components/resource-quota.jsx \
frontend/public/components/__tests__/resource-quota.spec.tsx
Repository: openshift/console
Length of output: 5193
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- units.js conversion and humanizer implementation ---'
sed -n '220,390p' frontend/public/components/utils/units.js
printf '%s\n' '--- resource-quota.jsx context ---'
sed -n '1,180p' frontend/public/components/resource-quota.jsx
printf '%s\n' '--- resource-quota tests ---'
sed -n '1,260p' frontend/public/components/__tests__/resource-quota.spec.tsx
printf '%s\n' '--- quantity-related tests/usages ---'
rg -n -C 3 'convertToBaseValue|humanizeBinaryBytes|formatResourceValue|ephemeral-storage|[0-9]+(Ki|Mi|Gi|Ti)' \
frontend/public/components --glob '*.{js,jsx,ts,tsx}' | head -n 500
Repository: openshift/console
Length of output: 50373
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
p = Path("frontend/public/components/utils/units.js")
s = p.read_text()
start = s.index("const splitValueAndUnit")
end = s.index("export const convertToBaseValue")
print(s[start:end])
end2 = s.find("\n};", end)
print(s[end:end2 + 3])
PY
node - <<'JS'
const values = ['1Gi', '1Mi', '1G', '100m', '123', '1.5Gi', '1e3'];
for (const value of values) {
console.log(JSON.stringify(value), parseFloat(value));
}
JS
Repository: openshift/console
Length of output: 260
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- conversion implementation ---'
sed -n '180,220p' frontend/public/components/utils/units.js
sed -n '355,410p' frontend/public/components/utils/units.js
printf '%s\n' '--- focused conversion tests ---'
sed -n '225,285p' frontend/public/components/__tests__/units.spec.js
rg -n -C 2 "ResourceUsageRow|requests.memory|requests.storage|ephemeral-storage|Gi|Mi" \
frontend/public/components/__tests__/resource-quota.spec.tsx
printf '%s\n' '--- standalone quantity behavior ---'
node - <<'JS'
const binary = { Ki: 2 ** 10, Mi: 2 ** 20, Gi: 2 ** 30, Ti: 2 ** 40, Pi: 2 ** 50, Ei: 2 ** 60 };
for (const input of ['1Gi', '1Mi', '5Gi', '10Gi', '2147483648']) {
const parsed = Number.parseFloat(input);
const match = input.match(/^([0-9]+(?:\.[0-9]+)?)([A-Za-z]+)?$/);
const converted = match
? Number(match[1]) * (match[2] ? binary[match[2]] : 1)
: null;
console.log(`${input}: parseFloat=${parsed}, quantityBaseValue=${converted}`);
}
console.log(`numeric convertToBaseValue contract: non-string -> null`);
JS
Repository: openshift/console
Length of output: 8584
Convert Kubernetes quantity strings before humanizing.
When value is a string, use convertToBaseValue(value) instead of parseFloat(value). Preserve numeric values because convertToBaseValue returns null for non-string inputs. Add coverage for Gi, Mi, and ephemeral-storage values.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@frontend/public/components/resource-quota.jsx` around lines 97 - 100, Update
the binary-resource handling in the resource quota formatter to use
convertToBaseValue(value) for string inputs instead of parseFloat(value), while
preserving numeric inputs directly because non-string values convert to null.
Add coverage for Gi, Mi, and ephemeral-storage quantity values.
…ferent catalogs When multiple catalogs provide operators with the same name (e.g., loki-operator from both redhat-operators and community-operators), the icon URL must include the catalog source to ensure the correct icon is displayed. Added catalog parameter to icon URL queryParams. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
e1db335 to
db67d14
Compare
|
@ericahinkleRH: This pull request references Jira Issue OCPBUGS-67295, which is valid. 3 validation(s) were run on this bug
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@ericahinkleRH: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@jcaianirh could you please trigger the remaining tests here? Thanks! |
Analysis / Root cause:
When multiple catalogs provide operators with the same name (e.g., loki-operator from both redhat-operators and community-operators), the icon URL generation in the
iconFor()function does not differentiate between catalogs. This causes incorrect icons to be displayed because the URL only includes the operator name, default channel, and CSV but not the catalog source.Solution description:
Added
catalog: pkg?.status?.catalogSourceto thequeryParamsin theiconFor()function withinfrontend/packages/operator-lifecycle-manager/src/components/index.tsx. This ensures the icon URL includes the catalog source, allowing the backend to serve the correct icon for operators with duplicate names from different catalogs.Screenshots / screen recording:
Test setup:
Test cases:
catalogquery parameterBrowser conformance:
Additional info:
This fix implements the solution proposed by Jian Zhang in OCPBUGS-67295.
Jira: https://issues.redhat.com/browse/OCPBUGS-67295
Reviewers and assignees:
/cc @jcaianirh
Summary by CodeRabbit