Skip to content

Commit

Permalink
bug 1411965: Fix a few issues with the scheduled-changes-in-rules UI. (
Browse files Browse the repository at this point in the history
…#441). r=jlorenzo
  • Loading branch information
bhearsum committed Oct 26, 2017
1 parent 967808a commit 0b0e7e5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
24 changes: 13 additions & 11 deletions ui/app/js/controllers/rule_scheduled_change_new_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,19 @@ function($scope, $http, $modalInstance, CSRF, Releases, Rules, scheduled_changes
asap.setMinutes(asap.getMinutes() + 5);
$scope.sc.when = ($scope.auto_time) ? asap : $scope.sc.when;

// Evaluate the values entered for priority and background rate.
$scope.integer_validation_errors = Helpers.integerValidator({'priority': $scope.sc.priority, 'backgroundRate': $scope.sc.backgroundRate});
// Stop sending the request if any number validation errors.
if($scope.integer_validation_errors.priority || $scope.integer_validation_errors.backgroundRate) {
$scope.saving = false;
sweetAlert(
"Form submission error",
"See fields highlighted in red.",
"error"
);
return;
if ($scope.sc.change_type !== "delete") {
// Evaluate the values entered for priority and background rate.
$scope.integer_validation_errors = Helpers.integerValidator({'priority': $scope.sc.priority, 'backgroundRate': $scope.sc.backgroundRate});
// Stop sending the request if any number validation errors.
if($scope.integer_validation_errors.priority || $scope.integer_validation_errors.backgroundRate) {
$scope.saving = false;
sweetAlert(
"Form submission error",
"See fields highlighted in red.",
"error"
);
return;
}
}

CSRF.getToken()
Expand Down
17 changes: 10 additions & 7 deletions ui/app/js/controllers/rules_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ function($scope, $routeParams, $location, $timeout, Rules, Search, $modal, $rout
sc: function() {
// blank new default rule
return {
base_row: undefined,
product: product,
channel: channel,
backgroundRate: 0,
Expand All @@ -305,7 +304,7 @@ function($scope, $routeParams, $location, $timeout, Rules, Search, $modal, $rout
};
},
original_row: function() {
return {};
return null;
},
signoffRequirements: function() {
return $scope.signoffRequirements;
Expand Down Expand Up @@ -359,12 +358,14 @@ function($scope, $routeParams, $location, $timeout, Rules, Search, $modal, $rout
},
sc: function() {
return {
"base_row": rule,
"rule_id": rule.rule_id,
"data_version": rule.data_version,
"change_type": "delete"
};
},
original_row: function() {
return rule;
},
signoffRequirements: function() {
return $scope.signoffRequirements;
},
Expand All @@ -387,14 +388,16 @@ function($scope, $routeParams, $location, $timeout, Rules, Search, $modal, $rout
return sc;
},
original_row: function() {
return rule;
if (rule.scheduled_change.change_type === "insert") {
return null;
}
else {
return rule;
}
},
signoffRequirements: function() {
return $scope.signoffRequirements;
},
rule: function() {
return rule;
},
}
});
modalInstance.result.then(function(action) {
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.44
2.43.2

0 comments on commit 0b0e7e5

Please sign in to comment.