Skip to content

Commit

Permalink
Updates admin modal error and warning styles (#5925)
Browse files Browse the repository at this point in the history
Updates styles so all modal error have alert-danger style.
Adds optional error severity to enable warning styles.
Updates too-many-docs configuration warning message.

#5362
  • Loading branch information
dianabarsan authored and kennsippell committed Sep 16, 2019
1 parent c272d5c commit b8993f3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions admin/src/js/controllers/edit-user.js
Expand Up @@ -304,7 +304,8 @@ angular
if (resp.data.warn) {
return $q.reject({
key: 'configuration.user.replication.limit.exceeded',
params: { total_docs: resp.data.total_docs, limit: resp.data.limit }
params: { total_docs: resp.data.total_docs, limit: resp.data.limit },
severity: 'warning'
});
}

Expand Down Expand Up @@ -398,7 +399,7 @@ angular
})
.catch(function(err) {
if (err.key) {
$translate(err.key, err.params).then(value => $scope.setError(err, value));
$translate(err.key, err.params).then(value => $scope.setError(err, value, err.severity));
} else {
$scope.setError(err, 'Error validating user');
}
Expand Down
2 changes: 1 addition & 1 deletion admin/src/templates/modal.html
Expand Up @@ -5,7 +5,7 @@ <h2 translate>{{titleKey}}</h2>
</div>
<div class="modal-body" ng-transclude></div>
<div class="modal-footer">
<p class="note" ng-if="status.error" translate>{{status.error}}</p>
<p class="alert text-left" ng-class="status.severity === 'warning' ? 'alert-warning' : 'alert-danger'" ng-if="status.error" translate>{{status.error}}</p>
<a class="btn cancel" ng-class="{ 'disabled': status.processing }" ng-click="onCancel()" translate>{{cancelKey || 'Cancel'}}</a>
<a class="btn btn-danger pull-left" ng-show="showDelete" ng-click="onDelete()"><i class="fa fa-trash-o"></i>&nbsp;<span translate>{{deleteKey || 'Delete'}}</span></a>
<a class="btn submit" ng-class="{ 'btn-primary': !danger, 'btn-danger': danger, 'disabled': disableSubmit }" mm-enter="onSubmit()" ng-click="onSubmit()" ng-show="!status.processing" translate>{{submitKey}}</a>
Expand Down
Expand Up @@ -1231,4 +1231,4 @@ years = years
yes = Yes
yesterday = yesterday
error.file.size = File must be no larger than {{size}}
configuration.user.replication.limit.exceeded = This user would replicate {{total_docs}} docs, which exceeds the recommended limit. Do you wish to proceed?
configuration.user.replication.limit.exceeded = Warning! This user would replicate {{total_docs}} docs, which exceeds the recommended limit. Edit the Role or Place to make changes as needed, then press Submit to proceed. If there are too many docs for a user consider adjusting the doc purge rules.
2 changes: 1 addition & 1 deletion webapp/src/js/bootstrapper/index.js
Expand Up @@ -76,7 +76,7 @@

$('.bootstrap-layer .loader, .bootstrap-layer .status').hide();
$('.bootstrap-layer .error').show();
$('.bootstrap-layer .error').html('<div><p>' + errorMessage + '</p><a id="btn-continue" class="btn btn-primary pull-left" href="#">' + continueBtn + '</a><a id="btn-abort" class="btn btn-danger pull-right" href="#">' + abort + '</a></div>');
$('.bootstrap-layer .error').html('<div><p class="alert alert-warning">' + errorMessage + '</p><a id="btn-continue" class="btn btn-primary pull-left" href="#">' + continueBtn + '</a><a id="btn-abort" class="btn btn-danger pull-right" href="#">' + abort + '</a></div>');
$('#btn-continue').click(() => resolve());
$('#btn-abort').click(() => {
document.cookie = 'login=force;path=/';
Expand Down
5 changes: 4 additions & 1 deletion webapp/src/js/services/modal.js
Expand Up @@ -42,15 +42,18 @@ angular.module('inboxServices').factory('Modal',
scope.setProcessing = function() {
scope.status.processing = true;
scope.status.error = false;
scope.status.severity = false;
};
scope.setFinished = function() {
scope.status.processing = false;
scope.status.error = false;
scope.status.severity = false;
};
scope.setError = function(err, message) {
scope.setError = function(err, message, severity) {
$log.error('Error submitting modal', err);
scope.status.processing = false;
scope.status.error = message;
scope.status.severity = severity;
};
return scope;
};
Expand Down

0 comments on commit b8993f3

Please sign in to comment.