Fix operator report email to link to frontend page and include asset number

- Change device URL from API endpoint (/api/assets/{id}) to frontend page (/shopdb/pcs/{id})
- Add asset number to email subject line: "Operator Issue Report: {name} ({number})"
- Bump agent to 1.13.5 and tray to 1.6.6 for coordinated release
This commit is contained in:
Proudlock
2026-09-09 09:34:59 -04:00
parent f736089698
commit b1deeda285
3 changed files with 12 additions and 9 deletions

View File

@@ -86,7 +86,9 @@
Font objects tracked and disposed, worker thread joined before client disposal, Font objects tracked and disposed, worker thread joined before client disposal,
Screen.PrimaryScreen null dereference prevented, status check cancellation token Screen.PrimaryScreen null dereference prevented, status check cancellation token
propagated to prevent orphaned HTTP requests. --> propagated to prevent orphaned HTTP requests. -->
<Version>1.6.5</Version> <!-- 1.6.6: coordinated release with agent 1.13.5 (no tray changes).
No tray code changes, but deployed together for version consistency. -->
<Version>1.6.6</Version>
<InvariantGlobalization>true</InvariantGlobalization> <InvariantGlobalization>true</InvariantGlobalization>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained> <SelfContained>true</SelfContained>

View File

@@ -179,7 +179,9 @@
No agent code changes, but deployed together for version consistency. --> No agent code changes, but deployed together for version consistency. -->
<!-- 1.13.4: coordinated release with tray 1.6.5 (resource leak fixes). <!-- 1.13.4: coordinated release with tray 1.6.5 (resource leak fixes).
No agent code changes, but deployed together for version consistency. --> No agent code changes, but deployed together for version consistency. -->
<Version>1.13.4</Version> <!-- 1.13.5: coordinated release with tray 1.6.6 (no tray changes).
No agent code changes, but deployed together for version consistency. -->
<Version>1.13.5</Version>
<InvariantGlobalization>true</InvariantGlobalization> <InvariantGlobalization>true</InvariantGlobalization>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained> <SelfContained>true</SelfContained>

View File

@@ -2960,15 +2960,14 @@ def _send_operator_report_alert(report, asset_id, hostname):
current_app.logger.warning('Cannot send operator report alert: asset %d not found', asset_id) current_app.logger.warning('Cannot send operator report alert: asset %d not found', asset_id)
return return
# Generate absolute URLs # Generate absolute URL to frontend page (not API endpoint)
try: try:
device_url = url_for('assets.get_asset', asset_id=asset_id, _external=True)
except Exception as e:
current_app.logger.error('Failed to generate device URL: %s', e)
# Build absolute URL manually using request context
scheme = request.scheme if request else 'https' scheme = request.scheme if request else 'https'
host = request.host if request else 'localhost' host = request.host if request else 'localhost'
device_url = f'{scheme}://{host}/shopdb/assets/{asset_id}' device_url = f'{scheme}://{host}/shopdb/pcs/{asset_id}'
except Exception as e:
current_app.logger.error('Failed to generate device URL: %s', e)
device_url = f'https://localhost/shopdb/pcs/{asset_id}'
reported_at = report.createdat.strftime('%Y-%m-%d %H:%M:%S UTC') if report.createdat else 'Unknown' reported_at = report.createdat.strftime('%Y-%m-%d %H:%M:%S UTC') if report.createdat else 'Unknown'
@@ -3009,7 +3008,7 @@ def _send_operator_report_alert(report, asset_id, hostname):
</div> </div>
''' '''
subject = f'Operator Issue Report: {safe_name}' subject = f'Operator Issue Report: {safe_name} ({safe_assetnumber})'
current_app.logger.info('Sending operator report alert for %s (report %d)', current_app.logger.info('Sending operator report alert for %s (report %d)',
hostname, report.operatorreportid) hostname, report.operatorreportid)