Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make mandatory validation in ONVIF camera and HL7 monitor asset page #3585 #5592

Closed
wants to merge 3 commits into from

Conversation

NimbleNitesh
Copy link

@NimbleNitesh NimbleNitesh commented Jun 3, 2023

WHAT

The fields in ONVIF camera and HL7 monitor asset page are not mandatory
image
image

Proposed Changes

  • Fixes Make mandatory validation in ONVIF camera and HL7 monitor asset page #3585
  • In ONVIFCamera.tsx
    • Added the required attribute to the TextFormField components for the fields "Hospital Middleware Hostname," "Local IP Address," "Username," "Password," and "Stream UUID" to make them required fields.
    • Added a validation check in the handleSubmit function to ensure all the required fields are filled. If any required field is empty, an error notification is shown, and the form submission is prevented.
    • Added a validation check in the handleSubmit function to validate the IP address entered in the "Local IP Address" field using the checkIfValidIP function. If the IP address is not valid, an error message is displayed, and the form submission is prevented.
  • In HL7 Montior.tsx
    • Added the required attribute to the TextFormField component for that field.
      image
      image
      image
      image
      image

@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

HOW

🤖 Generated by Copilot at 3b11517

  • Fix typo and add required attribute to middleware hostname text field in HL7Monitor.tsx (link, link)
  • Remove empty line in HL7Monitor.tsx (link)
  • Rename and validate state variable for IP address error in ONVIFCamera.tsx (link, link, link)
  • Add error handling and notification logic to handleSubmit function in ONVIFCamera.tsx (link, link, link)
  • Add required attributes to stream UUID, camera address, username, and password text fields in ONVIFCamera.tsx (link, link, link, link, link)
  • Remove unnecessary Promise.resolve wrapper and extra dots from error messages in ONVIFCamera.tsx (link, link)
  • Remove empty line in ONVIFCamera.tsx (link)

@vercel
Copy link

vercel bot commented Jun 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
care-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2023 2:14pm

@netlify
Copy link

netlify bot commented Jun 3, 2023

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit c0d1c07
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/647b4a7c1e3be40008c00b4c
😎 Deploy Preview https://deploy-preview-5592--care-egov-staging.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@sonarcloud
Copy link

sonarcloud bot commented Jun 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@NimbleNitesh NimbleNitesh marked this pull request as ready for review June 3, 2023 14:16
@NimbleNitesh NimbleNitesh requested a review from a team June 3, 2023 14:16
@NimbleNitesh NimbleNitesh requested a review from a team as a code owner June 3, 2023 14:16
@NimbleNitesh NimbleNitesh changed the title Nitesh Make mandatory validation in ONVIF camera and HL7 monitor asset page #3585 Jun 4, 2023
password.trim() === "" ||
streamUuid.trim() === ""
) {
Notification.Error({
Copy link
Member

Choose a reason for hiding this comment

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

We do not want such error notifications for missing fields. Instead, maintain a state which will store all field related errors. Then, Just after e.preventDefault(); here, call a validateForm method which will loop through all the fields we have and check for their validity and if they are invalid (missing), then update the error state with the field name with the error, errors[field] = "Please select the xxx field";. Have this error state linked to all the TextFormField as <TextFormField ..... error={state.errors['field_name']}. So we will have a red text box below the input with the error.

Take reference from UserAdd.tsx

Required error message design (sample):
image

Current error message design on this PR:
image
image

Suggestion by @nihal467 . Feel free to ask any clarifications on this.

@nihal467
Copy link
Member

nihal467 commented Jun 7, 2023

@NimbleNitesh

@github-actions github-actions bot added the merge conflict pull requests with merge conflict label Jun 8, 2023
@github-actions
Copy link

github-actions bot commented Jun 8, 2023

👋 Hi, @NimbleNitesh,
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.


This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there.

@github-actions
Copy link

Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 16, 2023
@github-actions
Copy link

Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, This pr has been automatically closed because it has not had any recent activity. Thank you for your contributions. Feel free to repopen the pr.

@github-actions github-actions bot closed this Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes required merge conflict pull requests with merge conflict stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make mandatory validation in ONVIF camera and HL7 monitor asset page
4 participants