allow to add documentation on containers

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-10-03 20:30:46 +02:00
parent ec6448fe5f
commit c1c96ee08a
10 changed files with 30 additions and 4 deletions

View file

@ -108,6 +108,10 @@
"type": "string",
"pattern": "^([a-z0-9.-]+|%AIO_CHANNEL%)$"
},
"documentation": {
"type": "string",
"pattern": "^https://.*$"
},
"devices": {
"type": "array",
"items": {

View file

@ -35,6 +35,7 @@ class Container {
private bool $init;
private string $imageTag;
private AioVariables $aioVariables;
private string $documentation;
private DockerActionManager $dockerActionManager;
public function __construct(
@ -60,6 +61,7 @@ class Container {
bool $init,
string $imageTag,
AioVariables $aioVariables,
string $documentation,
DockerActionManager $dockerActionManager
) {
$this->identifier = $identifier;
@ -84,6 +86,7 @@ class Container {
$this->init = $init;
$this->imageTag = $imageTag;
$this->aioVariables = $aioVariables;
$this->documentation = $documentation;
$this->dockerActionManager = $dockerActionManager;
}
@ -193,4 +196,8 @@ class Container {
public function GetAioVariables() : AioVariables {
return $this->aioVariables;
}
public function GetDocumentation() : string {
return $this->documentation;
}
}

View file

@ -304,6 +304,11 @@ class ContainerDefinitionFetcher
$imageTag = $entry['image_tag'];
}
$documentation = '';
if (isset($entry['documentation'])) {
$documentation = $entry['documentation'];
}
$containers[] = new Container(
$entry['container_name'],
$displayName,
@ -327,6 +332,7 @@ class ContainerDefinitionFetcher
$init,
$imageTag,
$aioVariables,
$documentation,
$this->container->get(DockerActionManager::class)
);
}

View file

@ -255,15 +255,19 @@
{% for container in containers %}
{% if container.GetDisplayName() != '' %}
<li>
{% set displayName = container.GetDisplayName() %}
{% if container.GetDocumentation() != '' %}
{% set displayName = '<a href="' ~ container.GetDocumentation() ~ '">' ~ displayName ~ '</a>' %}
{% endif %}
{% if class(container.GetStartingState()) == 'AIO\\Container\\State\\StartingState' %}
<span class="status running"></span>
<span>{{container.GetDisplayName()}} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Starting</a>)</span>
<span>{{ displayName }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Starting</a>)</span>
{% elseif class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %}
<span class="status success"></span>
<span>{{container.GetDisplayName()}} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Running</a>)</span>
<span>{{ displayName }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Running</a>)</span>
{% else %}
<span class="status error"></span>
<span>{{container.GetDisplayName()}} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Stopped</a>)</span>
<span>{{ displayName }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}">Stopped</a>)</span>
{% endif %}
</li>
{% endif %}