flowfuse icon indicating copy to clipboard operation
flowfuse copied to clipboard

Snapshot import export component options

Open Steve-Mcl opened this issue 1 year ago • 2 comments

closes #4605

Description

  • Deletes duplicate (unused) vue components
    • frontend/src/pages/application/components/ExportProjectComponents.vue
    • frontend/src/pages/application/components/ImportProjectComponents.vue
    • Removes eslint exceptions
  • Updates snapshot controller to support component options
  • Update snapshot import/export API to support component options
  • Updates frontend API to support component options
  • Updates UI for snapshot import/export component options
    • Repurposes ExportInstanceComponents as ExportImportComponents
    • adds adds instance of repurposed ExportImportComponents to:
      • frontend/src/components/dialogs/SnapshotImportDialog.vue
      • frontend/src/pages/application/Snapshots/components/dialogs/SnapshotExportDialog.vue
  • add unit tests for import/export snapshot component options

Potential clean up: move SnapshotExportDialog.vue to be more reusable, sitting along side frontend/src/components/dialogs/SnapshotImportDialog.vue

Unit Tests added

  Snapshot controller
    exportSnapshot
      ✔ should export a full snapshot by default
      ✔ should export a snapshot without creds
      ✔ should export a snapshot without flows
      ✔ should export a snapshot without env (envVars: false)
      ✔ should export a snapshot without env values (envVars: "keys")
    uploadSnapshot
      ✔ should upload a snapshot
      ✔ should upload a snapshot without creds
      ✔ should upload a snapshot without flows
      ✔ should upload a snapshot without env (envVars: false)
      ✔ should upload a snapshot without env values (envVars: "keys")

TODO:

  • [ ] Check / update docs where appropriate

Related Issue(s)

#4605

Checklist

  • [x] I have read the contribution guidelines
  • [x] 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 avatar Oct 03 '24 16:10 Steve-Mcl

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.34%. Comparing base (fd3a97d) to head (7a7fe65). Report is 39 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4610      +/-   ##
==========================================
+ Coverage   78.28%   78.34%   +0.06%     
==========================================
  Files         303      302       -1     
  Lines       14367    14390      +23     
  Branches     3267     3283      +16     
==========================================
+ Hits        11247    11274      +27     
+ Misses       3120     3116       -4     
Flag Coverage Δ
backend 78.34% <100.00%> (+0.06%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 03 '24 16:10 codecov[bot]

@joepavitt added as reviewer for frontend.

This was rejigged slightly from the mock up screens agreed in the issue - in that the credential secret is now BELOW the new component options.

The reason being: When toggling the component option "credentials", the component options group were jumping up and down the dialog due to toggling the visibility of the credential secret field - making it somewhat janky.

Steve-Mcl avatar Oct 03 '24 16:10 Steve-Mcl

although front-end E2E's should be added,

Yeah, absolutely makes sense & agree. Will add E2E tests.

Steve-Mcl avatar Oct 04 '24 13:10 Steve-Mcl

@joepavitt e2e tests added

image

That was not easy - but definitely worth the effort as it turned up a couple of edge cases (like re-selecting same snapshot to upload would not work)

NOTE: There were a number of challenges in implementing the e2e tests for multiple downloads/uploads tests! One particular puzzling doozy was with uploading fixtures that several other users of cypress have faced over the years (and a hand full of "me too" issues on cypress issue tracker - none of which worked here!). Essentially, selectFile call (for setting a fixture into a file input ready for upload) would not work in 2nd, 3rd, nth subsequent tests unless a different fixture file was used (that's why there are now upload1.json, upload2.json, ... files added in the fixtures dir - that took far to long to figure out and fix - bah!)

fingers crossed they pas on GH too 🤞

Steve-Mcl avatar Oct 07 '24 11:10 Steve-Mcl

@joepavitt FYI

Steve-Mcl avatar Oct 14 '24 12:10 Steve-Mcl