Commit 5db0114d authored by colemanw's avatar colemanw

CRM-13823 - Display hidden_until date on status page

parent 7cf4759f
...@@ -38,9 +38,18 @@ ...@@ -38,9 +38,18 @@
margin: 1em 0; 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 { #crm-status-list .hush-menu > div {
position: relative; position: relative;
width: 20em; /* determines max-width of popup menu */
font-size: .8em; font-size: .8em;
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
resolve: { resolve: {
statusData: function(crmApi) { statusData: function(crmApi) {
return crmApi('System', 'check', {sequential: 1, options: {limit: 0}}); return crmApi('System', 'check', {sequential: 1});
} }
} }
}); });
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
<i ng-if="status.icon" class="crm-i {{status.icon}}"></i> <i ng-if="status.icon" class="crm-i {{status.icon}}"></i>
{{status.title}} {{status.title}}
<div statuspage-popup-menu class="hush-menu css_right"></div> <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> </h3>
<div class="crm-block crm-status-message-body"> <div class="crm-block crm-status-message-body">
<span ng-bind-html="status.message | trusted"></span> <span ng-bind-html="status.message | trusted"></span>
......
...@@ -3,24 +3,36 @@ ...@@ -3,24 +3,36 @@
angular.module('statuspage').controller('statuspageStatusPage', angular.module('statuspage').controller('statuspageStatusPage',
function($scope, crmApi, crmStatus, statusData, statuspageSeverityList) { function($scope, crmApi, crmStatus, statusData, statuspageSeverityList) {
var ts = $scope.ts = CRM.ts(); function preprocessStatuses(apiData) {
$scope.alert = CRM.alert; _.each(apiData.values, function(status) {
$scope.statuses = statusData.values; 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);
_.each($scope.statuses, function(status) { $scope.ts = CRM.ts();
status.severity_id = status.severity; $scope.alert = CRM.alert;
status.severity = statuspageSeverityList[status.severity];
});
// updates a status preference // updates a status preference and refreshes status data
$scope.setPref = function(status, until, visible) { $scope.setPref = function(status, until, visible) {
crmApi('StatusPreference', 'create', { // Use an array because it's important that one api call executes before the other
"name": status.name, var apiCalls = [
"ignore_severity": visible ? 0 : status.severity, ['StatusPreference', 'create', {
"hush_until": until "name": status.name,
}, true) "ignore_severity": visible ? 0 : status.severity,
.then(function() { "hush_until": until
status.is_visible = visible; }],
['System', 'check', {sequential: 1}]
];
crmApi(apiCalls, true)
.then(function(result) {
preprocessStatuses(result[1]);
}); });
}; };
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
if (_.isObject(entity)) { if (_.isObject(entity)) {
// eval content is locally generated. // eval content is locally generated.
/*jshint -W061 */ /*jshint -W061 */
p = backend(eval('('+angular.toJson(entity)+')'), message); p = backend(eval('('+angular.toJson(entity)+')'), action);
} else { } else {
// eval content is locally generated. // eval content is locally generated.
/*jshint -W061 */ /*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