diff --git a/server/locales/en.json b/server/locales/en.json index ac834e3..998cd14 100644 --- a/server/locales/en.json +++ b/server/locales/en.json @@ -38,6 +38,7 @@ "index.waitingtorunnext": "Waiting to run next.", "index.inqueue": "There are %s jobs in the queue and your job is place %s in the queue", + "search.button.lasthour": "Last hour", "search.button.today": "Today", "search.button.yesterday": "Yesterday", "search.button.lastweek": "Last week", diff --git a/server/src/database/search.js b/server/src/database/search.js index a51c92f..796ed12 100644 --- a/server/src/database/search.js +++ b/server/src/database/search.js @@ -106,6 +106,11 @@ function generateMatch(parameters) { if (parameters.when) { switch (parameters.when) { + case 'lasthour': { + where.push('run_date >= $' + (parameters_.length + 1)); + parameters_.push(dayjs().subtract(1, 'hour').toISOString()); + break; + } case 'today': { where.push('DATE(run_date) = $' + (parameters_.length + 1)); parameters_.push(dayjs().format('YYYY-MM-DD')); diff --git a/server/views/search.pug b/server/views/search.pug index 4d98f8f..e74b6a3 100644 --- a/server/views/search.pug +++ b/server/views/search.pug @@ -41,6 +41,7 @@ block content button.button.is-primary.is-large(accesskey='s' name='searchbutton') #{getText('search.button.search')} p.control .buttons.py-2 + button.button.is-primary.is-medium(onclick='addToSearch(\'when:lasthour\')' role='button') #{getText('search.button.lasthour')} button.button.is-primary.is-medium(onclick='addToSearch(\'when:today\')' role='button') #{getText('search.button.today')} button.button.is-primary.is-medium(onclick='addToSearch(\'when:yesterday\')' role='button') #{getText('search.button.yesterday')} button.button.is-primary.is-medium(onclick='addToSearch(\'when:lastweek\')' role='button') #{getText('search.button.lastweek')}