feat: Add 'Show Onboarding Wizard' button to the ArrayOperation page.#2567
Conversation
- Purpose: disable the onboarding wizard action while the array is online. - Before: the Array Operation page kept the onboarding button clickable after the array was started. - Why: launching onboarding while the array is online should be blocked and the UI did not reflect that restriction. - What: render the Show Onboarding Wizard button as disabled whenever fsState is Started. - How: reuse the existing Array Operation page fsState check directly in the button markup.
WalkthroughA new Onboarding Wizard UI page was added at Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@emhttp/plugins/dynamix/ArrayOperation.page`:
- Line 905: The Show Onboarding Wizard button currently disables only when the
array fsState equals "Started"; update the disable gate on that input element in
ArrayOperation.page so it is disabled whenever fsState is not "Stopped" (i.e.,
allow the button only when the array is fully stopped). Locate the conditional
that reads the _var($var,'fsState') check for "Started" on the input and replace
it so the input is disabled for any fsState value other than "Stopped".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0fadfc80-3753-4ddf-af65-52f07a104598
📒 Files selected for processing (1)
emhttp/plugins/dynamix/ArrayOperation.page
| <tr><td></td><td><span class="buttons-spaced"><input type="button" name="reboot" value="_(Reboot)_" onclick="shutdown_now(this.form,'reboot')"><input type="button" name="shutdown" value="_(Shutdown)_" onclick="shutdown_now(this.form,'shutdown')"></span></td> | ||
| <td>**_(Reboot)_** _(will activate a *clean* system reset)_.<br>**_(Shutdown)_** _(will activate a *clean* system power down)_.<br><label class="flex flex-row items-center gap-2"><input type="checkbox" name="safemode">_(Reboot in safe mode)_</label></td></tr> | ||
| <tr><td></td><td class="line" colspan="2"></td></tr> | ||
| <tr><td></td><td><input type="button" value="_(Show Onboarding Wizard)_" onclick="window.location.href=window.location.pathname+'?onboarding=open'" <?if (_var($var,'fsState')=="Started"):?>disabled<?endif;?>></td> |
There was a problem hiding this comment.
Broaden the disable gate beyond Started.
Line 905 only blocks the wizard for fsState == "Started", so it stays clickable during other non-offline states like Starting, Stopping, Formatting, Copying, and Clearing. This page already uses fsState != "Stopped" for similar controls, and emhttp/plugins/dynamix/include/Boot.php:91-109 shows those states are valid. Please gate this action on the array being fully stopped instead.
Suggested fix
- <tr><td></td><td><input type="button" value="_(Show Onboarding Wizard)_" onclick="window.location.href=window.location.pathname+'?onboarding=open'" <?if (_var($var,'fsState')=="Started"):?>disabled<?endif;?>></td>
+ <tr><td></td><td><input type="button" value="_(Show Onboarding Wizard)_" onclick="window.location.href=window.location.pathname+'?onboarding=open'" <?if (_var($var,'fsState')!="Stopped"):?>disabled<?endif;?>></td>📝 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.
| <tr><td></td><td><input type="button" value="_(Show Onboarding Wizard)_" onclick="window.location.href=window.location.pathname+'?onboarding=open'" <?if (_var($var,'fsState')=="Started"):?>disabled<?endif;?>></td> | |
| <tr><td></td><td><input type="button" value="_(Show Onboarding Wizard)_" onclick="window.location.href=window.location.pathname+'?onboarding=open'" <?if (_var($var,'fsState')!="Stopped"):?>disabled<?endif;?>></td> |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@emhttp/plugins/dynamix/ArrayOperation.page` at line 905, The Show Onboarding
Wizard button currently disables only when the array fsState equals "Started";
update the disable gate on that input element in ArrayOperation.page so it is
disabled whenever fsState is not "Stopped" (i.e., allow the button only when the
array is fully stopped). Locate the conditional that reads the
_var($var,'fsState') check for "Started" on the input and replace it so the
input is disabled for any fsState value other than "Stopped".
…from Array Operations.
Removed FAQ section placeholder from UserOnboarding.page.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@emhttp/plugins/dynamix/UserOnboarding.page`:
- Around line 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).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 56324745-9906-422e-ba63-fcbb8780fa38
📒 Files selected for processing (2)
emhttp/plugins/dynamix/UserOnboarding.pageemhttp/plugins/dynamix/UserPreferences.page
✅ Files skipped from review due to trivial changes (1)
- emhttp/plugins/dynamix/UserPreferences.page
| <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> |
There was a problem hiding this comment.
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.
| <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).
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@emhttp/plugins/dynamix/UserOnboarding.page`:
- Around line 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.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 53e2cf7c-7004-423d-bdfd-ca9d1c431776
📒 Files selected for processing (1)
emhttp/plugins/dynamix/UserOnboarding.page
| function openOnboardingWizard() { | ||
| window.location.href = window.location.pathname + '?onboarding=open'; | ||
| } |
There was a problem hiding this comment.
🧩 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.
🧹 PR Test Plugin Cleaned UpThe test plugin and associated files for this PR have been removed from the preview environment. 🤖 This comment is automatically generated when a PR is closed. |
Summary by CodeRabbit