fix(admin/view): define basePath in plugin IIFE scopes (#9298)

The plugin.templ and plugin_lane.templ components use basePath() in their IIFE
(Immediately Invoked Function Expression) scopes to handle subdirectory
deployments. However, basePath was not defined locally, causing "basePath is
not defined" errors when accessing plugin pages.

Added local basePath function definitions in both files, matching the pattern
from admin.js. This function checks window.__BASE_PATH__ (set by the layout
during page initialization) and prepends it to API paths.
This commit is contained in:
Chris Lu 2026-05-01 18:22:39 -07:00 committed by GitHub
parent 913f98db10
commit f2c3bd7b77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 2 deletions

View File

@ -597,6 +597,10 @@ templ Plugin(page string, initialJob string, lane string) {
var pluginLane = String(page.getAttribute('data-plugin-lane') || '').trim();
function basePath(path) {
return (window.__BASE_PATH__ || '') + path;
}
var state = {
selectedJobType: '',
jobTypes: [],

View File

@ -80,6 +80,10 @@ templ PluginLane(page string, lane string) {
const lane = page.dataset.pluginLane || '';
if (!lane) return;
function basePath(path) {
return (window.__BASE_PATH__ || '') + path;
}
function fetchAndRender(url, containerId, renderFn) {
fetch(basePath(url))
.then(r => r.json())

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long