Added osTicket integration toggle to menu

This commit is contained in:
2Shirt 2018-12-26 19:46:27 -07:00
parent ff715b7a10
commit 7205ac6c35
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -495,6 +495,7 @@ class State():
def __init__(self): def __init__(self):
self.cpu = None self.cpu = None
self.disks = [] self.disks = []
self.ost_integration = False
self.panes = {} self.panes = {}
self.quick_mode = False self.quick_mode = False
self.tests = OrderedDict({ self.tests = OrderedDict({
@ -746,6 +747,7 @@ def menu_diags(state, args):
{'Base Name': 'Full Diagnostic', 'Enabled': False}, {'Base Name': 'Full Diagnostic', 'Enabled': False},
{'Base Name': 'Disk Diagnostic', 'Enabled': False}, {'Base Name': 'Disk Diagnostic', 'Enabled': False},
{'Base Name': 'Disk Diagnostic (Quick)', 'Enabled': False}, {'Base Name': 'Disk Diagnostic (Quick)', 'Enabled': False},
{'Base Name': 'osTicket Integration', 'Enabled': True},
{'Base Name': 'Prime95', 'Enabled': False, 'CRLF': True}, {'Base Name': 'Prime95', 'Enabled': False, 'CRLF': True},
{'Base Name': 'NVMe / SMART', 'Enabled': False}, {'Base Name': 'NVMe / SMART', 'Enabled': False},
{'Base Name': 'badblocks', 'Enabled': False}, {'Base Name': 'badblocks', 'Enabled': False},
@ -777,11 +779,11 @@ def menu_diags(state, args):
while True: while True:
# Set quick mode as necessary # Set quick mode as necessary
if main_options[2]['Enabled'] and main_options[4]['Enabled']: if main_options[2]['Enabled'] and main_options[5]['Enabled']:
# Check if only Disk Diags (Quick) and NVMe/SMART are enabled # Check if only Disk Diags (Quick) and NVMe/SMART are enabled
# If so, verify no other tests are enabled and set quick_mode # If so, verify no other tests are enabled and set quick_mode
state.quick_mode = True state.quick_mode = True
for opt in main_options[3:4] + main_options[5:]: for opt in main_options[4:5] + main_options[6:]:
state.quick_mode &= not opt['Enabled'] state.quick_mode &= not opt['Enabled']
else: else:
state.quick_mode = False state.quick_mode = False
@ -795,13 +797,13 @@ def menu_diags(state, args):
# Verify preset selections # Verify preset selections
num_tests_selected = 0 num_tests_selected = 0
for opt in main_options[3:]: for opt in main_options[4:]:
if opt['Enabled']: if opt['Enabled']:
num_tests_selected += 1 num_tests_selected += 1
if num_tests_selected == 4: if num_tests_selected == 4:
# Full # Full
main_options[0]['Enabled'] = True main_options[0]['Enabled'] = True
elif num_tests_selected == 3 and not main_options[3]['Enabled']: elif num_tests_selected == 3 and not main_options[4]['Enabled']:
# Disk # Disk
main_options[1]['Enabled'] = True main_options[1]['Enabled'] = True
@ -1576,33 +1578,34 @@ def update_main_options(state, selection, main_options):
if main_options[index]['Enabled']: if main_options[index]['Enabled']:
for opt in main_options[1:3]: for opt in main_options[1:3]:
opt['Enabled'] = False opt['Enabled'] = False
for opt in main_options[3:]: for opt in main_options[4:]:
opt['Enabled'] = True opt['Enabled'] = True
else: else:
for opt in main_options[3:]: for opt in main_options[4:]:
opt['Enabled'] = False opt['Enabled'] = False
elif index == 1: elif index == 1:
# Disk # Disk
if main_options[index]['Enabled']: if main_options[index]['Enabled']:
main_options[0]['Enabled'] = False main_options[0]['Enabled'] = False
for opt in main_options[2:4]: main_options[2]['Enabled'] = False
opt['Enabled'] = False main_options[4]['Enabled'] = False
for opt in main_options[4:]: for opt in main_options[5:]:
opt['Enabled'] = True opt['Enabled'] = True
else: else:
for opt in main_options[4:]: for opt in main_options[5:]:
opt['Enabled'] = False opt['Enabled'] = False
elif index == 2: elif index == 2:
# Disk (Quick) # Disk (Quick)
if main_options[index]['Enabled']: if main_options[index]['Enabled']:
for opt in main_options[:2] + main_options[3:]: for opt in main_options[:2] + main_options[4:]:
opt['Enabled'] = False opt['Enabled'] = False
main_options[4]['Enabled'] = True main_options[5]['Enabled'] = True
else: else:
main_options[4]['Enabled'] = False main_options[5]['Enabled'] = False
# Update state # Update state
for opt in main_options[3:]: state.ost_integration = main_options[3]['Enabled']
for opt in main_options[4:]:
state.tests[opt['Base Name']]['Enabled'] = opt['Enabled'] state.tests[opt['Base Name']]['Enabled'] = opt['Enabled']
# Done # Done