Add Explore tab and query-less searching

Allows for exploration of all visible repositories, in paginated form.

This change also fixes the layout of the header on different viewport sizes to be consistently a single line in height.

Fixes https://jira.coreos.com/browse/QS-63
This commit is contained in:
Joseph Schorr 2017-11-28 16:50:23 +02:00
parent c7e439f593
commit 2ced523313
7 changed files with 39 additions and 30 deletions

View file

@ -509,6 +509,7 @@ def _get_sorted_matching_repositories(lookup_value, repo_kind='image', include_p
if search_fields is None:
search_fields = set([SEARCH_FIELDS.description.name, SEARCH_FIELDS.name.name])
if lookup_value:
# Always search at least on name (init clause)
clause = Repository.name.match(lookup_value)
computed_score = RepositorySearchScore.score.alias('score')
@ -517,10 +518,11 @@ def _get_sorted_matching_repositories(lookup_value, repo_kind='image', include_p
# to discount the weight of the description more than the name.
if SEARCH_FIELDS.description.name in search_fields:
clause = Repository.description.match(lookup_value) | clause
cases = [(Repository.name.match(lookup_value), 100 * RepositorySearchScore.score),]
computed_score = case(None, cases, RepositorySearchScore.score).alias('score')
else:
clause = (Repository.id >= 0)
computed_score = RepositorySearchScore.score.alias('score')
query = (Repository.select(Repository, Namespace, computed_score)
.join(Namespace, on=(Namespace.id == Repository.namespace_user)).where(clause)

View file

@ -347,9 +347,6 @@ class ConductRepositorySearch(ApiResource):
def get(self, parsed_args):
""" Get a list of apps and repositories that match the specified query. """
query = parsed_args['query']
if not query:
return {'results': []}
page = min(max(1, parsed_args['page']), 10)
offset = (page - 1) * MAX_PER_PAGE
limit = offset + MAX_PER_PAGE + 1

View file

@ -9,6 +9,7 @@ from endpoints.test.shared import client_with_identity
from test.fixtures import *
@pytest.mark.parametrize('query', [
(''),
('simple'),
('public'),
('repository'),

View file

@ -215,12 +215,6 @@ def application(path):
return index('')
@web.route('/starred/')
@no_cache
def starred():
return index('')
@web.route('/security/')
@no_cache
def security():

View file

@ -117,3 +117,21 @@ nav.navbar-default .navbar-nav>li>a.active {
display: inline-block;
margin-bottom: 6px;
}
@media (max-width: 960px) {
.header-bar-element .navbar-anon .search-box-element input {
width: 200px;
}
}
@media (max-width: 860px) {
.header-bar-element .navbar-anon .search-box-element input {
width: 150px;
}
}
@media (max-width: 1150px) {
.header-bar-element .navbar-signedin search-box {
display: none;
}
}

View file

@ -16,20 +16,18 @@
<div class="collapse navbar-collapse navbar-ex1-collapse">
<!-- Not signed in -->
<ul class="nav navbar-nav navbar-links" ng-if="user.anonymous">
<li ng-if="searchingAllowed"><a ng-href="/search" quay-section="search">Explore</a></li>
<li><a ng-href="/tour/" quay-section="tour">Tour</a></li>
<li><a ng-href="/tutorial/" quay-section="tutorial">Tutorial</a></li>
<li quay-require="['BILLING']"><a ng-href="/plans/" quay-section="plans">Pricing</a></li>
<li><a href="https://docs.quay.io/" ng-safenewtab>Docs</a></li>
<li quay-require="['BILLING']"><a href="https://blog.quay.io/" ng-safenewtab>Blog</a></li>
</ul>
<!-- Signed in -->
<ul class="nav navbar-nav navbar-links" ng-if="!user.anonymous">
<li ng-if="searchingAllowed"><a ng-href="/search" quay-section="search">Explore</a></li>
<li quay-require="['APP_REGISTRY']"><a ng-href="/application/" quay-section="application">Applications</a></li>
<li><a ng-href="/repository/" quay-section="repository">Repositories</a></li>
<li><a ng-href="/tutorial/" quay-section="tutorial">Tutorial</a></li>
<li><a href="https://docs.quay.io/" ng-safenewtab>Docs</a></li>
<li quay-require="['BILLING']"><a href="https://blog.quay.io/" ng-safenewtab>Blog</a></li>
</ul>
<!-- Phone -->
@ -50,12 +48,13 @@
<!-- Normal -->
<ul class="nav navbar-nav navbar-right hidden-xs" ng-switch on="user.anonymous">
<li>
<span class="navbar-left user-tools hidden-sm">
<span class="navbar-left user-tools"
ng-class="{'navbar-anon': user.anonymous, 'navbar-signedin': !user.anonymous}">
<search-box ng-if="searchingAllowed"></search-box>
</span>
</li>
<li>
<span class="navbar-left user-tools with-menu" ng-show="!user.anonymous">
<span class="navbar-left user-tools with-menu hidden-sm" ng-show="!user.anonymous">
<span class="dropdown">
<a class="dropdown-toggle new-menu" data-toggle="dropdown">
<i class="fa fa-plus user-tool"
@ -107,7 +106,7 @@
</li>
<li>
<span class="navbar-left user-tools" ng-show="!user.anonymous">
<span class="navbar-left user-tools hidden-sm" ng-show="!user.anonymous">
<a data-template="/static/directives/notification-bar.html"
data-container="body" data-animation="am-slide-right" bs-aside>
<i class="fa fa-bell user-tool"
@ -139,9 +138,6 @@
</li>
</ul>
</div><!-- /.navbar-collapse -->
<div class="visible-sm block-search" ng-if="searchingAllowed">
<search-box></search-box>
</div>
</div>
<div class="create-robot-dialog" info="createRobotInfo"

View file

@ -163,6 +163,7 @@ mixpanel.init("{{ mixpanel_key }}", { track_pageview : false, debug: {{ is_debug
<div class="col-md-8">
<ul>
<li><span class="copyright">{{ version_number }} &copy;2014-{{ current_year }} CoreOS, Inc.</span></li>
<li><a href="https://docs.quay.io/" ng-safenewtab>Documentation and Help</a></li>
<li quay-require="['BILLING']"><a href="/tos" target="_self">Terms</a></li>
<li quay-require="['BILLING']"><a href="/privacy" target="_self">Privacy</a></li>
<li quay-require="['BILLING']"><a href="/security/" target="_self">Security</a></li>