mirror of
https://github.com/unraid/webgui.git
synced 2026-03-10 21:10:01 -05:00
Fix possible 'race condition' when populating slots after a "new array" execution
It might happen that an array reset occurs before the "retain" list is created, resulting in an empty list. There is one open point: When the form is submitted and the page returns then $var['mdState'] variable isn't updated yet by emhttp, this only occurs after a full page reload or page switch. As a result the GUI doesn't show the correct message after pressing Apply. Is there a way to let emhttp update the $var variable before returning the page?
This commit is contained in:
@@ -33,7 +33,7 @@ function prepareNewConfig(form) {
|
||||
}
|
||||
}
|
||||
// set preset filter to populate slots
|
||||
$.post('/webGui/include/PrepareDisks.php',{preset:preset});
|
||||
$.post('/webGui/include/PrepareDisks.php',{preset:preset},function(){form.submit();});
|
||||
}
|
||||
<?if (file_exists('/var/tmp/disks.ini')):?>
|
||||
function assign(id,disk) {
|
||||
@@ -67,7 +67,8 @@ Use the *'Retain current configuration'* selection to populate the desired disk
|
||||
effect of making it ***impossible*** to rebuild an existing failed drive - you have been warned!
|
||||
|
||||
<hr>
|
||||
<form name="newConfig" method="POST" action="/update.htm" target="progressFrame" onsubmit="prepareNewConfig(this)">
|
||||
<form name="newConfig" method="POST" action="/update.htm" target="progressFrame">
|
||||
<input type="hidden" name="cmdInit" value="Apply">
|
||||
<span class="indent">Retain current configuration:</span>
|
||||
<select id="s1" name="preset" size="1" multiple="multiple" style="display:none">
|
||||
<option value=''>All</option>
|
||||
@@ -76,10 +77,10 @@ effect of making it ***impossible*** to rebuild an existing failed drive - you h
|
||||
<?=mk_option_check(0,'Cache','Cache slots')?>
|
||||
</select>
|
||||
<br>
|
||||
<span class="indent"><input type="submit" name="cmdInit" value=" Apply " disabled><input type="button" value=" Done " onclick="done()"></span>
|
||||
<span class="indent"><input type="button" name="apply" value=" Apply " onclick="prepareNewConfig(this.form)" disabled><input type="button" value=" Done " onclick="done()"></span>
|
||||
<?if ($disabled):?>
|
||||
<?=$newarray ? 'Array has been <b>RESET</b> (please configure)' : 'Array must be <b>STOPPED</b>'?>
|
||||
<?else:?>
|
||||
<input type="checkbox" onClick="cmdInit.disabled=!this.checked"><small>Yes I want to do this</small>
|
||||
<input type="checkbox" onClick="apply.disabled=!this.checked"><small>Yes I want to do this</small>
|
||||
<?endif;?>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user