Merge pull request #2921 from coreos-inc/joseph.schorr/QS-63/public-browse
Browse/exploration of repositories
This commit is contained in:
commit
51b043bd23
8 changed files with 40 additions and 31 deletions
|
@ -509,18 +509,20 @@ def _get_sorted_matching_repositories(lookup_value, repo_kind='image', include_p
|
||||||
if search_fields is None:
|
if search_fields is None:
|
||||||
search_fields = set([SEARCH_FIELDS.description.name, SEARCH_FIELDS.name.name])
|
search_fields = set([SEARCH_FIELDS.description.name, SEARCH_FIELDS.name.name])
|
||||||
|
|
||||||
# Always search at least on name (init clause)
|
if lookup_value:
|
||||||
clause = Repository.name.match(lookup_value)
|
# Always search at least on name (init clause)
|
||||||
computed_score = RepositorySearchScore.score.alias('score')
|
clause = Repository.name.match(lookup_value)
|
||||||
|
computed_score = RepositorySearchScore.score.alias('score')
|
||||||
|
|
||||||
# If the description field is in the search fields, then we need to compute a synthetic score
|
# If the description field is in the search fields, then we need to compute a synthetic score
|
||||||
# to discount the weight of the description more than the name.
|
# to discount the weight of the description more than the name.
|
||||||
if SEARCH_FIELDS.description.name in search_fields:
|
if SEARCH_FIELDS.description.name in search_fields:
|
||||||
clause = Repository.description.match(lookup_value) | clause
|
clause = Repository.description.match(lookup_value) | clause
|
||||||
|
cases = [(Repository.name.match(lookup_value), 100 * RepositorySearchScore.score),]
|
||||||
cases = [(Repository.name.match(lookup_value), 100 * RepositorySearchScore.score),]
|
computed_score = case(None, cases, RepositorySearchScore.score).alias('score')
|
||||||
|
else:
|
||||||
computed_score = case(None, cases, RepositorySearchScore.score).alias('score')
|
clause = (Repository.id >= 0)
|
||||||
|
computed_score = RepositorySearchScore.score.alias('score')
|
||||||
|
|
||||||
query = (Repository.select(Repository, Namespace, computed_score)
|
query = (Repository.select(Repository, Namespace, computed_score)
|
||||||
.join(Namespace, on=(Namespace.id == Repository.namespace_user)).where(clause)
|
.join(Namespace, on=(Namespace.id == Repository.namespace_user)).where(clause)
|
||||||
|
|
|
@ -347,9 +347,6 @@ class ConductRepositorySearch(ApiResource):
|
||||||
def get(self, parsed_args):
|
def get(self, parsed_args):
|
||||||
""" Get a list of apps and repositories that match the specified query. """
|
""" Get a list of apps and repositories that match the specified query. """
|
||||||
query = parsed_args['query']
|
query = parsed_args['query']
|
||||||
if not query:
|
|
||||||
return {'results': []}
|
|
||||||
|
|
||||||
page = min(max(1, parsed_args['page']), 10)
|
page = min(max(1, parsed_args['page']), 10)
|
||||||
offset = (page - 1) * MAX_PER_PAGE
|
offset = (page - 1) * MAX_PER_PAGE
|
||||||
limit = offset + MAX_PER_PAGE + 1
|
limit = offset + MAX_PER_PAGE + 1
|
||||||
|
|
|
@ -9,6 +9,7 @@ from endpoints.test.shared import client_with_identity
|
||||||
from test.fixtures import *
|
from test.fixtures import *
|
||||||
|
|
||||||
@pytest.mark.parametrize('query', [
|
@pytest.mark.parametrize('query', [
|
||||||
|
(''),
|
||||||
('simple'),
|
('simple'),
|
||||||
('public'),
|
('public'),
|
||||||
('repository'),
|
('repository'),
|
||||||
|
|
|
@ -215,12 +215,6 @@ def application(path):
|
||||||
return index('')
|
return index('')
|
||||||
|
|
||||||
|
|
||||||
@web.route('/starred/')
|
|
||||||
@no_cache
|
|
||||||
def starred():
|
|
||||||
return index('')
|
|
||||||
|
|
||||||
|
|
||||||
@web.route('/security/')
|
@web.route('/security/')
|
||||||
@no_cache
|
@no_cache
|
||||||
def security():
|
def security():
|
||||||
|
|
|
@ -116,4 +116,22 @@ nav.navbar-default .navbar-nav>li>a.active {
|
||||||
margin-top: -6px;
|
margin-top: -6px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 6px;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -16,20 +16,18 @@
|
||||||
<div class="collapse navbar-collapse navbar-ex1-collapse">
|
<div class="collapse navbar-collapse navbar-ex1-collapse">
|
||||||
<!-- Not signed in -->
|
<!-- Not signed in -->
|
||||||
<ul class="nav navbar-nav navbar-links" ng-if="user.anonymous">
|
<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="/tour/" quay-section="tour">Tour</a></li>
|
||||||
<li><a ng-href="/tutorial/" quay-section="tutorial">Tutorial</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 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>
|
</ul>
|
||||||
|
|
||||||
<!-- Signed in -->
|
<!-- Signed in -->
|
||||||
<ul class="nav navbar-nav navbar-links" ng-if="!user.anonymous">
|
<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 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="/repository/" quay-section="repository">Repositories</a></li>
|
||||||
<li><a ng-href="/tutorial/" quay-section="tutorial">Tutorial</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>
|
</ul>
|
||||||
|
|
||||||
<!-- Phone -->
|
<!-- Phone -->
|
||||||
|
@ -50,12 +48,13 @@
|
||||||
<!-- Normal -->
|
<!-- Normal -->
|
||||||
<ul class="nav navbar-nav navbar-right hidden-xs" ng-switch on="user.anonymous">
|
<ul class="nav navbar-nav navbar-right hidden-xs" ng-switch on="user.anonymous">
|
||||||
<li>
|
<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>
|
<search-box ng-if="searchingAllowed"></search-box>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<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">
|
<span class="dropdown">
|
||||||
<a class="dropdown-toggle new-menu" data-toggle="dropdown">
|
<a class="dropdown-toggle new-menu" data-toggle="dropdown">
|
||||||
<i class="fa fa-plus user-tool"
|
<i class="fa fa-plus user-tool"
|
||||||
|
@ -107,7 +106,7 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<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"
|
<a data-template="/static/directives/notification-bar.html"
|
||||||
data-container="body" data-animation="am-slide-right" bs-aside>
|
data-container="body" data-animation="am-slide-right" bs-aside>
|
||||||
<i class="fa fa-bell user-tool"
|
<i class="fa fa-bell user-tool"
|
||||||
|
@ -139,9 +138,6 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div><!-- /.navbar-collapse -->
|
</div><!-- /.navbar-collapse -->
|
||||||
<div class="visible-sm block-search" ng-if="searchingAllowed">
|
|
||||||
<search-box></search-box>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="create-robot-dialog" info="createRobotInfo"
|
<div class="create-robot-dialog" info="createRobotInfo"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="resource-view-element">
|
<div class="resource-view-element">
|
||||||
<div class="cor-loader" ng-show="getState(resources) == 'loading'"></div>
|
<div class="cor-loader" ng-show="getState(resources) == 'loading'"></div>
|
||||||
<div class="co-alert co-alert-warning" ng-show="getState(resources) == 'error'">
|
<div class="co-alert co-alert-warning" ng-show="getState(resources) == 'error'">
|
||||||
{{ errorMessage }}
|
{{ errorMessage || 'Could not load resource' }}
|
||||||
</div>
|
</div>
|
||||||
<div class="resource-content" ng-class="getState(resources) == 'ready' ? 'visible' : 'hidden'">
|
<div class="resource-content" ng-class="getState(resources) == 'ready' ? 'visible' : 'hidden'">
|
||||||
<span ng-transclude></span>
|
<span ng-transclude></span>
|
||||||
|
|
|
@ -163,6 +163,7 @@ mixpanel.init("{{ mixpanel_key }}", { track_pageview : false, debug: {{ is_debug
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<ul>
|
<ul>
|
||||||
<li><span class="copyright">{{ version_number }} ©2014-{{ current_year }} CoreOS, Inc.</span></li>
|
<li><span class="copyright">{{ version_number }} ©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="/tos" target="_self">Terms</a></li>
|
||||||
<li quay-require="['BILLING']"><a href="/privacy" target="_self">Privacy</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>
|
<li quay-require="['BILLING']"><a href="/security/" target="_self">Security</a></li>
|
||||||
|
|
Reference in a new issue