-
Notifications
You must be signed in to change notification settings - Fork 231
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
Better conflict handling for env var edits #1171
Conversation
previousEnvConflict = true; | ||
$scope.alerts["background_update"] = { | ||
type: "warning", | ||
message: "This deployment configuration has been updated in the background. Saving your changes may create a conflict or cause loss of data.", |
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.
now that we know the env vars are what caused the conflict, i'm thinking we should update the message to be more specific
d642174
to
4f855f6
Compare
}, | ||
|
||
// Copy and normalize the environment for editing using the key value editor. | ||
copy: function(object) { |
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.
hmm, i wouldn't expect a function called copy to also be doing normalization
|
||
var i, leftEnv, rightEnv; | ||
for (i = 0; i < leftContainers.length; i++) { | ||
leftEnv = leftContainers[i].env || []; |
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.
i feel like we should be validating that the container names are actually the same, what if i took out a container, added a brand new container, the length of containers array is the same but they are no longer equal. Especially since merge edits below assumes containers in the same positions are in fact the same.
9a3a06e
to
f74740c
Compare
@jwforres Updated. I'd like to do some more testing, but the code should be ready for another review. |
Still need to sort out #676, which I suspect is a race between the PUT callback and watch callback. |
return false; | ||
} | ||
|
||
// Check if any of the variable names are values are different. |
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.
typo in the comment 'variable names or values'
just one nit, otherwise LGTM |
f74740c
to
43f2608
Compare
43f2608
to
ac3b56f
Compare
// Wait for a pending save to complete to avoid a race between the PUT and the watch callbacks. | ||
if (saveEnvPromise) { | ||
saveEnvPromise.finally(function() { | ||
updateEnvironment(deployment, previous); |
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.
@jwforres It looks like calling updateEnvironment
from saveEnvPromise.finally
is enough.
- If the PUT succeeds, the success callback in
saveEnvVars
will set the form to pristine beforeupdateEnvironment
is called. When the form is pristine,updateEnvironment
will simply copy the new values. - If the PUT fails, the normal conflict checking is performed by
updateEnvironment
.
Update LGTM |
Thanks @jwforres. Tested various scenarios with all of the types (deployment configs, deployments, replication controllers, and replica sets). Also checked the read-only view of the stateful set environment. [merge] |
[merge] |
Evaluated for origin web console merge up to ac3b56f |
Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_web_console/974/) (Base Commit: e3d3db7) |
Fixes #621
Fixes #676
@jwforres @rhamilto FYI
Resources updated: