Skip to content

Commit

Permalink
[#2891] Add the 'snooze alerts status' of a universe to the health ch…
Browse files Browse the repository at this point in the history
…eck panel

Summary: https://phabricator.dev.yugabyte.com/D7816 has the API changes. This diff adds a way to show a message in the UI if alerts are disabled.

Test Plan: Set alerts to enabled, disabled permanently and disabled until 1 hour. Verify that the message shows as expected

Reviewers: ram, arnav, andrew

Reviewed By: andrew

Subscribers: yugaware

Differential Revision: https://phabricator.dev.yugabyte.com/D7838
  • Loading branch information
iSignal committed Jan 27, 2020
1 parent 0f0aa07 commit d1f4e22
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ class HealthInfoPanel extends PureComponent {
if (getPromiseState(healthCheck).isSuccess()) {
const healthCheckData = JSON.parse([...healthCheck.data].reverse()[0]);
const lastUpdateDate = moment(healthCheckData.timestamp);
let disabledUntilStr = '';
if ('disableAlertsUntilSecs' in universeInfo.universeConfig) {
const disabledUntilSecs = Number(universeInfo.universeConfig.disableAlertsUntilSecs);
const now = Date.now() / 1000;
if (!Number.isSafeInteger(disabledUntilSecs)) {
disabledUntilStr = " Alerts are snoozed";
} else if (disabledUntilSecs > now) {
disabledUntilStr = " Alerts are snoozed until " + moment.unix(disabledUntilSecs).format("MMM DD hh:mm a");
}
}
const totalNodesCounter = healthCheckData.data.length;
let errorNodesCounter = 0;

Expand Down Expand Up @@ -218,6 +228,10 @@ class HealthInfoPanel extends PureComponent {
value={lastUpdateDate} /></span></span>
: null
},
{name: "", data: disabledUntilStr
? <span className="text-light"><i className={"fa fa-exclamation-triangle"}>{disabledUntilStr}</i></span>
: null
},
];

return (<YBWidget
Expand Down

0 comments on commit d1f4e22

Please sign in to comment.