Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions emhttp/plugins/dynamix/UserOnboarding.page
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Menu="UserPreferences:z"
Type="xmenu"
Title="Onboarding Wizard"
Icon="magic"
Tag="map-signs"
---
<?php
/* Copyright 2005-2025, Lime Technology
* Copyright 2012-2025, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<script>
function openOnboardingWizard() {
window.location.href = window.location.pathname + '?onboarding=open';
}
Comment on lines +20 to +22

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify whether the onboarding query parameter is consumed anywhere outside this new page.
# Expected: at least one hit that reads/acts on `onboarding` or `onboarding=open`.
# If the only matches are this file, clicking the button just reloads the current page.

rg -n -C2 'onboarding=open|\bonboarding\b|openOnboardingWizard\s*\(' .

Repository: unraid/webgui

Length of output: 1551


openOnboardingWizard() is non-functional—the query parameter is never consumed.

The function reloads the current page with ?onboarding=open, but no code in the repository reads or acts on this parameter. The button needs to either be removed or properly implemented to open the actual wizard interface.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@emhttp/plugins/dynamix/UserOnboarding.page` around lines 20 - 22,
openOnboardingWizard currently just reloads the page with ?onboarding=open but
nothing reads that parameter; either remove the unused button or implement
parameter handling so the wizard actually opens. Add code to run on page load
(e.g., in the module initialization) that checks new
URLSearchParams(window.location.search).get('onboarding') === 'open' and then
calls the real wizard entry point (e.g., showOnboardingWizard or
startOnboardingWizard) or dispatches the event that opens the onboarding modal;
alternatively, remove openOnboardingWizard and the button that calls it if no
wizard entrypoint exists.

</script>

<form markdown="1" name="user_onboarding_settings">
_(Onboarding Wizard)_:
: <span class="inline-block">
<input type="button" value="_(Show Onboarding Wizard)_" onclick="openOnboardingWizard()" <?if (_var($var,'fsState')=="Started"):?>disabled<?endif;?>>
<input type="button" value="_(Done)_" onclick="done()">
</span>

: _(Launch the onboarding wizard to customize your server and set up an internal boot drive)_.

<?if (_var($var,'fsState')=="Started"):?>
: <small>_(Array must be stopped to open the onboarding wizard)_.</small>
Comment on lines +25 to +35

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Gate the wizard on Stopped, not just Started.

Line 28 and Line 34 only special-case fsState == "Started", but emhttp/plugins/dynamix/include/Boot.php:55-67 shows other non-stopped states (Starting, Stopping, and the default branch for active states such as Formatting). As written, the wizard stays enabled during those states even though the UI message says the array must be stopped.

Suggested fix
 <form markdown="1" name="user_onboarding_settings">
+<?$arrayStopped = _var($var,'fsState')=="Stopped";?>
 _(Onboarding Wizard)_:
 : <span class="inline-block">
-  <input type="button" value="_(Show Onboarding Wizard)_" onclick="openOnboardingWizard()" <?if (_var($var,'fsState')=="Started"):?>disabled<?endif;?>>
+  <input type="button" value="_(Show Onboarding Wizard)_" onclick="openOnboardingWizard()" <?if (!$arrayStopped):?>disabled<?endif;?>>
   <input type="button" value="_(Done)_" onclick="done()">
   </span>
 
 : _(Launch the onboarding wizard to customize your server and set up an internal boot drive)_.
 
-<?if (_var($var,'fsState')=="Started"):?>
+<?if (!$arrayStopped):?>
 : <small>_(Array must be stopped to open the onboarding wizard)_.</small>
 <?endif;?>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<form markdown="1" name="user_onboarding_settings">
_(Onboarding Wizard)_:
: <span class="inline-block">
<input type="button" value="_(Show Onboarding Wizard)_" onclick="openOnboardingWizard()" <?if (_var($var,'fsState')=="Started"):?>disabled<?endif;?>>
<input type="button" value="_(Done)_" onclick="done()">
</span>
: _(Launch the onboarding wizard to customize your server and set up an internal boot drive)_.
<?if (_var($var,'fsState')=="Started"):?>
: <small>_(Array must be stopped to open the onboarding wizard)_.</small>
<form markdown="1" name="user_onboarding_settings">
<?$arrayStopped = _var($var,'fsState')=="Stopped";?>
_(Onboarding Wizard)_:
: <span class="inline-block">
<input type="button" value="_(Show Onboarding Wizard)_" onclick="openOnboardingWizard()" <?if (!$arrayStopped):?>disabled<?endif;?>>
<input type="button" value="_(Done)_" onclick="done()">
</span>
: _(Launch the onboarding wizard to customize your server and set up an internal boot drive)_.
<?if (!$arrayStopped):?>
: <small>_(Array must be stopped to open the onboarding wizard)_.</small>
<?endif;?>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@emhttp/plugins/dynamix/UserOnboarding.page` around lines 25 - 35, The
onboarding wizard buttons and message currently only check fsState == "Started";
change the logic to enable the "Show Onboarding Wizard" button only when fsState
== "Stopped" and disable it (and show the "Array must be stopped" small text)
for any other state (e.g., "Starting", "Stopping", "Formatting", etc.). Update
the input element with onclick="openOnboardingWizard()" to use a condition like
<?if (_var($var,'fsState')!="Stopped"):?>disabled<?endif;?> and change the
conditional that renders the <small> warning to <?if
(_var($var,'fsState')!="Stopped"):?> so the guard consistently references
fsState == "Stopped" for enabling/disabling the wizard and showing the warning
(affecting the elements tied to openOnboardingWizard and the warning message).

<?endif;?>

</form>
2 changes: 1 addition & 1 deletion emhttp/plugins/dynamix/UserPreferences.page
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Menu="Settings:3"
Type="menu"
Title="User Preferences"
Tag="star"
Tag="star"
Loading