fix(admin): wrap plugin URLs with basePath for subdir deployments

Two more spots that broke under a subdirectory deployment:

- plugin.templ pluginRequest() called fetch(url) with relative API
  paths from 14+ callers; wrap once inside the helper so they all
  honor window.__BASE_PATH__.
- plugin_lane.templ generated <a href="/plugin/configuration?job=...">
  with an absolute path; wrap with basePath() so the link stays
  inside the deployment prefix.

Follow-up to a6adf530c.
This commit is contained in:
Chris Lu 2026-04-27 09:04:12 -07:00
parent 3ea489d013
commit fa492a9eed
4 changed files with 8 additions and 8 deletions

View File

@ -677,7 +677,7 @@ templ Plugin(page string, initialJob string, lane string) {
}
}
var response = await fetch(url, requestOptions);
var response = await fetch(basePath(url), requestOptions);
var data = await readResponseJSON(response);
if (!response.ok) {
var message = (data && (data.error || data.message)) ? (data.error || data.message) : ('Request failed: ' + response.status);

View File

@ -125,7 +125,7 @@ templ PluginLane(page string, lane string) {
let html = '<table class="table table-sm table-hover mb-0"><thead><tr><th>Job Type</th><th>Enabled</th><th>Concurrency</th><th>Detection Interval</th><th>Status</th></tr></thead><tbody>';
filtered.forEach(s => {
html += '<tr>';
html += '<td><a href="/plugin/configuration?job=' + s.job_type + '">' + s.job_type + '</a></td>';
html += '<td><a href="' + basePath('/plugin/configuration?job=' + s.job_type) + '">' + s.job_type + '</a></td>';
html += '<td>' + (s.enabled ? '<span class="badge bg-success">Yes</span>' : '<span class="badge bg-secondary">No</span>') + '</td>';
html += '<td>' + (s.global_execution_concurrency || 1) + '</td>';
html += '<td>' + (s.detection_interval_seconds || '-') + 's</td>';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long