Merge "Using WrappingColumn to prevent long names breaking table layouts"
This commit is contained in:
commit
88a9d4afd2
@ -23,6 +23,7 @@ from openstack_dashboard import policy
|
||||
from oslo_log import log as logging
|
||||
|
||||
from muranodashboard import api
|
||||
from muranodashboard.common import utils as md_utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -75,7 +76,7 @@ class DeleteCategory(policy.PolicyTargetMixin, tables.DeleteAction):
|
||||
|
||||
|
||||
class CategoriesTable(tables.DataTable):
|
||||
name = tables.Column('name', verbose_name=_('Category Name'))
|
||||
name = md_utils.Column('name', verbose_name=_('Category Name'))
|
||||
use_artifacts = getattr(settings, 'MURANO_USE_GLARE', False)
|
||||
if not use_artifacts:
|
||||
package_count = tables.Column('package_count',
|
||||
|
@ -23,6 +23,13 @@ from muranodashboard.dynamic_ui import yaql_expression
|
||||
import six
|
||||
import yaql
|
||||
|
||||
# WrappingColumn is only available in N-horizon
|
||||
# This make murano-dashboard compatible with Mitaka-horizon
|
||||
try:
|
||||
from horizon.tables import WrappingColumn as Column
|
||||
except ImportError:
|
||||
from horizon.tables import Column as Column # noqa
|
||||
|
||||
|
||||
def parse_api_error(api_error_html):
|
||||
error_html = bs4.BeautifulSoup(api_error_html)
|
||||
|
@ -31,6 +31,7 @@ from oslo_log import log as logging
|
||||
from muranodashboard import api as api_utils
|
||||
from muranodashboard.api import packages as pkg_api
|
||||
from muranodashboard.catalog import views as catalog_views
|
||||
from muranodashboard.common import utils as md_utils
|
||||
from muranodashboard.environments import api
|
||||
from muranodashboard.environments import consts
|
||||
from muranodashboard.packages import consts as pkg_consts
|
||||
@ -433,12 +434,12 @@ class UpdateName(tables.UpdateAction):
|
||||
|
||||
|
||||
class EnvironmentsTable(tables.DataTable):
|
||||
name = tables.Column('name',
|
||||
name = md_utils.Column(
|
||||
'name',
|
||||
link='horizon:murano:environments:services',
|
||||
verbose_name=_('Name'),
|
||||
form_field=forms.CharField(required=False),
|
||||
update_action=UpdateName,
|
||||
truncate=40)
|
||||
update_action=UpdateName)
|
||||
|
||||
status = tables.Column('status',
|
||||
verbose_name=_('Status'),
|
||||
@ -484,7 +485,8 @@ def get_service_type(datum):
|
||||
|
||||
|
||||
class ServicesTable(tables.DataTable):
|
||||
name = tables.Column('name',
|
||||
name = md_utils.Column(
|
||||
'name',
|
||||
verbose_name=_('Name'),
|
||||
link=get_service_details_link)
|
||||
|
||||
@ -609,8 +611,7 @@ class DeploymentsTable(tables.DataTable):
|
||||
|
||||
|
||||
class EnvConfigTable(tables.DataTable):
|
||||
name = tables.Column('name',
|
||||
verbose_name=_('Name'))
|
||||
name = md_utils.Column('name', verbose_name=_('Name'))
|
||||
_type = tables.Column(
|
||||
lambda datum: get_service_type(datum) or 'Unknown',
|
||||
verbose_name=_('Type'))
|
||||
|
@ -19,6 +19,8 @@ from horizon import exceptions
|
||||
from horizon import tables
|
||||
from openstack_dashboard.api import glance
|
||||
|
||||
from muranodashboard.common import utils as md_utils
|
||||
|
||||
|
||||
class MarkImage(tables.LinkAction):
|
||||
name = "mark_image"
|
||||
@ -70,9 +72,8 @@ class MarkedImagesTable(tables.DataTable):
|
||||
)
|
||||
type = tables.Column(lambda obj: getattr(obj, 'type', None),
|
||||
verbose_name=_('Type'))
|
||||
title = tables.Column(lambda obj: getattr(obj, 'title', None),
|
||||
verbose_name=_('Title'),
|
||||
truncate=40)
|
||||
title = md_utils.Column(lambda obj: getattr(obj, 'title', None),
|
||||
verbose_name=_('Title'))
|
||||
|
||||
class Meta(object):
|
||||
name = 'marked_images'
|
||||
|
@ -25,6 +25,7 @@ from oslo_log import log as logging
|
||||
|
||||
from muranoclient.common import exceptions as exc
|
||||
from muranodashboard import api
|
||||
from muranodashboard.common import utils as md_utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -214,7 +215,8 @@ class ModifyPackage(tables.LinkAction):
|
||||
|
||||
|
||||
class PackageDefinitionsTable(tables.DataTable):
|
||||
name = tables.Column('name',
|
||||
name = md_utils.Column(
|
||||
'name',
|
||||
link="horizon:murano:packages:detail",
|
||||
verbose_name=_('Package Name'))
|
||||
tenant_name = tables.Column('tenant_name', verbose_name=_('Tenant Name'))
|
||||
|
Loading…
Reference in New Issue
Block a user