Skip to content

[OSDEV-2368] Add reusable labels, default value fallback, and external link icons to partner fields#912

Open
protsack-stephan wants to merge 7 commits intomainfrom
OSDEV-2368-partner-field-enhancements
Open

[OSDEV-2368] Add reusable labels, default value fallback, and external link icons to partner fields#912
protsack-stephan wants to merge 7 commits intomainfrom
OSDEV-2368-partner-field-enhancements

Conversation

@protsack-stephan
Copy link
Collaborator

@protsack-stephan protsack-stephan commented Mar 12, 2026

Partner field property components had duplicated inline label rendering, no support for schema-defined default values, and no visual indicator that links open externally.

  • Reusable PartnerFieldLabel component - Replaces inline title logic across DateProperty, DateTimeProperty, UriProperty, UrlProperty, DefaultProperty, and IntegerProperty with a dedicated styled component.
  • Schema default fallback - Properties now display the schema default when the value object is missing the key.
  • External link icon - UriProperty, UrlProperty, and UriReferenceProperty render an OpenInNewIcon next to link text.
  • Custom link text - getLinkTextFromSchema supports a text field on schema properties for human-readable link labels.

Tests added or updated for all affected components.

OSDEV-2368

@barecheck
Copy link

barecheck bot commented Mar 12, 2026

React App | Jest test suite - Code coverage report

Total: 43.64%

Your code coverage diff: 0.17% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Mar 12, 2026

Dedupe Hub App | Unittest test suite - Code coverage report

Total: 55.73%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Mar 12, 2026

Contricleaner App | Unittest test suite - Code coverage report

Total: 98.75%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Mar 12, 2026

Countries App | Unittest test suite - Code coverage report

Total: 100%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

Replace inline label spans and the shared `label` class in
commonPropertyStyles with a dedicated PartnerFieldLabel component
that encapsulates the styling, removing the need to pass a custom
class through withStyles.

Made-with: Cursor
@barecheck
Copy link

barecheck bot commented Mar 12, 2026

Django App | Unittest test suite - Code coverage report

Total: 81.98%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

…partner field links

Partner field links (URI, URL, and URI Reference properties) now display
a small external-link icon next to the link text, so users can tell at a
glance that the link opens in a new tab.

Partners can also specify custom link text via a "text" field in their
schema configuration. When provided, this text is shown instead of the
raw URL, making links more readable and user-friendly.

Made-with: Cursor
@protsack-stephan protsack-stephan changed the title [OSDEV-2368] Add additional functionality to partner fields [OSDEV-2368] Enhance partner field properties with reusable labels, default value fallback, and external link icons Mar 12, 2026
@cursor
Copy link

cursor bot commented Mar 12, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a92f04c1-04fb-42a8-b651-9ebf7d002736

📥 Commits

Reviewing files that changed from the base of the PR and between eccac59 and 4226000.

📒 Files selected for processing (1)
  • src/react/src/components/PartnerFields/FormatComponents/DateProperty.jsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/react/src/components/PartnerFields/FormatComponents/DateProperty.jsx

📝 Walkthrough

Walkthrough

Introduces a reusable PartnerFieldLabel component, applies it across partner field property components, adds schema-default fallbacks for missing values, appends external-link icons to link properties, and updates utilities/tests to support custom link text resolution via schema.

Changes

Cohort / File(s) Summary
Documentation & Release Notes
​.agent/skills/pr-description/SKILL.md, doc/release/RELEASE-NOTES.md
Adds PR description guidance and documents the PartnerFields changes in release notes.
New Label Component & Styles
src/react/src/components/PartnerFields/PartnerFieldLabel/PartnerFieldLabel.jsx, src/react/src/components/PartnerFields/PartnerFieldLabel/styles.js
Adds PartnerFieldLabel component and its styles; exported as default (with PropTypes).
Property Format Components
src/react/src/components/PartnerFields/FormatComponents/DateProperty.jsx, src/react/src/components/PartnerFields/FormatComponents/DateTimeProperty.jsx, src/react/src/components/PartnerFields/FormatComponents/UriProperty.jsx, src/react/src/components/PartnerFields/FormatComponents/UriReferenceProperty/.../UriReferenceProperty.jsx, src/react/src/components/PartnerFields/FormatComponents/UrlProperty.jsx
Switches title rendering to PartnerFieldLabel, uses schema default fallback for missing values, passes propertyValue into link-text resolver, and adds OpenInNewIcon + link styling for link properties.
Type Components
src/react/src/components/PartnerFields/TypeComponents/DefaultProperty/DefaultProperty.jsx, src/react/src/components/PartnerFields/TypeComponents/IntegerProperty.jsx
Uses PartnerFieldLabel for titles and falls back to schema defaults for missing values.
Shared Styles
src/react/src/components/PartnerFields/styles.js
Adds link and linkIcon styles for inline-flex link layout and icon spacing.
Utilities
src/react/src/components/PartnerFields/utils.js, src/react/src/components/PartnerFields/PartnerFieldSchemaValue/utils.jsx
Extends getLinkTextFromSchema signature to accept a defaultValue (uses schema text when present); renderProperties now includes schema-defaulted properties when value lacks the key.
Tests — Component & Utility
src/react/src/__tests__/components/DateProperty.test.js, src/react/src/__tests__/components/DateTimeProperty.test.js, src/react/src/__tests__/components/DefaultProperty.test.js, src/react/src/__tests__/components/PartnerFieldLabel.test.jsx, src/react/src/__tests__/components/UriProperty.test.js, src/react/src/__tests__/components/UriReferenceProperty.test.js, src/react/src/__tests__/components/UrlProperty.test.js, src/react/src/__tests__/components/PartnerFieldSchemaValue.test.js, src/react/src/__tests__/utils/PartnerFieldsUtils.test.js, src/react/src/__tests__/utils/PartnerFieldSchemaValueUtils.test.js
Adds/updates tests to cover default fallbacks, title rendering via PartnerFieldLabel, external link icon rendering, and schema text-driven link text behavior; many assertions adjusted to check label and value separately.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • roman-stolar
  • VadimKovalenkoSNF
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the three main changes: adding a reusable PartnerFieldLabel component, schema default value fallback, and external link icons to partner field components.
Description check ✅ Passed The description is well-structured and directly related to the changeset, covering all major improvements: reusable labels, schema default fallback, external link icons, and custom link text support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch OSDEV-2368-partner-field-enhancements
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

Migrating from UI to YAML configuration.

Use the @coderabbitai configuration command in a PR comment to get a dump of all your UI settings in YAML format. You can then edit this YAML file and upload it to the root of your repository to configure CodeRabbit programmatically.

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: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/react/src/components/PartnerFields/FormatComponents/UriReferenceProperty/UriReferenceProperty.jsx (1)

26-31: ⚠️ Potential issue | 🟠 Major

Schema defaults still won't render for uri-reference fields.

Passing propertyValue as the fallback here does not help because propertyValue is still read only from value[propertyKey]. When the key is absent, Line 19 returns null before schemaProperties[propertyKey].default is ever consulted, so this component misses the new default-value behavior.

Proposed fix
 const UriReferenceProperty = ({
     propertyKey,
     value,
     schemaProperties: incomingSchemaProperties,
     partnerConfigFields: incomingPartnerConfigFields,
     classes,
 }) => {
-    const propertyValue = value[propertyKey];
+    const schemaProperties = incomingSchemaProperties || {};
+    const schemaProperty = schemaProperties[propertyKey] || {};
+    const propertyValue = Object.prototype.hasOwnProperty.call(value, propertyKey)
+        ? value[propertyKey]
+        : schemaProperty.default;
 
     if (!propertyValue) {
         return null;
     }
 
-    const schemaProperties = incomingSchemaProperties || {};
     const partnerConfigFields = incomingPartnerConfigFields || {};
     const description = getDescription(propertyKey, schemaProperties);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/react/src/components/PartnerFields/FormatComponents/UriReferenceProperty/UriReferenceProperty.jsx`
around lines 26 - 31, The issue is that UriReferenceProperty passes
propertyValue (which is derived from value[propertyKey]) as the fallback to
getLinkTextFromSchema, preventing schemaProperties[propertyKey].default from
being used when the key is absent; change the call so the fallback is the schema
default instead of propertyValue by replacing the last argument with
schemaProperties[propertyKey]?.default (use optional chaining to avoid crashes)
so getLinkTextFromSchema can fall back to the schema default when
value[propertyKey] is missing.
🧹 Nitpick comments (2)
src/react/src/__tests__/components/UriReferenceProperty.test.js (2)

95-96: Redundant assertion can be simplified.

screen.getByText('local-id') already asserts the element exists with that text content. The subsequent toHaveTextContent assertion is redundant.

♻️ Suggested simplification
-        const text = screen.getByText('local-id');
-        expect(text).toHaveTextContent('local-id');
+        expect(screen.getByText('local-id')).toBeInTheDocument();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/react/src/__tests__/components/UriReferenceProperty.test.js` around lines
95 - 96, The test contains a redundant assertion: calling
screen.getByText('local-id') already verifies an element with that text exists,
so remove the extra expect(...).toHaveTextContent('local-id') in
UriReferenceProperty.test.js; keep the screen.getByText('local-id') call (or
replace it with const el = screen.getByText('local-id') and assert on el only if
you need further checks) to simplify the test and avoid duplicate assertions.

114-115: Same redundant assertion pattern.

♻️ Suggested simplification
-        const text = screen.getByText('plain-value');
-        expect(text).toHaveTextContent('plain-value');
+        expect(screen.getByText('plain-value')).toBeInTheDocument();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/react/src/__tests__/components/UriReferenceProperty.test.js` around lines
114 - 115, The test contains a redundant assertion: calling
screen.getByText('plain-value') already throws if the node is missing, so remove
the duplicate expect(text).toHaveTextContent('plain-value') and replace it with
a single, clear assertion such as asserting presence (e.g.,
expect(screen.getByText('plain-value')).toBeInTheDocument()) or keep only the
getByText call; update the test in UriReferenceProperty.test.js by removing the
extra expect that references the local variable text.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agent/skills/pr-description/SKILL.md:
- Around line 90-92: Update the "good" example sentence in SKILL.md that
currently reads "using this as in Python3": replace it with "using this in
Python 3" and normalize all occurrences in that same block to use consistent
spacing and capitalization for "Python 2" and "Python 3" (e.g., "Python 2" /
"Python 3"); specifically edit the example text following "Create a Python3
build rule for status.py." so the wording is clear and consistent.
- Around line 22-23: Update the example diff commands in SKILL.md to use the
three-dot form so PR-scoped changes are shown; replace instances of "git diff
<base-branch>..HEAD --stat" and "git diff <base-branch>..HEAD" with the
merge-base scoped versions "git diff <base-branch>...HEAD --stat" and "git diff
<base-branch>...HEAD" respectively, and update any surrounding explanatory text
to mention that the three-dot form compares from the merge-base to show only
changes introduced by the branch.

In `@src/react/src/__tests__/utils/PartnerFieldSchemaValueUtils.test.js`:
- Around line 155-156: The test currently uses a concise arrow callback that
returns the matcher from result.forEach(el =>
expect(React.isValidElement(el)).toBe(true)); — change the callback to a block
body so it does not return the matcher: update the call to result.forEach(el =>
{ expect(React.isValidElement(el)).toBe(true); }); ensuring you modify the
forEach callback in PartnerFieldSchemaValueUtils.test.js and keep the assertion
using React.isValidElement unchanged.

In `@src/react/src/components/PartnerFields/FormatComponents/DateProperty.jsx`:
- Around line 10-17: The code assumes schemaProperties[propertyKey] exists and
dereferences schemaProperty.default, which can throw if undefined; update the
logic in DateProperty.jsx around schemaProperties/propertyKey to guard against
missing schema entries by resolving schemaProperty =
schemaProperties[propertyKey] || {} (or use optional chaining) and pass a safe
default when calling getFormattedDateValue (e.g., use schemaProperty.default ??
undefined or wrap the second getFormattedDateValue argument with {
[propertyKey]: schemaProperty?.default } so you never access .default on
undefined); ensure both calls to getFormattedDateValue handle the safe fallback.

In `@src/react/src/components/PartnerFields/FormatComponents/UriProperty.jsx`:
- Around line 11-12: The current assignment uses value[propertyKey] ||
schemaProperty.default which treats any falsy value (e.g., empty string, 0,
false) as missing; change it to check for key presence instead: determine
schemaProperty as now (schemaProperties[propertyKey] || {}) and set
propertyValue by testing whether value actually contains propertyKey (e.g.,
using Object.prototype.hasOwnProperty.call(value, propertyKey) or propertyKey in
value) and only use schemaProperty.default when the key is absent; update
references to schemaProperty, propertyKey, propertyValue, and value accordingly.

In `@src/react/src/components/PartnerFields/FormatComponents/UrlProperty.jsx`:
- Around line 11-12: Replace the fallback that uses || with a presence check so
explicit falsy values (e.g. empty string) are preserved: in the UrlProperty
component compute propertyValue by checking whether value has the propertyKey
(e.g. Object.prototype.hasOwnProperty.call(value, propertyKey) or value != null
&& propertyKey in value) and only use schemaProperty.default when the key is
missing; ensure you guard for value being null/undefined before testing
presence.

In `@src/react/src/components/PartnerFields/PartnerFieldSchemaValue/utils.jsx`:
- Around line 97-98: The guard incorrectly treats falsy schema defaults (0,
false, '', etc.) as absent; update the conditional that uses
propertySchema.default to instead check for the presence of the default key
(e.g., use 'default' in propertySchema or
Object.prototype.hasOwnProperty.call(propertySchema, 'default')) so properties
with falsy defaults are preserved when propertyKey is not in value; locate the
check around propertySchema = schemaProperties[propertyKey] || {} and replace
the && !propertySchema.default test with a presence check for the default key.

In
`@src/react/src/components/PartnerFields/TypeComponents/DefaultProperty/DefaultProperty.jsx`:
- Around line 11-13: The current fallback uses || which treats 0, false, and ''
as missing and substitutes schemaProperty.default; change the logic in
DefaultProperty.jsx so stringValue uses a nullish check instead (e.g., replace
the || fallback with ?? or an explicit check) so
getPropertyValueAsString(propertyKey, value) is only replaced by
schemaProperty.default when it returns null or undefined; reference symbols:
schemaProperty, stringValue, getPropertyValueAsString(propertyKey, value), and
schemaProperty.default.

In `@src/react/src/components/PartnerFields/TypeComponents/IntegerProperty.jsx`:
- Around line 10-11: The code uses the || operator when computing propertyValue,
which treats numeric 0 as falsy and thus overrides a valid 0 with
schemaProperty.default; update the propertyValue assignment (the expression
referencing propertyValue, value[propertyKey], and schemaProperty.default) to
use a nullish check (e.g., use the nullish coalescing operator ?? or an explicit
undefined/hasOwnProperty check) so that 0 is preserved as a valid value while
still falling back to schemaProperty.default only when the value is null or
undefined.

---

Outside diff comments:
In
`@src/react/src/components/PartnerFields/FormatComponents/UriReferenceProperty/UriReferenceProperty.jsx`:
- Around line 26-31: The issue is that UriReferenceProperty passes propertyValue
(which is derived from value[propertyKey]) as the fallback to
getLinkTextFromSchema, preventing schemaProperties[propertyKey].default from
being used when the key is absent; change the call so the fallback is the schema
default instead of propertyValue by replacing the last argument with
schemaProperties[propertyKey]?.default (use optional chaining to avoid crashes)
so getLinkTextFromSchema can fall back to the schema default when
value[propertyKey] is missing.

---

Nitpick comments:
In `@src/react/src/__tests__/components/UriReferenceProperty.test.js`:
- Around line 95-96: The test contains a redundant assertion: calling
screen.getByText('local-id') already verifies an element with that text exists,
so remove the extra expect(...).toHaveTextContent('local-id') in
UriReferenceProperty.test.js; keep the screen.getByText('local-id') call (or
replace it with const el = screen.getByText('local-id') and assert on el only if
you need further checks) to simplify the test and avoid duplicate assertions.
- Around line 114-115: The test contains a redundant assertion: calling
screen.getByText('plain-value') already throws if the node is missing, so remove
the duplicate expect(text).toHaveTextContent('plain-value') and replace it with
a single, clear assertion such as asserting presence (e.g.,
expect(screen.getByText('plain-value')).toBeInTheDocument()) or keep only the
getByText call; update the test in UriReferenceProperty.test.js by removing the
extra expect that references the local variable text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a73eb2c8-f08a-424d-8d3d-2f306bb55578

📥 Commits

Reviewing files that changed from the base of the PR and between d0344b1 and eccac59.

📒 Files selected for processing (24)
  • .agent/skills/pr-description/SKILL.md
  • doc/release/RELEASE-NOTES.md
  • src/react/src/__tests__/components/DateProperty.test.js
  • src/react/src/__tests__/components/DateTimeProperty.test.js
  • src/react/src/__tests__/components/DefaultProperty.test.js
  • src/react/src/__tests__/components/PartnerFieldLabel.test.jsx
  • src/react/src/__tests__/components/PartnerFieldSchemaValue.test.js
  • src/react/src/__tests__/components/UriProperty.test.js
  • src/react/src/__tests__/components/UriReferenceProperty.test.js
  • src/react/src/__tests__/components/UrlProperty.test.js
  • src/react/src/__tests__/utils/PartnerFieldSchemaValueUtils.test.js
  • src/react/src/__tests__/utils/PartnerFieldsUtils.test.js
  • src/react/src/components/PartnerFields/FormatComponents/DateProperty.jsx
  • src/react/src/components/PartnerFields/FormatComponents/DateTimeProperty.jsx
  • src/react/src/components/PartnerFields/FormatComponents/UriProperty.jsx
  • src/react/src/components/PartnerFields/FormatComponents/UriReferenceProperty/UriReferenceProperty.jsx
  • src/react/src/components/PartnerFields/FormatComponents/UrlProperty.jsx
  • src/react/src/components/PartnerFields/PartnerFieldLabel/PartnerFieldLabel.jsx
  • src/react/src/components/PartnerFields/PartnerFieldLabel/styles.js
  • src/react/src/components/PartnerFields/PartnerFieldSchemaValue/utils.jsx
  • src/react/src/components/PartnerFields/TypeComponents/DefaultProperty/DefaultProperty.jsx
  • src/react/src/components/PartnerFields/TypeComponents/IntegerProperty.jsx
  • src/react/src/components/PartnerFields/styles.js
  • src/react/src/components/PartnerFields/utils.js

@sonarqubecloud
Copy link

Copy link
Contributor

@vlad-shapik vlad-shapik left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants