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

Frontend for Uploading a Snapshot #3869

Merged
merged 10 commits into from
May 16, 2024
Merged

Conversation

Steve-Mcl
Copy link
Contributor

@Steve-Mcl Steve-Mcl commented May 16, 2024

Task 2 of 3 (part of #3628)

Description

Adds UI parts for Uploading a Snapshot

Details

  • The "Upload Snapshot" buttons are added to the instance and device pages (not the application page: reason provided on the issue)
    • The buttons placed adjacent to the "Create Snapshot" buttons on both the table search row AND the empty state actions slot
    • The buttons are only visible to users with the snapshots:import role
    • Fixes the gap between the buttons in the empty state actions slot (in line with the SCSS gap setting for the table search actions slot)
  • Adds shared component frontend/src/components/dialogs/SnapshotImportDialog.vue
    • this is reused on both the instance and device pages
  • Adds a utility function isSnapshot in forge/routes/api/snapshot.js
    • this is used to do basic validation the snapshot before attempting to import it (browser does not have native support for JSON schema validation, so this is a simple check to ensure the snapshot has the required properties and are of the correct type)
  • Adds audit log entry for the import action
    • corrects icon for snapshot log entries
  • Adds E2E tests for the new endpoint for both instances and devices

NOTE

E2E tests added

  FlowForge - Devices - With Billing
    upload snapshot with credentials
    upload snapshot without credentials
  FlowForge - Instance Snapshots
    upload snapshot with credentials
    upload snapshot without credentials
  FlowForge shows audit logs
    for when a snapshot is imported

Related Issue(s)

Closes #3866
Story: #3628

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Includes a DB migration? -> add the area:migration label

Steve-Mcl added 5 commits May 16, 2024 10:23
includes missing UI parts for application.device.snapshot.exported
adds gap setting to CSS - this is in keep with actions slot on table search bar
includes improvements to brittle tests that could only be ran once and only in sequence.
@Steve-Mcl Steve-Mcl linked an issue May 16, 2024 that may be closed by this pull request
@Steve-Mcl Steve-Mcl requested a review from joepavitt May 16, 2024 09:37
@Steve-Mcl
Copy link
Contributor Author

@joepavitt Please review but do not merge until part 1 (Backend API #3868 is merged)

Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.26%. Comparing base (41da1c0) to head (0415dce).
Report is 1 commits behind head on main.

❗ Current head 0415dce differs from pull request most recent head e83aa02. Consider uploading reports for the commit e83aa02 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3869   +/-   ##
=======================================
  Coverage   79.26%   79.26%           
=======================================
  Files         281      281           
  Lines       12720    12720           
  Branches     2837     2837           
=======================================
  Hits        10082    10082           
  Misses       2638     2638           
Flag Coverage Δ
backend 79.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joepavitt
Copy link
Contributor

I think the order of the buttons should be this way arund:

Screenshot 2024-05-16 at 14 10 36

The primary option being on the right is a better standard to go by, the "Upload Snapshot" will be less-used

@Steve-Mcl
Copy link
Contributor Author

Steve-Mcl commented May 16, 2024

I think the order of the buttons should be this way arund:

Screenshot 2024-05-16 at 14 10 36

Resolved in swap upload and create buttons on both empty-state and search toolbar 2e296a6

DEMO
chrome_acRcdKJmoY

Base automatically changed from 3865-upload-snapshot-backend to main May 16, 2024 15:21
@Steve-Mcl
Copy link
Contributor Author

@joepavitt backend part is now merged (I have updated this PR too) so you can merge upon approval. Ta.

Copy link
Contributor

@joepavitt joepavitt left a comment

Choose a reason for hiding this comment

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

Approved subject to final tests passing, which they have done previously

@Steve-Mcl Steve-Mcl merged commit c63326a into main May 16, 2024
12 checks passed
@Steve-Mcl Steve-Mcl deleted the 3866-upload-snapshot-frontend branch May 16, 2024 15:31
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.

Add front end API and UI for Upload snapshot
2 participants