Skip to content

Commit

Permalink
Asadm 2.7.1 bugfix (#171)
Browse files Browse the repository at this point in the history
* fix: TOOLS-1981 --no-color does not remove all ansi symbols

* fix: TOOLS-1982 watch cmd does not show tables
  • Loading branch information
Jesse S authored Apr 12, 2022
1 parent 8b044d6 commit 521c331
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions lib/live_cluster/live_cluster_root_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def do_help(self, line):
" watch 5 info namespace",
)
@DisableAutoComplete()
def do_watch(self, line):
self.view.watch(self, line)
async def do_watch(self, line):
await self.view.watch(self, line)

@DisableAutoComplete()
@CommandHelp(
Expand Down
5 changes: 3 additions & 2 deletions lib/view/sheet/decleration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from collections import Counter
import logging
from typing import Callable

from lib.utils import file_size
from lib.view import terminal
Expand Down Expand Up @@ -78,10 +79,10 @@ def __init__(

self.vertical_separator = vertical_separator
self.horizontal_seperator = horizontal_seperator
self.formatted_vertical_separator = (
self.formatted_vertical_separator_func: Callable[[], str] = lambda: (
terminal.dim() + vertical_separator + terminal.undim()
)
self.formatted_horizontal_seperator = (
self.formatted_horizontal_seperator_func: Callable[[], str] = lambda: (
terminal.dim() + horizontal_seperator + terminal.undim()
)
self.title_fill = title_fill
Expand Down
16 changes: 10 additions & 6 deletions lib/view/sheet/render/column_rsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def do_render(self):

# Render fields.
title_lines = [
self.decleration.formatted_vertical_separator.join(
self.decleration.formatted_vertical_separator_func().join(
rfield.get_title_line(line_num) for rfield in rfields
)
for line_num in range(n_title_lines)
Expand All @@ -110,15 +110,19 @@ def do_render(self):

num_lines += 1
row = [rfield.entry_cell(group_ix, entry_ix) for rfield in rfields]
render.append(self.decleration.formatted_vertical_separator.join(row))
render.append(
self.decleration.formatted_vertical_separator_func().join(row)
)

if has_aggregates:
if self.title_repeat and num_lines % repeats_every == 0:
render.extend(title_lines)

num_lines += 1
row = [rfield.aggregate_cell(group_ix) for rfield in rfields]
render.append(self.decleration.formatted_vertical_separator.join(row))
render.append(
self.decleration.formatted_vertical_separator_func().join(row)
)

self._do_render_n_rows(render, self.n_records)

Expand Down Expand Up @@ -221,7 +225,7 @@ def get_title_line(self, line_num):
line = self.title_lines[line_num]
except IndexError:
sub_line = line_num - len(self.title_lines)
line = self.rsheet.decleration.formatted_vertical_separator.join(
line = self.rsheet.decleration.formatted_vertical_separator_func().join(
sub.get_title_line(sub_line) for sub in self.visible
)

Expand All @@ -231,12 +235,12 @@ def get_title_line(self, line_num):
return terminal.bold() + line + terminal.unbold()

def entry_cell(self, group_ix, entry_ix):
return self.rsheet.decleration.formatted_vertical_separator.join(
return self.rsheet.decleration.formatted_vertical_separator_func().join(
sub.entry_cell(group_ix, entry_ix) for sub in self.visible
)

def aggregate_cell(self, group_ix):
return self.rsheet.decleration.formatted_vertical_separator.join(
return self.rsheet.decleration.formatted_vertical_separator_func().join(
sub.aggregate_cell(group_ix) for sub in self.visible
)

Expand Down
6 changes: 4 additions & 2 deletions lib/view/sheet/render/row_rsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ def do_render(self):
if has_aggregate:
row.append(render_field.aggregate_cell(group_ix))

render.append(self.decleration.formatted_vertical_separator.join(row))
render.append(
self.decleration.formatted_vertical_separator_func().join(row)
)

if num_groups > 1 and group_ix < num_groups - 1:
render.append(
self.decleration.formatted_horizontal_seperator * title_width
self.decleration.formatted_vertical_separator_func() * title_width
)

num_rows = len(render_fields) * num_groups - hidden_count
Expand Down
4 changes: 2 additions & 2 deletions lib/view/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ def peekable(peeked, remaining):
yield val

@staticmethod
def watch(ctrl, line):
async def watch(ctrl, line):
diff_highlight = True
sleep = 2.0
num_iterations = False
Expand Down Expand Up @@ -1201,7 +1201,7 @@ def watch(ctrl, line):

while True:
highlight = False
ctrl.execute(line[:])
await ctrl.execute(line[:])
output = mystdout.getvalue()
mystdout.truncate(0)
mystdout.seek(0)
Expand Down

0 comments on commit 521c331

Please sign in to comment.