-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add headers to search results #5358
Conversation
I know that the headers don't look very nice yet, but at least the information is there, and the data structure returned makes it easier now to deal with different kinds of results, so I would leave it to other pull requests to make it look nicer. I just wanted this for a long time and now did it :) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5358 +/- ##
=======================================
Coverage 98.32% 98.32%
=======================================
Files 389 389
Lines 37320 37326 +6
=======================================
+ Hits 36694 36700 +6
Misses 626 626
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that the headers don't look very nice yet, but at least the information is there, and the data structure returned makes it easier now to deal with different kinds of results, so I would leave it to other pull requests to make it look nicer. I just wanted this for a long time and now did it :)
Awesome. Simple but effective.
I agree styling doesn't need to be added here, and I like that you're going for the smallest step here. Not to mention this will also make it easier to add more types when we don't need to solve the whole filtering UX thing in one go.
7c9d30f
to
6e442a7
Compare
assets/javascripts/openqa.js
Outdated
item.appendChild(contents); | ||
const types = ['code', 'modules', 'templates']; | ||
|
||
for (var i = 0; i < types.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this var
should be a let
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it into an iterator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find loops cleaner looking personally. Arrow functions are now also preferable to use whenever possible, instead of the keyword function
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the variable into an object and didn't know how to do it in a for loop :)
6e442a7
to
ca66c47
Compare
The headers are now |
Now one can easily jump to the results by type and see the individual number of results Slightly related issue: https://progress.opensuse.org/issues/137243
ca66c47
to
52a9b3a
Compare
item.appendChild(contents); | ||
const types = {code: 'Test modules', modules: 'Job modules', templates: 'Job Templates'}; | ||
|
||
Object.keys(types).forEach(function (searchtype) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (const searchtype of Object.keys(types)) {
or
for (const [searchtype, searchvalue] of Object.entries(types)) {
Please create followup-PRs for any improvements. I don't have a ticket for that and just wanted it solved. The kind of for loop is just a matter of taste. |
Now one can easily jump to the results by type and see the individual number of results
Slightly related issue: https://progress.opensuse.org/issues/137243
Screenshot: