mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Merge branch 'dev' of https://github.com/bunkerity/bunkerweb into dev
This commit is contained in:
commit
f32321cbc7
2 changed files with 26 additions and 0 deletions
|
|
@ -330,6 +330,7 @@ def run_action(plugin: str, function_name: str = ""):
|
|||
if tmp_dir:
|
||||
sys_path.pop()
|
||||
rmtree(tmp_dir, ignore_errors=True)
|
||||
|
||||
app.logger.exception("An error occurred while importing the plugin")
|
||||
return {"status": "ko", "code": 500, "message": "An error occurred while importing the plugin, see logs for more details"}
|
||||
|
||||
|
|
@ -359,6 +360,7 @@ def run_action(plugin: str, function_name: str = ""):
|
|||
sys_path.pop()
|
||||
rmtree(tmp_dir, ignore_errors=True)
|
||||
|
||||
app.logger.exception(message)
|
||||
if message or not isinstance(res, dict) and not res:
|
||||
return {"status": "ko", "code": 500, "message": message or "The plugin did not return a valid response"}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,6 +82,30 @@ class Ping {
|
|||
|
||||
// Key of fetch data need to match key of this.data
|
||||
updateEl(data) {
|
||||
// Show error
|
||||
if (data?.error) {
|
||||
const error = data?.error || "Action exception, no details available";
|
||||
console.log(error);
|
||||
// Remove previous data-action-error
|
||||
const prevError = document.querySelectorAll("[data-action-error]");
|
||||
if (prevError.length) prevError.forEach((el) => el.remove());
|
||||
// Add this one
|
||||
const error_html = `<div data-action-error class="core-layout-separator"></div>
|
||||
<div data-action-error class="my-2 flex justify-center col-span-12">
|
||||
<div class="mr-1">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6 stroke-red-500 fill-white">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
||||
</svg>
|
||||
</div>
|
||||
<p class="px-1 text-white break-words">(Action error) ${error}</p>
|
||||
</div>
|
||||
`;
|
||||
// add HTML at the end of .core-layout
|
||||
document
|
||||
.querySelector("div.core-layout")
|
||||
.insertAdjacentHTML("beforeend", error_html);
|
||||
}
|
||||
|
||||
try {
|
||||
const successValues = [
|
||||
"success",
|
||||
|
|
|
|||
Loading…
Reference in a new issue