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:
parent
913f98db10
commit
f2c3bd7b77
@ -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: [],
|
||||
|
||||
@ -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
Loading…
Reference in New Issue
Block a user