Files
webgui/plugins/dynamix/NewConfig.page

86 lines
3.2 KiB
Plaintext

Menu="UNRAID-OS"
Title="New Config"
Icon="icon-config"
Tag="cog"
---
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, 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.
*/
?>
<?
$newarray = $var['mdState']=='NEW_ARRAY';
$disabled = $var['fsState']=="Started";
$width = [166,300];
if ($newarray) {
@unlink('/boot/config/smart-one.cfg');
@unlink('/boot/config/smart-all.cfg');
@unlink('/boot/config/plugins/dynamix/monitor.ini');
@unlink('/var/tmp/cache_log.tmp');
}
?>
<style>
span.indent{display:inline-block;width:240px;margin-top:11px;}
</style>
<script>
function prepareNewConfig(form) {
for (var i=1,item; item=form.preset.options[i]; i++) {
switch (item.value) {
case 'parity': if (item.selected) form.preserveParity.disabled = false; break;
case 'data' : if (item.selected) form.preserveData.disabled = false; break;
case 'cache' : if (item.selected) form.preserveCache.disabled = false; break;
}
}
form.preset.disabled = true;
}
$(function() {
$('#s1').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>, firstItemChecksAll:true, explicitClose:'...close'});
<?if ($disabled):?>
$('#s1').dropdownchecklist('disable');
<?endif;?>
});
</script>
This is a utility to reset the array disk configuration so that all disks appear as "New" disks, as
if it were a fresh new server.
This is useful when you have added or removed multiple drives and wish to rebuild parity based on
the new configuration.
Use the *'Preserve current assignments'* selection to populate the desired disk slots ***after*** the array has been reset. By default **no** disk slots are populated.
**DO NOT USE THIS UTILITY THINKING IT WILL REBUILD A FAILED DRIVE** - it will have the opposite
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)">
<input type="hidden" name="preserveParity" value="yes" disabled>
<input type="hidden" name="preserveData" value="yes" disabled>
<input type="hidden" name="preserveCache" value="yes" disabled>
<span class="indent">Preserve current assignments:</span>
<select id="s1" name="preset" size="1" multiple="multiple" style="display:none">
<option value=''>All</option>
<?=mk_option_check(0,'parity','Parity slots')?>
<?=mk_option_check(0,'data','Data slots')?>
<?=mk_option_check(0,'cache','Cache slots')?>
</select>
<br>
<span class="indent"><input type="submit" class="lock" name="cmdInit" value="Apply" disabled><input type="button" class="lock" value="Done" onclick="done()"></span>
<?if ($newarray):?>
Array has been <span class='strong big'>Reset</span> (please configure)
<?elseif ($disabled):?>
Array must be <span class='strong big'>Stopped</span>
<?else:?>
<input type="checkbox" onClick="cmdInit.disabled=!this.checked"><small>Yes I want to do this</small>
<?endif;?>
</form>