Skip to content

Commit

Permalink
BZ_1324273: Make BC edit form dirty when deleting Key-Value pair
Browse files Browse the repository at this point in the history
  • Loading branch information
jhadvig committed Apr 7, 2016
1 parent e74de69 commit 4745a8f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions assets/app/scripts/directives/oscKeyValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ angular.module("openshiftConsole")
if ($scope.entries[key]) {
delete $scope.entries[key];
delete added[key];
$scope.form.$setDirty();
}
};
$scope.setErrorText = function(keyTitle) {
Expand Down
5 changes: 5 additions & 0 deletions assets/test/spec/directives/oscKeyValuesSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ describe("KeyValuesController", function(){
scope = {
entries: { "foo": "bar"},
form: {
$dirty: false,
$setPristine: function(){},
$setUntouched: function(){},
$setValidity: function(){},
$setDirty: function() {
scope.form.$dirty = true;
}
},
readonlyKeys: ""
};
Expand Down Expand Up @@ -117,6 +121,7 @@ describe("KeyValuesController", function(){
it("should delete the key/value from the scope", function(){
scope.deleteEntry("foo");
expect(scope.entries["foo"]).toBe(undefined);
expect(scope.form.$dirty).toBe(true);
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion pkg/assets/bindata.go
Original file line number Diff line number Diff line change
Expand Up @@ -5647,7 +5647,7 @@ if (-1 !== c.indexOf(a.key)) return;
b[a.key] = "", a.entries[a.key] = a.value, a.key = null, a.value = null, a.form.$setPristine(), a.form.$setUntouched();
}
}, a.deleteEntry = function(c) {
a.entries[c] && (delete a.entries[c], delete b[c]);
a.entries[c] && (delete a.entries[c], delete b[c], a.form.$setDirty());
}, a.setErrorText = function(a) {
return "path" === a ? "absolute path" :"label" === a ? "label" :"key";
};
Expand Down

0 comments on commit 4745a8f

Please sign in to comment.