Wrapped long lines in the "Tags" column.

Change-Id: I0191402d046bcf6109a0c001d89f52ffe22de890
Closes-Bug: #1449511
This commit is contained in:
hparekh
2015-11-06 15:21:53 +05:30
parent 3b55af75ee
commit a3fc2206cd
4 changed files with 11 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ def format(action=None, lister=False):
action.is_system,
input,
desc,
', '.join(tags) or '<none>',
base.wrap(', '.join(tags)) or '<none>',
action.created_at,
)

View File

@@ -18,6 +18,7 @@ import abc
from cliff import lister
import six
import textwrap
@six.add_metaclass(abc.ABCMeta)
@@ -53,3 +54,10 @@ def cut(string, length=25):
return "%s..." % string[:length]
else:
return string
def wrap(string, width=25):
if string and len(string) > width:
return textwrap.fill(string, width)
else:
return string

View File

@@ -38,7 +38,7 @@ def format(workbook=None):
if workbook:
data = (
workbook.name,
', '.join(workbook.tags or '') or '<none>',
base.wrap(', '.join(workbook.tags or '')) or '<none>',
workbook.created_at,
)

View File

@@ -45,7 +45,7 @@ def format(workflow=None, lister=False):
data = (
workflow.name,
', '.join(tags) or '<none>',
base.wrap(', '.join(tags)) or '<none>',
workflow.input if not lister else base.cut(workflow.input),
workflow.created_at
)