Added SMART/Journal panes
This commit is contained in:
parent
d9561a0159
commit
bcd46d4017
3 changed files with 28 additions and 18 deletions
|
|
@ -2,8 +2,6 @@
|
||||||
# pylint: disable=bad-whitespace,line-too-long
|
# pylint: disable=bad-whitespace,line-too-long
|
||||||
# vim: sts=2 sw=2 ts=2
|
# vim: sts=2 sw=2 ts=2
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -405,17 +405,19 @@ class State():
|
||||||
if forced or needs_fixed:
|
if forced or needs_fixed:
|
||||||
self.update_top_panes()
|
self.update_top_panes()
|
||||||
|
|
||||||
# SMART/Journal
|
# Return if Progress pane not present
|
||||||
if 'Progress' not in self.panes:
|
if 'Progress' not in self.panes:
|
||||||
# Assumning we're still selecting source/dest
|
|
||||||
return
|
return
|
||||||
height = tmux.get_pane_size(self.panes['Progress'])[1] - 2
|
|
||||||
p_ratios = [int((x/sum(PANE_RATIOS)) * height) for x in PANE_RATIOS]
|
# SMART/Journal
|
||||||
if 'SMART' in self.panes:
|
if forced or needs_fixed:
|
||||||
tmux.resize_pane(self.panes['SMART'], height=p_ratios[0])
|
height = tmux.get_pane_size(self.panes['Progress'])[1] - 2
|
||||||
tmux.resize_pane(height=p_ratios[1])
|
p_ratios = [int((x/sum(PANE_RATIOS)) * height) for x in PANE_RATIOS]
|
||||||
if 'Journal' in self.panes:
|
if 'SMART' in self.panes:
|
||||||
tmux.resize_pane(self.panes['Journal'], height=p_ratios[2])
|
tmux.resize_pane(self.panes['SMART'], height=p_ratios[0])
|
||||||
|
tmux.resize_pane(height=p_ratios[1])
|
||||||
|
if 'Journal' in self.panes:
|
||||||
|
tmux.resize_pane(self.panes['Journal'], height=p_ratios[2])
|
||||||
|
|
||||||
def fix_tmux_layout_loop(self):
|
def fix_tmux_layout_loop(self):
|
||||||
"""Fix tmux layout on a loop.
|
"""Fix tmux layout on a loop.
|
||||||
|
|
@ -1349,16 +1351,24 @@ def mount_raw_image_macos(path):
|
||||||
def run_recovery(state, main_menu, settings_menu):
|
def run_recovery(state, main_menu, settings_menu):
|
||||||
"""Run recovery passes."""
|
"""Run recovery passes."""
|
||||||
atexit.register(state.save_debug_reports)
|
atexit.register(state.save_debug_reports)
|
||||||
state.update_progress_pane('Active')
|
|
||||||
|
|
||||||
# Start SMART/Journal
|
# Start SMART/Journal
|
||||||
# TODO
|
state.panes['SMART'] = tmux.split_window(
|
||||||
|
behind=True, lines=12, vertical=True,
|
||||||
|
watch_file=f'{state.log_dir}/smart.out',
|
||||||
|
)
|
||||||
|
state.panes['Journal'] = tmux.split_window(
|
||||||
|
lines=4, vertical=True, cmd='journalctl --dmesg --follow',
|
||||||
|
)
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
# Run ddrescue
|
# Run ddrescue
|
||||||
|
state.update_progress_pane('Active')
|
||||||
|
|
||||||
# Stop SMART/Journal
|
# Stop SMART/Journal
|
||||||
# TODO
|
for pane in ('SMART', 'Journal'):
|
||||||
|
if pane in state.panes:
|
||||||
|
tmux.kill_pane(state.panes.pop(pane))
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
state.save_debug_reports()
|
state.save_debug_reports()
|
||||||
|
|
|
||||||
|
|
@ -275,15 +275,17 @@ class Disk(BaseObj):
|
||||||
# Done
|
# Done
|
||||||
return report
|
return report
|
||||||
|
|
||||||
def generate_report(self):
|
def generate_report(self, header=True):
|
||||||
"""Generate Disk report, returns list."""
|
"""Generate Disk report, returns list."""
|
||||||
report = []
|
report = []
|
||||||
report.append(color_string(f'Device ({self.path.name})', 'BLUE'))
|
if header:
|
||||||
report.append(f' {self.description}')
|
report.append(color_string(f'Device ({self.path.name})', 'BLUE'))
|
||||||
|
report.append(f' {self.description}')
|
||||||
|
|
||||||
# Attributes
|
# Attributes
|
||||||
if self.attributes:
|
if self.attributes:
|
||||||
report.append(color_string('Attributes', 'BLUE'))
|
if header:
|
||||||
|
report.append(color_string('Attributes', 'BLUE'))
|
||||||
report.extend(self.generate_attribute_report())
|
report.extend(self.generate_attribute_report())
|
||||||
|
|
||||||
# Notes
|
# Notes
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue