set default for "Newer than" option

This commit is contained in:
Alexander Zobnin
2017-12-14 12:54:30 +03:00
parent 11ad51d5dc
commit f728d50a9f
5 changed files with 21 additions and 11 deletions

View File

@@ -458,9 +458,14 @@ export class TriggerPanelCtrl extends PanelCtrl {
}
isNewTrigger(trigger) {
const highlightIntervalMs = utils.parseInterval(this.panel.highlightNewerThan);
const durationSec = (Date.now() - trigger.lastchangeUnix * 1000);
return durationSec < highlightIntervalMs;
try {
const highlightNewerThanDefault = '1h';
const highlightIntervalMs = utils.parseInterval(this.panel.highlightNewerThan || highlightNewerThanDefault);
const durationSec = (Date.now() - trigger.lastchangeUnix * 1000);
return durationSec < highlightIntervalMs;
} catch (e) {
return false;
}
}
link(scope, elem, attrs, ctrl) {