Skip to content

Commit cae8e87

Browse files
committed
Add option to change project folder location
1 parent 16e0875 commit cae8e87

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

source/compose.manager/compose.manager.settings.page

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ $ui_unpatch_button_type = (strcmp($cfg['PATCH_UI'],"false") == 0 && isset($compo
1313

1414
$option_patch_ui = version_compare(parse_ini_file('/etc/unraid-version')['version'],'6.12.0-RC0', '>=');
1515
$ui_patch_help_class = $option_patch_ui ? "hidden" : "inline_help";
16+
17+
$projects_exist = intval(shell_exec("ls -l ".$compose_root." | grep ^d | wc -l")) != 0;
1618
?>
1719
<style>
1820
<?php
@@ -36,11 +38,42 @@ function unpatchWebui() {
3638
window.location.reload();
3739
})
3840
}
41+
42+
function checkProjectFolder() {
43+
var projects_folder_not_empty = <?php echo json_encode($projects_exist); ?>;
44+
var original_folder = "<?php echo $cfg['PROJECTS_FOLDER'] ?>";
45+
46+
if(projects_folder_not_empty & ($(this).val() != original_folder))
47+
{
48+
$("#PROJECTS_FOLDER_WARNING").show();
49+
}
50+
else
51+
{
52+
$("#PROJECTS_FOLDER_WARNING").hide();
53+
}
54+
}
55+
56+
$(function() {
57+
$('#PROJECTS_FOLDER').on("input", null, null, checkProjectFolder);
58+
});
59+
3960
</script>
4061

4162
<form markdown="1" name="compose_manager_settings" method="POST" action="/update.php" target="progressFrame">
4263
<input type="hidden" name="#file" value="<?=$sName?>/<?=$sName?>.cfg">
4364

65+
_(Compose Project Directory)_:
66+
: <input type="text" name="PROJECTS_FOLDER" id="PROJECTS_FOLDER" autocomplete="off" spellcheck="false" value="<?=$cfg['PROJECTS_FOLDER']?>" placeholder="_(e.g.)_ /mnt/user/appdata/compose_projects" data-pickcloseonfile="true" data-pickfilter="img" data-pickroot="/mnt" data-pickfolders="true" required pattern="^\/(mnt\/.+\/.+)||(\/boot\/config\/plugins\/compose\.manager\/projects)$">
67+
<a class='info nohand' id="PROJECTS_FOLDER_WARNING" onclick="HelpButton();return false;" style="display: none;">
68+
<i class='fa fa-warning orb yellow-orb'></i>
69+
<span style='left:18px'><strong>Projects exist that will not be moved to the new project folder.</strong></span>
70+
</a>
71+
72+
<blockquote class="inline_help" id="PROJECTS_FOLDER_HELP" style="display: none;">
73+
Choose the folder in which compose.manager will store your stacks.<br>
74+
<strong>WARNING: Changing this path will not automatically move your existing project folders.</strong>
75+
</blockquote>
76+
4477
_(Compose Command Progress Display)_:
4578
: <select name="OUTPUTSTYLE">
4679
<?=mk_option($cfg['OUTPUTSTYLE'], "basic", _("Basic"))?>

0 commit comments

Comments
 (0)