Hide package_counter in case of using glare
It is now impossible to display the correct number of packages in each category using glare as a package storage, because glare doesn't store this information. Therefore, it is better to just hide counters from the user until package count will be implemented in Glare. Change-Id: I62487dbb12b1d104d293dcc499ded216982e0159 Related-bug: #1537070
This commit is contained in:
parent
4ebf7f56b6
commit
6ff16698c8
@ -599,6 +599,8 @@ class IndexView(list_view.ListView):
|
|||||||
context['no_apps'] = True
|
context['no_apps'] = True
|
||||||
if self.get_current_category() != ALL_CATEGORY_NAME or search:
|
if self.get_current_category() != ALL_CATEGORY_NAME or search:
|
||||||
context['no_apps'] = False
|
context['no_apps'] = False
|
||||||
|
context['MURANO_USE_GLARE'] = getattr(settings, 'MURANO_USE_GLARE',
|
||||||
|
False)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ungettext_lazy
|
from django.utils.translation import ungettext_lazy
|
||||||
@ -51,6 +52,9 @@ class DeleteCategory(tables.DeleteAction):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def allowed(self, request, category=None):
|
def allowed(self, request, category=None):
|
||||||
|
use_artifacts = getattr(settings, 'MURANO_USE_GLARE', False)
|
||||||
|
if use_artifacts:
|
||||||
|
return category is not None
|
||||||
if category is not None:
|
if category is not None:
|
||||||
if not category.package_count:
|
if not category.package_count:
|
||||||
return True
|
return True
|
||||||
@ -68,6 +72,8 @@ class DeleteCategory(tables.DeleteAction):
|
|||||||
|
|
||||||
class CategoriesTable(tables.DataTable):
|
class CategoriesTable(tables.DataTable):
|
||||||
name = tables.Column('name', verbose_name=_('Category Name'))
|
name = tables.Column('name', verbose_name=_('Category Name'))
|
||||||
|
use_artifacts = getattr(settings, 'MURANO_USE_GLARE', False)
|
||||||
|
if not use_artifacts:
|
||||||
package_count = tables.Column('package_count',
|
package_count = tables.Column('package_count',
|
||||||
verbose_name=_('Package Count'))
|
verbose_name=_('Package Count'))
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from horizon import exceptions
|
from horizon import exceptions
|
||||||
@ -219,6 +220,13 @@ class EnvironmentServicesTab(tabs.TableTab):
|
|||||||
|
|
||||||
return services
|
return services
|
||||||
|
|
||||||
|
def get_context_data(self, request, **kwargs):
|
||||||
|
context = super(EnvironmentServicesTab,
|
||||||
|
self).get_context_data(request, **kwargs)
|
||||||
|
context['MURANO_USE_GLARE'] = getattr(settings, 'MURANO_USE_GLARE',
|
||||||
|
False)
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class DeploymentTab(tabs.TableTab):
|
class DeploymentTab(tabs.TableTab):
|
||||||
slug = "deployments"
|
slug = "deployments"
|
||||||
|
@ -48,7 +48,11 @@
|
|||||||
{% for category in categories %}
|
{% for category in categories %}
|
||||||
<li class="clearfix">
|
<li class="clearfix">
|
||||||
<a tabindex="-1" href="{% url 'horizon:murano:catalog:index' %}?category={{ category.name|urlencode }}" class="btn btn-small">
|
<a tabindex="-1" href="{% url 'horizon:murano:catalog:index' %}?category={{ category.name|urlencode }}" class="btn btn-small">
|
||||||
{{ category.name }} ({{category.package_count}})</a>
|
{{ category.name }}
|
||||||
|
{% if not MURANO_USE_GLARE %}
|
||||||
|
({{category.package_count}})
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -39,7 +39,11 @@
|
|||||||
<li role="presentation"><a
|
<li role="presentation"><a
|
||||||
role="menuitem" tabindex="-1"
|
role="menuitem" tabindex="-1"
|
||||||
data-category-name="{{ category.name }}"
|
data-category-name="{{ category.name }}"
|
||||||
href="#">{{ category.name }} ({{category.package_count}})</a>
|
href="#">{{ category.name }}
|
||||||
|
{% if not MURANO_USE_GLARE %}
|
||||||
|
({{category.package_count}})
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user