Skip to content

Add auth required field to import device flow#3550

Merged
Baalmart merged 4 commits into
stagingfrom
add-auth-required
May 28, 2026
Merged

Add auth required field to import device flow#3550
Baalmart merged 4 commits into
stagingfrom
add-auth-required

Conversation

@Codebmk

@Codebmk Codebmk commented May 28, 2026

Copy link
Copy Markdown
Member

Summary

Two focused improvements to the bulk and single device import flow in ImportDeviceModal:

  1. authRequired is now a first-class field in the bulk import pipeline
  2. Inline setErrors validation patterns replaced with showBanner for consistency

Changes

authRequired Field (useDevices.ts, import-device-modal.tsx)

  • Added authRequired to EXPECTED_FIELDS with required: true
  • Auto-maps common CSV header aliases: authrequired, authenticationrequired, requiresauth, requiredauth, auth required
  • Intelligently converts string values to boolean at transform time:
    • true / 1 / yes / ytrue
    • false / 0 / no / nfalse
    • Unrecognized values → default true with a console.warn
  • Defaults to true when the field is unmapped in the column mapper
  • Exposed as a <ReusableSelectInput> in the single-device import form

Error Handling Migration (import-device-modal.tsx)

Replaced all setErrors({ general: ... }) validation patterns with showBanner({ severity: 'error', scoped: true }):

  • Missing Sensor Manufacturer selection
  • Missing Category selection
  • Missing required field mappings
  • Duplicate column mappings
  • Empty CSV upload
  • Missing user ID in handleConfirmImport

Removed the now-redundant {errors.general && ...} banner divs from the mappingMode and previewMode JSX blocks.


Files Changed

  • src/vertex/components/features/devices/import-device-modal.tsx
  • src/vertex/core/hooks/useDevices.ts

Screenshots (optional)

Screenshot 2026-05-28 160947 Screenshot 2026-05-28 160906

Summary by CodeRabbit

  • New Features

    • Added "Authentication Required" field to device bulk and single imports with new preview column.
    • Authentication status displays as Yes/No in import preview.
    • New "Authentication Required" select control for single-device import mode.
  • Improvements

    • Improved error handling with banner notifications for CSV/JSON and file validation failures.
    • Enhanced payload cleanup logic during import.

Review Change Stack

Codebmk added 2 commits May 28, 2026 15:58
Introduce a new authRequired field to the device import flow: add it to EXPECTED_FIELDS, include UI select input, and default it to true on new/cleared forms. Update parsing to detect common CSV header aliases for authentication, convert string values (true/1/yes/etc.) to boolean, and ensure transformed preview/types include boolean. Also tighten payload cleanup logic to remove empty strings/undefined/null/empty arrays, adjust handleInputChange to accept boolean, and update useImportDevice types to include authRequired.
…er feedback

Replace setErrors with showBanner for error notifications in the ImportDeviceModal component. This change enhances user experience by providing scoped error messages for various validation scenarios, including file type checks and required field mappings. Additionally, update the UI to display the new authRequired field in the device import table.
@Codebmk Codebmk self-assigned this May 28, 2026
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@Codebmk, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 minutes and 39 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 705e4ab6-7829-4b06-95be-ce57f59c5c44

📥 Commits

Reviewing files that changed from the base of the PR and between f74b8aa and a2e7ac3.

📒 Files selected for processing (2)
  • src/vertex/app/changelog.md
  • src/vertex/components/features/devices/import-device-modal.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-auth-required

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 `@src/vertex/components/features/devices/import-device-modal.tsx`:
- Around line 272-285: The current authRequired parsing silently defaults
invalid values to true; instead, when field.key === 'authRequired' validate
rawValue against TRUTHY_VALUES and FALSY_VALUES and, if neither matches, do NOT
set device.authRequired and add a validation error for that row (e.g., push to
the component's importErrors/rowErrors or call markInvalidRow) so preview/import
is blocked until corrected; remove the console.warn fallback and ensure
downstream import/preview checks the errors collection before proceeding.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ed213c2d-3420-46a9-8b2a-2478fa1b3d5b

📥 Commits

Reviewing files that changed from the base of the PR and between ee1c9b5 and f74b8aa.

📒 Files selected for processing (2)
  • src/vertex/components/features/devices/import-device-modal.tsx
  • src/vertex/core/hooks/useDevices.ts

Comment thread src/vertex/components/features/devices/import-device-modal.tsx
@github-actions

Copy link
Copy Markdown
Contributor

New azure vertex changes available for preview here

… error banner

Add validation for the authRequired field in the ImportDeviceModal component. If invalid values are detected during the import process, an error banner is shown to the user, indicating the specific rows with issues. This improves user feedback and ensures correct data entry for authentication requirements.
@github-actions

Copy link
Copy Markdown
Contributor

New azure vertex changes available for preview here

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

New azure vertex changes available for preview here

@Baalmart
Baalmart merged commit 519fb0d into staging May 28, 2026
21 checks passed
@Baalmart
Baalmart deleted the add-auth-required branch May 28, 2026 13:29
@Baalmart Baalmart mentioned this pull request May 28, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants