Commit 5db0114d authored by colemanw's avatar colemanw

CRM-13823 - Display hidden_until date on status page

parent 7cf4759f
......@@ -38,9 +38,18 @@
margin: 1em 0;
}
#crm-status-list .hidden-until {
font-weight: normal;
font-size: .8em;
margin-right: 1em;
}
#tab-status-visible-1 .hush-menu > div {
width: 20em; /* determines max-width of popup menu */
}
#crm-status-list .hush-menu > div {
position: relative;
width: 20em; /* determines max-width of popup menu */
font-size: .8em;
}
......
......@@ -12,7 +12,7 @@
resolve: {
statusData: function(crmApi) {
return crmApi('System', 'check', {sequential: 1, options: {limit: 0}});
return crmApi('System', 'check', {sequential: 1});
}
}
});
......
......@@ -17,6 +17,9 @@
<i ng-if="status.icon" class="crm-i {{status.icon}}"></i>
{{status.title}}
<div statuspage-popup-menu class="hush-menu css_right"></div>
<div ng-if="!status.is_visible" class="hidden-until css_right">
({{status.hidden_until ? ts('Hidden until %1', {1: status.hidden_until}) : ts('Hidden permanently')}})
</div>
</h3>
<div class="crm-block crm-status-message-body">
<span ng-bind-html="status.message | trusted"></span>
......
......@@ -3,24 +3,36 @@
angular.module('statuspage').controller('statuspageStatusPage',
function($scope, crmApi, crmStatus, statusData, statuspageSeverityList) {
var ts = $scope.ts = CRM.ts();
$scope.alert = CRM.alert;
$scope.statuses = statusData.values;
_.each($scope.statuses, function(status) {
function preprocessStatuses(apiData) {
_.each(apiData.values, function(status) {
status.severity_id = status.severity;
status.severity = statuspageSeverityList[status.severity];
if (status.hidden_until) {
var date = $.datepicker.parseDate('yy-mm-dd', status.hidden_until);
status.hidden_until = $.datepicker.formatDate(CRM.config.dateInputFormat, date);
}
});
$scope.statuses = apiData.values;
}
preprocessStatuses(statusData);
$scope.ts = CRM.ts();
$scope.alert = CRM.alert;
// updates a status preference
// updates a status preference and refreshes status data
$scope.setPref = function(status, until, visible) {
crmApi('StatusPreference', 'create', {
// Use an array because it's important that one api call executes before the other
var apiCalls = [
['StatusPreference', 'create', {
"name": status.name,
"ignore_severity": visible ? 0 : status.severity,
"hush_until": until
}, true)
.then(function() {
status.is_visible = visible;
}],
['System', 'check', {sequential: 1}]
];
crmApi(apiCalls, true)
.then(function(result) {
preprocessStatuses(result[1]);
});
};
......
......@@ -19,7 +19,7 @@
if (_.isObject(entity)) {
// eval content is locally generated.
/*jshint -W061 */
p = backend(eval('('+angular.toJson(entity)+')'), message);
p = backend(eval('('+angular.toJson(entity)+')'), action);
} else {
// eval content is locally generated.
/*jshint -W061 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment