add fulltextsearch as option

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-08-22 13:04:44 +02:00
parent 2ba61b8971
commit 8010030a5d
17 changed files with 155 additions and 3 deletions

View file

@ -3,6 +3,7 @@
{
"identifier": "nextcloud-aio-apache",
"dependsOn": [
"nextcloud-aio-fulltextsearch",
"nextcloud-aio-onlyoffice",
"nextcloud-aio-collabora",
"nextcloud-aio-clamav",
@ -144,7 +145,9 @@
"TALK_PORT=%TALK_PORT%",
"IMAGINARY_ENABLED=%IMAGINARY_ENABLED%",
"IMAGINARY_HOST=nextcloud-aio-imaginary",
"PHP_UPLOAD_LIMIT=%NEXTCLOUD_UPLOAD_LIMIT%"
"PHP_UPLOAD_LIMIT=%NEXTCLOUD_UPLOAD_LIMIT%",
"FULLTEXTSEARCH_ENABLED=%FULLTEXTSEARCH_ENABLED%",
"FULLTEXTSEARCH_HOST=nextcloud-aio-fulltextsearch"
],
"maxShutdownTime": 10,
"restartPolicy": "unless-stopped"
@ -388,6 +391,31 @@
"secrets": [],
"maxShutdownTime": 10,
"restartPolicy": "unless-stopped"
},
{
"identifier": "nextcloud-aio-fulltextsearch",
"dependsOn": [],
"displayName": "Fulltextsearch",
"containerName": "nextcloud/aio-fulltextsearch",
"ports": [],
"internalPorts": [
"9200"
],
"environmentVariables": [
"TZ=%TIMEZONE%",
"discovery.type=single-node",
"ES_JAVA_OPTS=-Xms1024M -Xmx1024M"
],
"volumes": [
{
"name": "nextcloud_aio_elasticsearch",
"location": "/usr/share/elasticsearch/data",
"writeable": true
}
],
"secrets": [],
"maxShutdownTime": 10,
"restartPolicy": "unless-stopped"
}
]
}

View file

@ -0,0 +1,5 @@
document.addEventListener("DOMContentLoaded", function(event) {
// Fulltextsearch
var fulltextsearch = document.getElementById("fulltextsearch");
fulltextsearch.disabled = true;
});

View file

@ -103,6 +103,7 @@ $app->get('/containers', function ($request, $response, $args) use ($container)
'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(),
'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(),
'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled(),
'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled(),
]);
})->setName('profile');
$app->get('/login', function ($request, $response, $args) use ($container) {

View file

@ -27,4 +27,8 @@ document.addEventListener("DOMContentLoaded", function(event) {
// Imaginary
var imaginary = document.getElementById("imaginary");
imaginary.addEventListener('change', makeOptionsFormSubmitVisible);
// Fulltextsearch
var fulltextsearch = document.getElementById("fulltextsearch");
fulltextsearch.addEventListener('change', makeOptionsFormSubmitVisible);
});

View file

@ -69,6 +69,10 @@ class ContainerDefinitionFetcher
if (!$this->configurationManager->isImaginaryEnabled()) {
continue;
}
} elseif ($entry['identifier'] === 'nextcloud-aio-fulltextsearch') {
if (!$this->configurationManager->isFulltextsearchEnabled()) {
continue;
}
}
$ports = new ContainerPorts();
@ -154,6 +158,10 @@ class ContainerDefinitionFetcher
if (!$this->configurationManager->isImaginaryEnabled()) {
continue;
}
} elseif ($value === 'nextcloud-aio-fulltextsearch') {
if (!$this->configurationManager->isFulltextsearchEnabled()) {
continue;
}
}
$dependsOn[] = $value;
}

View file

@ -95,6 +95,11 @@ class ConfigurationController
} else {
$this->configurationManager->SetImaginaryEnabledState(0);
}
if (isset($request->getParsedBody()['fulltextsearch'])) {
$this->configurationManager->SetFulltextsearchEnabledState(1);
} else {
$this->configurationManager->SetFulltextsearchEnabledState(0);
}
}
if (isset($request->getParsedBody()['delete_collabora_dictionaries'])) {

View file

@ -154,6 +154,21 @@ class ConfigurationManager
$this->WriteConfig($config);
}
public function isFulltextsearchEnabled() : bool {
$config = $this->GetConfig();
if (isset($config['isFulltextsearchEnabled']) && $config['isFulltextsearchEnabled'] === 1) {
return true;
} else {
return false;
}
}
public function SetFulltextsearchEnabledState(int $value) : void {
$config = $this->GetConfig();
$config['isFulltextsearchEnabled'] = $value;
$this->WriteConfig($config);
}
public function isOnlyofficeEnabled() : bool {
$config = $this->GetConfig();
if (isset($config['isOnlyofficeEnabled']) && $config['isOnlyofficeEnabled'] === 1) {

View file

@ -304,6 +304,12 @@ class DockerActionManager
} else {
$replacements[1] = '';
}
} elseif ($out[1] === 'FULLTEXTSEARCH_ENABLED') {
if ($this->configurationManager->isFulltextsearchEnabled()) {
$replacements[1] = 'yes';
} else {
$replacements[1] = '';
}
} elseif ($out[1] === 'NEXTCLOUD_UPLOAD_LIMIT') {
$replacements[1] = $this->configurationManager->GetNextcloudUploadLimit();
} elseif ($out[1] === 'NEXTCLOUD_MAX_TIME') {

View file

@ -452,6 +452,11 @@
{% else %}
<input type="checkbox" id="collabora" name="collabora"><label for="collabora">Collabora (Nextcloud Office)</label><br>
{% endif %}
{% if is_fulltextsearch_enabled == true %}
<input type="checkbox" id="fulltextsearch" name="fulltextsearch" checked="checked"><label for="fulltextsearch">Fulltextsearch (needs ~1GB additional RAM)</label><br>
{% else %}
<input type="checkbox" id="fulltextsearch" name="fulltextsearch"><label for="fulltextsearch">Fulltextsearch (needs ~1GB additional RAM)</label><br>
{% endif %}
{% if is_imaginary_enabled == true %}
<input type="checkbox" id="imaginary" name="imaginary" checked="checked"><label for="imaginary">Imaginary</label><br>
{% else %}
@ -469,7 +474,7 @@
{% endif %}
<input id="options-form-submit" class="button" type="submit" value="Save changes" />
</form>
<b>Minimal system requirements:</b> When any optional addon is enabled, at least 2GB RAM, a dual-core CPU and 40GB system storage are required. When enabling ClamAV, at least 3GB RAM are required. Recommended are at least 4GB of RAM.<br><br>
<b>Minimal system requirements:</b> When any optional addon is enabled, at least 2GB RAM, a dual-core CPU and 40GB system storage are required. When enabling ClamAV or Fulltextsearch, at least 3GB RAM are required. When enabling everything, at least 4GB RAM are required. Recommended are at least 1GB more RAM than the minimal requirement.<br><br>
{% if isAnyRunning == true or is_x64_platform == false %}
<script type="text/javascript" src="disable-clamav.js"></script>
<script type="text/javascript" src="disable-onlyoffice.js"></script>
@ -478,6 +483,7 @@
<script type="text/javascript" src="disable-talk.js"></script>
<script type="text/javascript" src="disable-collabora.js"></script>
<script type="text/javascript" src="disable-imaginary.js"></script>
<script type="text/javascript" src="disable-fulltextsearch.js"></script>
{% endif %}
{% if is_collabora_enabled == true and isAnyRunning == false and was_start_button_clicked == true %}