Skip to content

Conversation

mguetta1
Copy link
Collaborator

@mguetta1 mguetta1 commented Sep 10, 2025

Resolves: https://issues.redhat.com/browse/MTA-6124
Resolves: #2602

  • Use currently selected platform kind instead of platform prop for URL tooltip
  • Add fallback tooltip text for unknown platform kinds
  • Fixes https://issues.redhat.com/browse/MTA-6124 where tooltip was missing in create wizard but present in update wizard
Screencast_20250910_153810.webm

Summary by CodeRabbit

  • New Features

    • Platform URL field shows a dynamic tooltip that updates immediately based on the selected platform type.
    • Clear fallback tooltip text is displayed when the platform type is unknown.
  • Chores

    • Added English translation for the platform URL tooltip to improve clarity and i18n coverage.
    • Form now tracks the selected platform type in real time for a more responsive UI.

Copy link

coderabbitai bot commented Sep 10, 2025

Walkthrough

Adds an English translation key for a platform URL tooltip, changes tooltip fallback to use that translation, and updates the platform form to watch the selected kind and compute the URL tooltip dynamically based on current selection.

Changes

Cohort / File(s) Summary
Translations
client/public/locales/en/translation.json
Added tooltip.platformUrl = "API URL to the source platform"; adjusted trailing comma for JSON validity.
Platform form UI logic
client/src/app/pages/source-platforms/components/platform-form.tsx
Uses watch("kind") to derive selectedKind; URL field tooltip now calls getUrlTooltip(selectedKind); updated select handling with toOptionLike and adjusted imports.
Kind list hook / tooltip fallback
client/src/app/pages/source-platforms/usePlatformKindList.ts
getUrlTooltip unknown-kind fallback returns t("tooltip.platformUrl") instead of ""; added [t] to useCallback dependencies; import reordering.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant PF as PlatformForm (React)
  participant HF as useForm/watch
  participant KL as usePlatformKindList.getUrlTooltip
  participant I18N as i18n t()

  U->>PF: Open Create/Edit Platform
  PF->>HF: watch("kind")
  HF-->>PF: selectedKind updates
  PF->>KL: getUrlTooltip(selectedKind)
  alt Known kind
    KL-->>PF: Kind-specific tooltip
  else Unknown kind
    KL->>I18N: t("tooltip.platformUrl")
    I18N-->>KL: "API URL to the source platform"
    KL-->>PF: Fallback tooltip
  end
  PF-->>U: Show URL field with tooltip
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • ibolton336
  • rszwajko

Pre-merge checks (3 passed, 1 warning, 1 inconclusive)

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The added imports of UI helpers and identity‐related hooks and the reorganized data fetch logic in platform-form.tsx extend beyond the scope of restoring the missing tooltip functionality, introducing unrelated form and data‐handling changes not specified by the tooltip‐focused issue. Please remove or isolate the identity fetch and general UI helper import changes into a separate PR so that this one focuses solely on restoring the tooltip functionality as defined by the linked issue.
Description Check ❓ Inconclusive The provided description lists the issue references and outlines the key implementation points but cannot be validated against a known template because the repository’s required PR description structure was not supplied, leaving it unclear whether all mandatory sections (such as background, implementation details, and testing instructions) are present. Please provide the repository’s pull request description template or ensure the PR description includes all required sections as defined by the template, such as background, implementation details, and testing instructions.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly summarizes the primary change—restoring the missing tooltip text in the create platform wizard—and uses the correct emoji alias prefix :bug: to indicate a patch fix, making it clear and focused on the main issue without extraneous details.
Linked Issues Check ✅ Passed The changes implement dynamic tooltip selection by watching the currently selected platform kind, introduce the fallback translation key in translation.json, and update the URL tooltip logic in the hook, fully satisfying the objectives from issue #2602 to restore and match tooltip behavior in the create wizard.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

"I nibble keys and hop in code,
A tiny hint on URL mode.
When kinds are odd and tooltips shy,
I hum the fallback from the sky.
A rabbit cheers — your form’s in tune!" 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e866957 and 6b0b6fd.

📒 Files selected for processing (1)
  • client/public/locales/en/translation.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • client/public/locales/en/translation.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: unit-test
  • GitHub Check: build-and-upload-for-global-ci
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
client/public/locales/en/translation.json (1)

619-621: Polish tooltip copy and punctuation

Consider adding a terminal period for consistency with nearby tooltips (and optionally “of” instead of “to”).

-    "platformUrl": "API URL to the source platform"
+    "platformUrl": "API URL to the source platform."
client/src/app/pages/source-platforms/usePlatformKindList.ts (1)

41-49: Good fix: translated fallback + correct memo deps

Returning t("tooltip.platformUrl") for unknown kinds and adding [t] to the callback deps addresses the missing tooltip in the create wizard and avoids stale translations.

If you plan to support multiple kinds, consider i18n-izing KIND_MAP strings as well to avoid mixed localized and hardcoded tooltips.

client/src/app/pages/source-platforms/components/platform-form.tsx (1)

238-253: Optional: sort identity options for UX

Sorting identitiesOptions alphabetically improves findability in the typeahead.

-  const identitiesOptions = identities
-    .filter(({ kind }) => kind === "source")
-    .map((identity) => identity.name);
+  const identitiesOptions = identities
+    .filter(({ kind }) => kind === "source")
+    .map((identity) => identity.name)
+    .sort((a, b) => a.localeCompare(b));
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 182e124 and e866957.

📒 Files selected for processing (3)
  • client/public/locales/en/translation.json (1 hunks)
  • client/src/app/pages/source-platforms/components/platform-form.tsx (5 hunks)
  • client/src/app/pages/source-platforms/usePlatformKindList.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-29T16:01:04.207Z
Learnt from: sjd78
PR: konveyor/tackle2-ui#2583
File: client/src/app/pages/identities/components/identity-form/kind-source-form.tsx:17-26
Timestamp: 2025-08-29T16:01:04.207Z
Learning: Skip i18n/internationalization suggestions for the file client/src/app/pages/identities/components/identity-form/kind-source-form.tsx - hardcoded strings like "Username/Password" and "Private Key/Passphrase" should remain as-is.

Applied to files:

  • client/src/app/pages/source-platforms/components/platform-form.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: unit-test
  • GitHub Check: build-and-upload-for-global-ci
🔇 Additional comments (4)
client/src/app/pages/source-platforms/usePlatformKindList.ts (1)

4-5: Imports OK

Added types are appropriate.

client/src/app/pages/source-platforms/components/platform-form.tsx (3)

117-122: Primary fix looks good: dynamic URL tooltip based on current selection

Using watch("kind") and passing selectedKind into getUrlTooltip correctly updates the tooltip when the user changes the kind in the create wizard.

Also applies to: 142-143, 217-217


2-2: Import reorg/additions acknowledged

Looks fine.

Also applies to: 5-5, 16-20, 25-28, 31-31, 34-34


72-76: Preserve selected identity on edit

  • Destructure setValue from useForm (no need to default identitiesuseFetchIdentities() already returns []).
  • After selectedKind, add:
    React.useEffect(() => {
      if (platform?.identity?.id && identities.length) {
        const name = identities.find(i => i.id === platform.identity.id)?.name;
        if (name) setValue("credentials", name, { shouldDirty: false });
      }
    }, [identities, platform?.identity?.id, setValue]);
  • Confirm whether updatePlatform uses PUT (which may clear omitted fields) or PATCH (which does not) to avoid accidentally unsetting the identity.

Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

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

This is ok.

I added useRepositoryKind() that uses a different approach for static list with translated keys. It would be good to harmonize around a common approach if/when we have to update again, or if there is another hook that provides a set of static data.

@sjd78 sjd78 merged commit 6a30106 into konveyor:main Sep 11, 2025
12 checks passed
@mguetta1 mguetta1 deleted the url-tooltip branch September 11, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing tooltip text on 'Create new platform' wizard
2 participants