Skip to content

WEB-815 automatically the Filename#3259

Merged
IOhacker merged 1 commit intoopenMF:devfrom
Nightwing-77:docs
Mar 2, 2026
Merged

WEB-815 automatically the Filename#3259
IOhacker merged 1 commit intoopenMF:devfrom
Nightwing-77:docs

Conversation

@Nightwing-77
Copy link
Contributor

@Nightwing-77 Nightwing-77 commented Mar 2, 2026

Description

when a file is selected, the File Name field gets auto-filled using the selected file’s name. Earlier, users had to type it manually, which felt unnecessary and confusing.

-made sure not to overwrite the file name if it's already set

-tried and tested feature

Related issues and discussion

WEB-815

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • [*] If you have multiple commits please combine them into one commit by squashing them.

  • [*] Read and understood the contribution guidelines at web-app/.github/CONTRIBUTING.md.

Summary by CodeRabbit

  • New Features
    • File uploads now automatically populate the filename field when a file is selected, eliminating the need for manual entry.

@coderabbitai
Copy link

coderabbitai bot commented Mar 2, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • 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

Walkthrough

The onFileSelect method in the upload document dialog component has been enhanced to automatically populate the fileName field when it remains empty, in addition to setting the selected file value.

Changes

Cohort / File(s) Summary
Upload Document Dialog Enhancement
src/app/clients/clients-view/custom-dialogs/upload-document-dialog/upload-document-dialog.component.ts
Enhanced onFileSelect method to auto-fill the fileName field when empty, alongside existing file value assignment.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and grammatically incomplete ('automatically the Filename' lacks a verb), making it unclear what action was taken despite relating to the PR's objective. Revise the title to be grammatically correct and descriptive, such as 'Auto-fill filename when file is selected' or 'WEB-815: Auto-fill File Name field on file selection'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 unit tests (beta)
  • 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.

🧹 Nitpick comments (1)
src/app/clients/clients-view/custom-dialogs/upload-document-dialog/upload-document-dialog.component.ts (1)

112-120: Consider adding stricter typing for the event parameter.

The $event: any parameter bypasses type safety. Using a proper type improves code clarity and catches potential issues at compile time.

♻️ Proposed type-safe refactor
-  onFileSelect($event: any) {
-    if ($event.target.files.length > 0) {
-      const file = $event.target.files[0];
-      this.uploadDocumentForm.get('file').setValue(file);
+  onFileSelect($event: Event) {
+    const input = $event.target as HTMLInputElement;
+    if (input.files && input.files.length > 0) {
+      const file = input.files[0];
+      this.uploadDocumentForm.get('file')?.setValue(file);
       if (!this.uploadDocumentForm.get('fileName').value) {
-        this.uploadDocumentForm.get('fileName').setValue(file.name);
+        this.uploadDocumentForm.get('fileName')?.setValue(file.name);
       }
     }
   }

As per coding guidelines: "For Angular code: verify... strict type safety" and based on learnings: use proper typing instead of any.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/app/clients/clients-view/custom-dialogs/upload-document-dialog/upload-document-dialog.component.ts`
around lines 112 - 120, The onFileSelect handler uses a weak any type for
$event; change the signature of onFileSelect to accept a typed Event (e.g.,
event: Event or InputEvent) and cast event.target to HTMLInputElement (const
input = event.target as HTMLInputElement) before accessing input.files, then use
input.files.length and input.files[0] when setting values on uploadDocumentForm
and fileName; keep the existing logic but replace $event and direct property
access with the typed input variable to restore strict type safety in
onFileSelect.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@src/app/clients/clients-view/custom-dialogs/upload-document-dialog/upload-document-dialog.component.ts`:
- Around line 112-120: The onFileSelect handler uses a weak any type for $event;
change the signature of onFileSelect to accept a typed Event (e.g., event: Event
or InputEvent) and cast event.target to HTMLInputElement (const input =
event.target as HTMLInputElement) before accessing input.files, then use
input.files.length and input.files[0] when setting values on uploadDocumentForm
and fileName; keep the existing logic but replace $event and direct property
access with the typed input variable to restore strict type safety in
onFileSelect.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 155aa7d and 32cfa99.

📒 Files selected for processing (1)
  • src/app/clients/clients-view/custom-dialogs/upload-document-dialog/upload-document-dialog.component.ts

Copy link
Contributor

@IOhacker IOhacker left a comment

Choose a reason for hiding this comment

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

LGTM

@IOhacker IOhacker merged commit b741efb into openMF:dev Mar 2, 2026
5 checks passed
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