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

HAI-2065 Implement file upload component #398

Merged
merged 4 commits into from
Nov 2, 2023

Conversation

markohaarni
Copy link
Contributor

@markohaarni markohaarni commented Oct 25, 2023

Description

File upload component uses HDS FileInput internally to handle user adding files from their machine and immediately sends added files to backend and shows a loading spinner and loading text while upload is in process.

Listing of files and deleting them as well as displaying error messages are done in separate tasks.

Jira Issue: https://helsinkisolutionoffice.atlassian.net/browse/HAI-2065

Type of change

  • Bug fix
  • New feature
  • Other

Instructions for testing

Only way to manually test this is to replace FileInput component locally in src/domain/johtoselvitys/Attachments.tsx with this new component, for example:

function handleFileUpload(uploading: boolean) {
  if (!uploading) {
    queryClient.invalidateQueries('attachments');
  }
}

<FileUpload
  id="cable-report-file-upload"
  accept=".pdf,.jpg,.jpeg,.png,.dgn,.dwg,.docx,.txt,.gt"
  maxSize={104857600}
  dragAndDrop
  multiple
  existingAttachments={existingAttachments}
  uploadFunction={(file) =>
    uploadAttachment({
      applicationId: getValues('id')!,
      attachmentType: 'MUU',
      file,
    })
  }
  onUpload={handleFileUpload}
/>

Checklist:

  • I have written new tests (if applicable)
  • I have ran the tests myself (if applicable)
  • I have made necessary changes to the documentation, link to confluence
    or other location:

Other relevant info

Please describe here if there is e.g. some requirements for this change or
other info that the tester/user needs to know.

File upload component uses HDS FileInput internally to handle user
adding files from their machine and immediately sends added files
to backend and shows a loading spinner and loading text while
upload is in process.
Copy link

sonarcloud bot commented Nov 1, 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

87.5% 87.5% Coverage
0.0% 0.0% Duplication

@markohaarni markohaarni merged commit cd802d3 into dev Nov 2, 2023
6 checks passed
@markohaarni markohaarni deleted the HAI-2065/file-upload-component-base branch November 2, 2023 12:15
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