Skip to content

Conversation

@sjd78
Copy link
Member

@sjd78 sjd78 commented Aug 30, 2025

Resolves: https://issues.redhat.com/browse/MTA-6003

The new application form should have the basic details and the source code sections expanded by default. The other sections should be collapsed by default.

When editing an existing application, the sections that have data should be expanded by default.

Note: The UI sanity tests break with this PR. The test probably needs to only click to toggle the source repo section expansion if the source repo fields are not visible.

UI tests PR: 1660

Summary by CodeRabbit

  • New Features

    • Application form now adapts to create vs. edit mode, auto-expanding relevant sections:
      • Source Code when creating or when repository details exist.
      • Binary when editing with group, artifact, and version set.
      • Source Platform when editing with a platform set.
      • Asset Repository when editing with asset repository details.
  • Refactor

    • Strengthened internal typing for repository kinds to improve reliability (no user-facing changes).

Resolves: https://issues.redhat.com/browse/MTA-6003

The new application form should have the basic details and the
source code sections expanded by default.  The other sections should
be collapsed by default.

When editing an existing application, the sections that have
data should be expanded by default.

Signed-off-by: Scott J Dickerson <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Aug 30, 2025

Walkthrough

Adds an application prop from ApplicationFormModal to ApplicationForm. ApplicationForm uses this prop to determine initial expansion states of several sections. Strengthens typing in useApplicationForm by introducing RepositoryKind and updating FormValues.kind and assetKind types. No runtime submission/validation flow changes.

Changes

Cohort / File(s) Summary of changes
Modal-to-Form Prop Wiring
client/src/app/pages/applications/application-form/application-form-modal.tsx
Passes new application prop to ApplicationForm; existing form and data props unchanged.
ApplicationForm Prop and Expansion Logic
client/src/app/pages/applications/application-form/application-form.tsx
Adds application: Application | null prop. Uses it to set initial expanded states for Source Code, Binary, Source Platform, and Asset Repository sections based on create vs. edit context and field presence.
Form Typing Strengthening
client/src/app/pages/applications/application-form/useApplicationForm.ts
Introduces RepositoryKind = "git" | "subversion" | "". Updates FormValues.kind and assetKind to RepositoryKind. Adjusts default value casts; no runtime logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Modal as ApplicationFormModal
  participant Form as ApplicationForm
  participant UI as Expandable Sections

  User->>Modal: Open application form
  Modal->>Form: Render with props { form, data, application }
  Note right of Form: New prop: application

  alt application == null (create)
    Form->>UI: Init: Source Code expanded
    Form->>UI: Init: Binary collapsed
    Form->>UI: Init: Source Platform collapsed
    Form->>UI: Init: Asset Repository collapsed
  else application != null (edit)
    Form->>UI: Init based on existing fields:<br/>- Source Code if kind && sourceRepository<br/>- Binary if group && artifact && version<br/>- Source Platform if sourcePlatform<br/>- Asset Repository if assetKind && assetRepository
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nudge the form with a twitch of nose,
New prop hops in where the logic grows.
Git or SVN, the types align,
Sections peek out when fields combine.
In burrows of code, I thump with glee—
Expand, collapse, then ship for tea. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sjd78 sjd78 requested a review from mguetta1 August 30, 2025 00:09
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 (2)
client/src/app/pages/applications/application-form/useApplicationForm.ts (2)

20-20: Centralize repo kind literals and derive the type from a single source of truth

Prevents drift between types, validation, and select options; also enables reuse elsewhere.

-type RepositoryKind = "git" | "subversion" | "";
+export const REPOSITORY_KINDS = ["", "git", "subversion"] as const;
+export type RepositoryKind = (typeof REPOSITORY_KINDS)[number];

Outside this hunk, consider switching Yup to the shared list to avoid duplication:

// replace: string().oneOf(["", "git", "subversion"])
kind: string().oneOf([...REPOSITORY_KINDS]),
// and for assetKind:
assetKind: string().oneOf([...REPOSITORY_KINDS]),

234-234: Avoid unsafe casts; coerce to RepositoryKind with a guard

Removes the need for as and safely normalizes unexpected values.

-      kind: (application?.repository?.kind ?? "") as RepositoryKind,
+      kind: toRepositoryKind(application?.repository?.kind),
...
-      assetKind: (application?.assets?.kind ?? "") as RepositoryKind,
+      assetKind: toRepositoryKind(application?.assets?.kind),

Add outside this hunk:

const toRepositoryKind = (v: unknown): RepositoryKind =>
  v === "git" || v === "subversion" ? v : "";

Also applies to: 243-243

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a89124f and fd1d72e.

📒 Files selected for processing (3)
  • client/src/app/pages/applications/application-form/application-form-modal.tsx (1 hunks)
  • client/src/app/pages/applications/application-form/application-form.tsx (3 hunks)
  • client/src/app/pages/applications/application-form/useApplicationForm.ts (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
client/src/app/pages/applications/application-form/application-form-modal.tsx (1)
client/src/app/pages/applications/application-form/application-form.tsx (1)
  • ApplicationForm (27-450)
client/src/app/pages/applications/application-form/application-form.tsx (3)
client/src/app/pages/applications/application-form/useApplicationForm.ts (1)
  • useApplicationForm (76-354)
client/src/app/pages/applications/application-form/useApplicationFormData.ts (1)
  • useApplicationFormData (38-137)
client/src/app/api/models.ts (1)
  • Application (138-163)
⏰ 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 (5)
client/src/app/pages/applications/application-form/useApplicationForm.ts (1)

30-30: FormValues narrowing verified – All comparisons (validation schema, URL serializers), repositoryKindOptions, and payload serialization exclusively use “git” and “subversion” (plus the empty string), matching RepositoryKind. No mismatches detected.

client/src/app/pages/applications/application-form/application-form-modal.tsx (1)

68-68: Prop plumb-through looks correct

Passing application down enables the new initial expansion behavior.

client/src/app/pages/applications/application-form/application-form.tsx (3)

25-25: Adding Application type import is appropriate


27-31: Props updated to include application: OK


50-68: Trim form string values in initial state to avoid whitespace-only expansion.
Example—apply to all string fields:

-  !!values.sourceRepository
+  !!values.sourceRepository?.trim()

Optional: recalculate expansions in a useEffect on application?.id.

Copy link
Collaborator

@mguetta1 mguetta1 left a comment

Choose a reason for hiding this comment

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

Tested locally. It looks great

@sjd78
Copy link
Member Author

sjd78 commented Sep 2, 2025

Thanks for handling the test update @mguetta1 !

@sjd78 sjd78 merged commit 7f7f27c into konveyor:main Sep 2, 2025
23 of 24 checks passed
@sjd78 sjd78 deleted the new-application-form-sections branch September 2, 2025 13:40
sshveta pushed a commit to sshveta/tackle2-ui that referenced this pull request Oct 31, 2025
…ult (konveyor#2585)

Resolves: https://issues.redhat.com/browse/MTA-6003

The new application form should have the basic details and the source
code sections expanded by default. The other sections should be
collapsed by default.

When editing an existing application, the sections that have data should
be expanded by default.

UI tests PR: 1660

Signed-off-by: Scott J Dickerson <[email protected]>
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