mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
fix showing community containers in the AIO interface and enabling or disabling them
Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
parent
0fe4ea3238
commit
8a6772bc05
4 changed files with 18 additions and 21 deletions
|
|
@ -1,12 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace AIO\Container;
|
|
||||||
|
|
||||||
readonly class CommunityContainer {
|
|
||||||
public function __construct(
|
|
||||||
string $id,
|
|
||||||
string $name,
|
|
||||||
string $documentation,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -126,7 +126,17 @@ readonly class ConfigurationController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($request->getParsedBody()['community-form'])) {
|
if (isset($request->getParsedBody()['community-form'])) {
|
||||||
$this->configurationManager->SetEnabledCommunityContainers($request->getParsedBody()['enabled-community'] ?? []);
|
$cc = $this->configurationManager->listAvailableCommunityContainers();
|
||||||
|
$enabledCC = [];
|
||||||
|
/**
|
||||||
|
* @psalm-suppress PossiblyNullIterator
|
||||||
|
*/
|
||||||
|
foreach ($request->getParsedBody() as $item) {
|
||||||
|
if (array_key_exists($item , $cc)) {
|
||||||
|
$enabledCC[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->configurationManager->SetEnabledCommunityContainers($enabledCC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($request->getParsedBody()['delete_collabora_dictionaries'])) {
|
if (isset($request->getParsedBody()['delete_collabora_dictionaries'])) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
namespace AIO\Data;
|
namespace AIO\Data;
|
||||||
|
|
||||||
use AIO\Auth\PasswordGenerator;
|
use AIO\Auth\PasswordGenerator;
|
||||||
use AIO\Container\CommunityContainer;
|
|
||||||
use AIO\Controller\DockerController;
|
use AIO\Controller\DockerController;
|
||||||
|
|
||||||
class ConfigurationManager
|
class ConfigurationManager
|
||||||
|
|
@ -1018,7 +1017,6 @@ class ConfigurationManager
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @return list<CommunityContainer> */
|
|
||||||
public function listAvailableCommunityContainers() : array {
|
public function listAvailableCommunityContainers() : array {
|
||||||
$cc = [];
|
$cc = [];
|
||||||
$dir = scandir(DataConst::GetCommunityContainersDirectory());
|
$dir = scandir(DataConst::GetCommunityContainersDirectory());
|
||||||
|
|
@ -1036,15 +1034,16 @@ class ConfigurationManager
|
||||||
apcu_add($filePath, $fileContents);
|
apcu_add($filePath, $fileContents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$json = is_string($fileContents) ? json_decode($fileContents) : false;
|
$json = is_string($fileContents) ? json_decode($fileContents, true) : false;
|
||||||
if(is_array($json) && is_array($json['aio_services_v1'])) {
|
if(is_array($json) && is_array($json['aio_services_v1'])) {
|
||||||
foreach ($json['aio_services_v1'] as $service) {
|
foreach ($json['aio_services_v1'] as $service) {
|
||||||
$documentation = is_string($service['documentation']) ? $service['documentation'] : '';
|
$documentation = is_string($service['documentation']) ? $service['documentation'] : '';
|
||||||
if (is_string($service['display_name'])) {
|
if (is_string($service['display_name'])) {
|
||||||
$cc[] = new CommunityContainer(
|
$cc[$id] = [
|
||||||
$id,
|
'id' => $id,
|
||||||
$service['display_name'],
|
'name' => $service['display_name'],
|
||||||
$documentation);
|
'documentation' => $documentation
|
||||||
|
];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
<p>
|
<p>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="enabled-community[]"
|
id="{{ cc.id }}"
|
||||||
value="{{ cc.id }}"
|
value="{{ cc.id }}"
|
||||||
name="{{ cc.id }}"
|
name="{{ cc.id }}"
|
||||||
{% if cc.id in community_containers_enabled %}
|
{% if cc.id in community_containers_enabled %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue