Include ticket ID and name in top pane

* Only if ticket ID and name are set
* Expands on fix for issue #58
This commit is contained in:
2Shirt 2019-03-13 22:49:07 -06:00
parent 4c3fe1d66f
commit c73bf2521c
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -491,6 +491,8 @@ class State():
def init(self):
"""Remove test objects, set log, and add devices."""
self.disks = []
self.ticket_id = None
self.ticket_name = None
for k, v in self.tests.items():
v['Objects'] = []
@ -533,6 +535,15 @@ class State():
self.tmux_layout = TMUX_LAYOUT.copy()
start_thread(fix_tmux_panes_loop, args=[self])
def set_top_pane_text(self, text):
"""Set top pane text using TOP_PANE_TEXT and provided text."""
ticket_details = ''
if self.ticket_id and self.ticket_name:
ticket_details = '#{} {}'.format(self.ticket_id, self.ticket_name)
tmux_update_pane(
self.panes['Top'],
text='{} {}\n{}'.format(TOP_PANE_TEXT, ticket_details, text))
class TestObj():
"""Object to track test data."""
@ -875,10 +886,7 @@ def run_badblocks_test(state, test):
update_progress_pane(state)
# Update tmux layout
tmux_update_pane(
state.panes['Top'],
text='{}\n{}'.format(
TOP_PANE_TEXT, dev.description))
state.set_top_pane_text(dev.description)
# Create monitor pane
test.badblocks_out = '{}/badblocks_{}.out'.format(
@ -1124,10 +1132,7 @@ def run_io_benchmark(state, test):
update_progress_pane(state)
# Update tmux layout
tmux_update_pane(
state.panes['Top'],
text='{}\n{}'.format(
TOP_PANE_TEXT, dev.description))
state.set_top_pane_text(dev.description)
state.tmux_layout['Current'] = {'y': 15, 'Check': True}
# Create monitor pane
@ -1286,9 +1291,7 @@ def run_mprime_test(state, test):
test.thermal_abort = False
# Update tmux layout
tmux_update_pane(
state.panes['Top'],
text='{}\n{}'.format(TOP_PANE_TEXT, dev.name))
state.set_top_pane_text(dev.name)
# Start live sensor monitor
test.sensors_out = '{}/sensors.out'.format(global_vars['TmpDir'])
@ -1501,10 +1504,7 @@ def run_nvme_smart_tests(state, test, update_mode=False):
update_progress_pane(state)
# Update tmux layout
tmux_update_pane(
state.panes['Top'],
text='{}\n{}'.format(
TOP_PANE_TEXT, dev.description))
state.set_top_pane_text(dev.description)
# SMART short self-test
if dev.smart_attributes and not (state.quick_mode or update_mode):
@ -1643,15 +1643,7 @@ def show_report(report, log_report=False):
def show_results(state):
"""Show results for all tests."""
clear_screen()
if state.ticket_id and state.ticket_name:
tmux_update_pane(
state.panes['Top'],
text='{}\nResults for #{} {}'.format(
TOP_PANE_TEXT, state.ticket_id, state.ticket_name))
else:
tmux_update_pane(
state.panes['Top'],
text='{}\nResults'.format(TOP_PANE_TEXT))
state.set_top_pane_text('Results')
# CPU tests
_enabled = False