Skip to content

Commit c63dda7

Browse files
committed
Bug 1388041, Bug 1411266 - Fix editing existing commands
The first edit made when editing an existing command is ignored. The `argsChanged` value is not properly reset on the first `input.args` watch callback, so changes are not saved unless there is a second edit. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1388041 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1411266
1 parent 1bea253 commit c63dda7

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

app/scripts/directives/editCommand.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ angular.module('openshiftConsole')
3535
}, true);
3636

3737
scope.$watch('input.args', function(newValue, oldValue) {
38-
if (newValue === oldValue) {
39-
return;
40-
}
4138
if (argsChanged) {
4239
argsChanged = false;
4340
return;
4441
}
45-
inputChanged = true;
4642

43+
if (newValue === oldValue) {
44+
return;
45+
}
46+
47+
inputChanged = true;
4748
scope.args = _.map(scope.input.args, function(arg) {
4849
return arg.value;
4950
});

dist/scripts/scripts.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -12513,12 +12513,9 @@ multiline:e(a)
1251312513
};
1251412514
}), c = !0));
1251512515
}, !0), b.$watch("input.args", function(a, e) {
12516-
if (a !== e) {
12517-
if (c) return void (c = !1);
12518-
d = !0, b.args = _.map(b.input.args, function(a) {
12516+
return c ? void (c = !1) :void (a !== e && (d = !0, b.args = _.map(b.input.args, function(a) {
1251912517
return a.value;
12520-
}), b.form.command.$setDirty();
12521-
}
12518+
}), b.form.command.$setDirty()));
1252212519
}, !0), b.addArg = function() {
1252312520
b.nextArg && (b.input.args = b.input.args || [], b.input.args.push({
1252412521
value:b.nextArg,

0 commit comments

Comments
 (0)