updated to allow config of the new server

This commit is contained in:
ske087
2026-06-26 10:11:44 +03:00
parent a48b3afb83
commit dbc1c882eb
14 changed files with 197 additions and 1127 deletions
+2
View File
@@ -454,6 +454,8 @@ def device_edit(device_id):
device.device_type = request.form.get('device_type', '').strip() or 'unknown'
device.description = request.form.get('description', '').strip() or None
device.os_version = request.form.get('os_version', '').strip() or None
custom_url = request.form.get('custom_chrome_url', '').strip()
device.custom_chrome_url = custom_url if custom_url else None
device.config_updated_at = datetime.utcnow()
device.info_reviewed_at = datetime.utcnow()
flash('Device updated.', 'success')
+11 -34
View File
@@ -37,31 +37,8 @@ def _get_or_create_global_config(session):
@wmt_web_bp.route('/')
def index():
"""WMT management dashboard."""
try:
with get_db().get_session() as session:
global_cfg = _get_or_create_global_config(session)
devices = session.query(Device).filter(Device.mac_address.isnot(None)).order_by(Device.nume_masa).all()
pending_count = session.query(WMTUpdateRequest).filter_by(status='pending').count()
recent_requests = (
session.query(WMTUpdateRequest)
.order_by(WMTUpdateRequest.submitted_at.desc())
.limit(5)
.all()
)
return render_template(
'wmt/index.html',
global_cfg=global_cfg,
devices=devices,
pending_count=pending_count,
recent_requests=recent_requests,
breadcrumbs=[{'url': url_for('wmt_web.index'), 'title': 'WMT Management'}],
)
except Exception as e:
logger.error(f'WMT dashboard error: {e}')
flash(f'Error loading dashboard: {e}', 'error')
return render_template('wmt/index.html', global_cfg=None, devices=[],
pending_count=0, recent_requests=[])
"""Retired: the WMT dashboard is merged into the unified Devices page."""
return redirect(url_for('main.devices'))
# ---------------------------------------------------------------------------
@@ -94,14 +71,14 @@ def settings():
'wmt/settings.html',
cfg=cfg,
breadcrumbs=[
{'url': url_for('wmt_web.index'), 'title': 'WMT Management'},
{'url': url_for('wmt_web.settings'), 'title': 'Global Settings'},
{'url': url_for('main.devices'), 'title': 'Devices'},
{'url': url_for('wmt_web.settings'), 'title': 'WMT Settings'},
],
)
except Exception as e:
logger.error(f'WMT settings error: {e}')
flash(f'Error: {e}', 'error')
return redirect(url_for('wmt_web.index'))
return redirect(url_for('main.devices'))
# ---------------------------------------------------------------------------
@@ -119,21 +96,23 @@ def update_requests():
query = query.filter_by(status=status_filter)
req_list = query.order_by(WMTUpdateRequest.submitted_at.desc()).all()
pending_count = session.query(WMTUpdateRequest).filter_by(status='pending').count()
unconfigured_count = session.query(WMTUpdateRequest).filter_by(status='to_be_configured').count()
return render_template(
'wmt/requests.html',
requests=req_list,
status_filter=status_filter,
pending_count=pending_count,
unconfigured_count=unconfigured_count,
breadcrumbs=[
{'url': url_for('wmt_web.index'), 'title': 'WMT Management'},
{'url': url_for('main.devices'), 'title': 'Devices'},
{'url': url_for('wmt_web.update_requests'), 'title': 'Update Requests'},
],
)
except Exception as e:
logger.error(f'WMT requests list error: {e}')
flash(f'Error: {e}', 'error')
return redirect(url_for('wmt_web.index'))
return redirect(url_for('main.devices'))
@wmt_web_bp.route('/requests/<int:req_id>/accept', methods=['POST'])
@@ -256,8 +235,7 @@ def device_new():
'wmt/device_form.html',
device=None,
breadcrumbs=[
{'url': url_for('wmt_web.index'), 'title': 'WMT Management'},
{'url': url_for('wmt_web.devices'), 'title': 'Devices'},
{'url': url_for('main.devices'), 'title': 'Devices'},
{'url': url_for('wmt_web.device_new'), 'title': 'New Device'},
],
)
@@ -291,8 +269,7 @@ def device_edit(device_id):
'wmt/device_form.html',
device=device,
breadcrumbs=[
{'url': url_for('wmt_web.index'), 'title': 'WMT Management'},
{'url': url_for('wmt_web.devices'), 'title': 'Devices'},
{'url': url_for('main.devices'), 'title': 'Devices'},
{'url': url_for('wmt_web.device_edit', device_id=device_id), 'title': 'Edit'},
],
)