Make sure to escape error messages and add clarification to the trigger activation dialog
This commit is contained in:
parent
4feb2a2032
commit
628d80895d
3 changed files with 12 additions and 1 deletions
|
@ -111,6 +111,9 @@ angular.module('quay').directive('setupTriggerDialog', function () {
|
||||||
var errorHandler = ApiService.errorDisplay('Cannot activate build trigger', function(resp) {
|
var errorHandler = ApiService.errorDisplay('Cannot activate build trigger', function(resp) {
|
||||||
$scope.hide();
|
$scope.hide();
|
||||||
$scope.canceled({'trigger': $scope.trigger});
|
$scope.canceled({'trigger': $scope.trigger});
|
||||||
|
|
||||||
|
return ApiService.getErrorMessage(resp) +
|
||||||
|
'\n\nThis usually means that you do not have admin access on the repository.';
|
||||||
});
|
});
|
||||||
|
|
||||||
ApiService.activateBuildTrigger(data, params).then(function(resp) {
|
ApiService.activateBuildTrigger(data, params).then(function(resp) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* callbacks. Any method defined on the server is exposed here as an equivalent method. Also
|
* callbacks. Any method defined on the server is exposed here as an equivalent method. Also
|
||||||
* defines some helper functions for working with API responses.
|
* defines some helper functions for working with API responses.
|
||||||
*/
|
*/
|
||||||
angular.module('quay').factory('ApiService', ['Restangular', '$q', function(Restangular, $q) {
|
angular.module('quay').factory('ApiService', ['Restangular', '$q', 'UtilService', function(Restangular, $q, UtilService) {
|
||||||
var apiService = {};
|
var apiService = {};
|
||||||
|
|
||||||
var getResource = function(path, opt_background) {
|
var getResource = function(path, opt_background) {
|
||||||
|
@ -313,6 +313,8 @@ angular.module('quay').factory('ApiService', ['Restangular', '$q', function(Rest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message = UtilService.stringToHTML(message);
|
||||||
|
|
||||||
bootbox.dialog({
|
bootbox.dialog({
|
||||||
"message": message,
|
"message": message,
|
||||||
"title": defaultMessage,
|
"title": defaultMessage,
|
||||||
|
|
|
@ -61,6 +61,12 @@ angular.module('quay').factory('UtilService', ['$sanitize', function($sanitize)
|
||||||
return adjusted;
|
return adjusted;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
utilService.stringToHTML = function(text) {
|
||||||
|
text = utilService.escapeHtmlString(text);
|
||||||
|
text = text.replace(/\n/g, '<br>');
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
|
||||||
utilService.getRestUrl = function(args) {
|
utilService.getRestUrl = function(args) {
|
||||||
var url = '';
|
var url = '';
|
||||||
for (var i = 0; i < arguments.length; ++i) {
|
for (var i = 0; i < arguments.length; ++i) {
|
||||||
|
|
Reference in a new issue