Skip to content

Commit

Permalink
Add clear button, location and test type. (#39)
Browse files Browse the repository at this point in the history
Make it easier to search from the current result by adding a
couple of buttons.
  • Loading branch information
soulgalore authored Jun 27, 2024
1 parent 7629505 commit 838fd0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions server/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"search.button.search": "Search",
"search.button.next": "Next",
"search.button.previous": "Previous",
"search.button.clear": "Clear",
"search.input.placeholder": "'Write the URL and use commands like date:2022-10-22",

"search.help.heading": "Search commands",
Expand Down
16 changes: 13 additions & 3 deletions server/views/search.pug
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ block content
search.value += ' ' + text;
}
}

}
function clearSearch() {
var search = document.getElementById('search');
if (search) {
search.value = '';
}
}
section.section
.container
Expand All @@ -40,6 +45,7 @@ block content
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')}
button.button.is-warning.is-medium(accesskey='h' onclick='toggleSearchHelp()') #{getText('search.button.help')}
button.button.is-warning.is-medium(accesskey='h' onclick='clearSearch()') #{getText('search.button.clear')}

.content.p-5.has-background-white(style='display:none' id='searchHelp')
h2.mb-3 #{getText('search.help.heading')}
Expand Down Expand Up @@ -129,8 +135,12 @@ block content
- let labelOnClick = `addToSearch('label:${test.label}')`;
a(role='button' onclick=labelOnClick) #{test.label}
td #{test.run_date ? dayjs(test.run_date).format(nconf.get('dateformat')): ''}
td #{test.location}
td.is-capitalized #{test.test_type}
td
- let locationOnClick = 'addToSearch(\'location:' + test.location + '\')';
a(role='button' onclick=locationOnClick) #{test.location}
td.is-capitalized
- let testOnClick = 'addToSearch(\'testType:' + test.test_type + '\')';
a(role='button' onclick=testOnClick) #{test.test_type}
td #{test.status}
td
- let browserOnClick = 'addToSearch(\'browser:' + test.browser_name + '\')';
Expand Down

0 comments on commit 838fd0e

Please sign in to comment.