Commit | Line | Data |
---|---|---|
4d8e3559 NM |
1 | (function(angular, $, _) { |
2 | ||
4d8e3559 | 3 | angular.module('statuspage').controller('statuspageStatusPage', |
f1e868f3 | 4 | function($scope, crmApi, crmStatus, statusData, statuspageSeverityList) { |
4d8e3559 | 5 | |
f1e868f3 CW |
6 | var ts = $scope.ts = CRM.ts(); |
7 | $scope.alert = CRM.alert; | |
8 | $scope.statuses = statusData.values; | |
9 | ||
10 | _.each($scope.statuses, function(status) { | |
11 | status.severity_id = status.severity; | |
12 | status.severity = statuspageSeverityList[status.severity]; | |
f1e868f3 | 13 | }); |
4d8e3559 | 14 | |
c426a987 CW |
15 | // updates a status preference |
16 | $scope.setPref = function(status, until, visible) { | |
4d8e3559 | 17 | crmApi('StatusPreference', 'create', { |
28bd6c8d | 18 | "name": status.name, |
c426a987 CW |
19 | "ignore_severity": visible ? 0 : status.severity, |
20 | "hush_until": until | |
28bd6c8d CW |
21 | }, true) |
22 | .then(function() { | |
c426a987 | 23 | status.is_visible = visible; |
28bd6c8d CW |
24 | }); |
25 | }; | |
826f5ace CW |
26 | |
27 | $scope.countVisible = function(is_visible) { | |
28 | return _.where($scope.statuses, {is_visible: is_visible}).length; | |
29 | }; | |
4d8e3559 | 30 | }); |
4d8e3559 NM |
31 | |
32 | })(angular, CRM.$, CRM._); |