Development
This commit is contained in:
parent
01a636e842
commit
b2264cd7b7
1 changed files with 9 additions and 18 deletions
|
|
@ -682,10 +682,7 @@ def collect_tokens():
|
|||
tokens['NO_PENDING'] = 'true' if not pending_items else ''
|
||||
tokens['NO_DISMISSIBLE_PENDING'] = 'true' if not any(c != 'fix problems' for _, _, c, _ in pending_items) else ''
|
||||
tokens['APPLY_WARNING'] = (
|
||||
f'<span class="btn-notice btn-notice-warning">'
|
||||
f'{_load_icon("arrow-right")}'
|
||||
f'Applying actions will briefly disrupt connections as network services are restarted.'
|
||||
f'</span>'
|
||||
'<span class="tag" data-tooltip="Applying actions will briefly disrupt connections as network services are restarted.">note</span>'
|
||||
if pending_items else ''
|
||||
)
|
||||
done_ts_map = get_done_timestamps()
|
||||
|
|
@ -929,13 +926,11 @@ def render_layout(view_id, content_html, tokens, page_name=None):
|
|||
try:
|
||||
import json as _j
|
||||
st = _j.load(open(HEALTH_FILE))
|
||||
grouped = {'error': [], 'warning': []}
|
||||
problems = []
|
||||
for section in ('configurations', 'logs'):
|
||||
for item in st.get(section, []):
|
||||
if item.get('status') == 'problem':
|
||||
sev = item.get('severity', 'error')
|
||||
text = e(item.get('detail', item.get('name', '')))
|
||||
grouped.setdefault(sev, []).append(text)
|
||||
problems.append(e(item.get('detail', item.get('name', ''))))
|
||||
for item in st.get('services', []):
|
||||
if item.get('status') == 'problem':
|
||||
name = item.get('name', '')
|
||||
|
|
@ -947,12 +942,11 @@ def render_layout(view_id, content_html, tokens, page_name=None):
|
|||
if not item.get('enabled_ok'):
|
||||
exp_parts.append(item.get('expected_enabled', 'enabled'))
|
||||
act_parts.append(item.get('enabled', 'unknown'))
|
||||
detail = (
|
||||
problems.append(e(
|
||||
f"The {utype} `{name}` is expected to be "
|
||||
f"{' and '.join(exp_parts)} but is {' and '.join(act_parts)}."
|
||||
)
|
||||
grouped.setdefault(item.get('severity', 'error'), []).append(e(detail))
|
||||
has_problems = any(items for items in grouped.values())
|
||||
))
|
||||
has_problems = bool(problems)
|
||||
fix_suffix = ''
|
||||
fix_uuid = None
|
||||
if has_problems:
|
||||
|
|
@ -973,12 +967,9 @@ def render_layout(view_id, content_html, tokens, page_name=None):
|
|||
fix_suffix = ('Fix pending. Click <strong>Apply Now</strong> below to fix.'
|
||||
if view_id == 'actions' else
|
||||
'Fix pending. Visit the <strong>Actions</strong> page ASAP to apply fix.')
|
||||
for sev, items in grouped.items():
|
||||
if not items:
|
||||
continue
|
||||
cls = 'info-bar-danger' if sev == 'error' else 'info-bar-warning'
|
||||
if problems:
|
||||
problems_list = ('<ul style="margin:0.25em 0;padding-left:1.25em">'
|
||||
+ ''.join(f'<li>{d}</li>' for d in items)
|
||||
+ ''.join(f'<li>{d}</li>' for d in problems)
|
||||
+ '</ul>')
|
||||
uuid_attr = (f' data-health-uuid="{e(fix_uuid)}"'
|
||||
if fix_uuid and _entry_ts_from_queue(fix_uuid) is not None else '')
|
||||
|
|
@ -988,7 +979,7 @@ def render_layout(view_id, content_html, tokens, page_name=None):
|
|||
'<div style="font-weight:600;margin-bottom:0.25em">Health check - problems found:</div>'
|
||||
+ problems_list + fix_html
|
||||
+ '</div>')
|
||||
problem_bars += f'<div class="info-bar {cls}">{content}</div>\n'
|
||||
problem_bars += f'<div class="info-bar info-bar-danger">{content}</div>\n'
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue