-
Notifications
You must be signed in to change notification settings - Fork 63
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
Edit snapshot #4282
Edit snapshot #4282
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4282 +/- ##
==========================================
+ Coverage 78.17% 78.18% +0.01%
==========================================
Files 287 292 +5
Lines 13310 13434 +124
Branches 2986 3006 +20
==========================================
+ Hits 10405 10504 +99
- Misses 2905 2930 +25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
How does this impact any snapshots deployed to a device? Is there a need to push updates at that point? I'm assuming we're just running from Snapshot ID, so no need? |
Hmmm, I was 100% certain there was no need to update the device until you mentioned this 🤔 scurries off to double check |
@joepavitt thanks for flagging this. So, the device does get This is however purely informational, and does not impact operation of the device (snapshot The question becomes, do we need to perform a device update just because of snapshot name change (we dont currently push an update for the device name change!)? If we do, then it would be advisable to consider the UX (e.g. do we check ALL devices/instances associated with the snapshot, do we issue restart device automatically?) It might be as well to toast info to the user (and update docs) to state something like: @knolleary any thoughts please? |
Agreed this should not trigger a device restart - if I'm doing housekeeping to mark a snapshot as 'good', I don't want it to redeploy and restart everything. I would not use a toast notification either. It can be a simple one-line in the dialog (so the user knows this information before they make the change) to say something like "Changes to the snapshot will not be reflected on devices already running the snapshot". |
Note to reviewers: the TODO for audit logging in lines 195-201 of this PR are handled in the incoming branch PR #4287 here |
Will do that. Thanks. |
Just hit a speed bump. Issue:In short, because I renamed an auto snapshot, its name no longer matches the prescribed format and we can no longer infer this is a system auto snapshot. We currently infer a snapshot was an auto snapshot from its name and lack of Options (from simplest to hardest)
Switching PR to draft for now until solution is determined/implemented. |
Gut feel is that if you edited, you own it... |
What other scenarios mean a snapshot has a null user property? Auto-generated snapshots is the only one I can think of - so why not use the lack of a user on the object to be the trigger to show the 'auto snapshot' label rather than parsing the name? My only pause for thought is I cannot remember if our MVP for auto-snapshots included deleting old ones - and what logic that uses to determine what is an old auto-snapshot versus a snapshot a user wants to keep. |
Stretching my memory here but 99.9% certain there should NOT be any operations other than auto snapshot that are permitted to leave
That is an option (though it does move from "infer" to "assume")
The premise was: if the name matches the specific format, there are 10 of them, delete the one with lowest What will happen here, after an auto snapshot is renamed, there will now effectively be only 9 Auto snapshots. The next auto snapshot will not cause a deletion (but rather make up the 10th) - so this is a non issue.
I am slightly leaning to this also but there is merit in what Nick said about assuming Since modifying the DB to identify snapshot source (discussed here and here) are not absolutely necessary at this point (only auto snapshots apply
|
Please go with my suggestion. The user field is who created it, not who owns it. If the field is blank, assume its an auto-snapshot - ie the system generated it. That is a safe assumption to make - unless the user who created has since been deleted. But that is an edge case for another day. |
Addressed in 937807d |
Addressed in d46a226 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FE all good. Server-side looks good too, but will wait for Nick's eyes before merging.
update docs for snapshot edit
I'm not going to be able to review this properly until much later today. |
Audit log entries for Snapshot Update
Merging once the tests go green |
closes #4281
Description
TLDR;
Introduces a common dialog and supporting endpoint for editing snapshots.
Implementation
Name
andDescription
are pre-populated with the current values from the snapshot.Finer detail
put
to the main route of the top-level snapshot APIdata
to containname
and/ordescription
only at this timeupdateSnapshot
in controllerforge/db/controllers/Snapshot.js
snapshot:edit
that is used for both FE and BE routesupdateSnapshot
tofrontend/src/api/snapshots.js
frontend/src/components/dialogs/SnapshotEditDialog.vue
Unit Tests added in
test/unit/forge/routes/api/snapshots_spec.js
e2e Test added in
test/e2e/frontend/cypress/tests/applications/snapshots.spec.js
e2e Test added in
test/e2e/frontend/cypress/tests/instances/snapshots.spec.js
e2e Test added in
test/e2e/frontend/cypress/tests-ee/devices/snapshots.spec.js
Demo
TODO
Related Issue(s)
Owner #4281
Parent #3818
Checklist
flowforge.yml
?FlowFuse/helm
to update ConfigMap TemplateFlowFuse/CloudProject
to update values for Staging/ProductionLabels
area:migration
label