mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 09:14:08 +02:00
Add icingadb as OR dependecy
Add only if the given module supports icingadb and has monitoring as a requirement
This commit is contained in:
parent
703956c3da
commit
2c01f38dec
@ -11,7 +11,8 @@
|
|||||||
$restrictions = $module->getProvidedRestrictions();
|
$restrictions = $module->getProvidedRestrictions();
|
||||||
$permissions = $module->getProvidedPermissions();
|
$permissions = $module->getProvidedPermissions();
|
||||||
$unmetDependencies = $moduleManager->hasUnmetDependencies($module->getName());
|
$unmetDependencies = $moduleManager->hasUnmetDependencies($module->getName());
|
||||||
$state = $moduleData->enabled ? ($moduleData->loaded ? 'enabled' : 'failed') : 'disabled'
|
$isIcingadbSupported = isset($requiredMods['icingadb']);
|
||||||
|
$state = $moduleData->enabled ? ($moduleData->loaded ? 'enabled' : 'failed') : 'disabled';
|
||||||
?>
|
?>
|
||||||
<table class="name-value-table">
|
<table class="name-value-table">
|
||||||
<tr>
|
<tr>
|
||||||
@ -82,13 +83,18 @@
|
|||||||
<table class="name-value-table">
|
<table class="name-value-table">
|
||||||
<caption><?= $this->translate('Modules') ?></caption>
|
<caption><?= $this->translate('Modules') ?></caption>
|
||||||
<?php foreach ($requiredMods as $moduleName => $versionString): ?>
|
<?php foreach ($requiredMods as $moduleName => $versionString): ?>
|
||||||
|
<?php if ($moduleName === 'monitoring' && $isIcingadbSupported && $moduleManager->has('icingadb', $requiredMods['icingadb'])) : ?>
|
||||||
|
<?php continue; ?>
|
||||||
|
<?php endif ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->escape($moduleName) ?></th>
|
<th><?= $this->escape($moduleName) ?></th>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($moduleManager->has($moduleName, $versionString === true ? null : $versionString)): ?>
|
<?php if ($moduleManager->has($moduleName, $versionString === true ? null : $versionString)): ?>
|
||||||
<?= $versionString === true ? '*' : $this->escape($versionString) ?>
|
<?= $versionString === true ? '*' : $this->escape($versionString) ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<span class="missing"><?= $versionString === true ? '*' : $this->escape($versionString) ?></span>
|
<span <?= ($moduleName === 'icingadb' && isset($requiredMods['monitoring']) && $moduleManager->has('monitoring', $requiredMods['monitoring'])) ? 'class="optional"' : 'class="missing"' ?>>
|
||||||
|
<?= $versionString === true ? '*' : $this->escape($versionString) ?>
|
||||||
|
</span>
|
||||||
<?php if (! $moduleManager->hasInstalled($moduleName)): ?>
|
<?php if (! $moduleManager->hasInstalled($moduleName)): ?>
|
||||||
(<?= $this->translate('not installed') ?>)
|
(<?= $this->translate('not installed') ?>)
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
@ -96,6 +102,9 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
|
<?php if ($moduleName === 'monitoring' && $isIcingadbSupported) : ?>
|
||||||
|
<td class="or-separator"><?= $this->translate('or') ?></td>
|
||||||
|
<?php endif ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</table>
|
</table>
|
||||||
|
@ -559,6 +559,17 @@ class Manager
|
|||||||
$module = $this->getModule($name, false);
|
$module = $this->getModule($name, false);
|
||||||
|
|
||||||
$requiredMods = $module->getRequiredModules();
|
$requiredMods = $module->getRequiredModules();
|
||||||
|
|
||||||
|
if (isset($requiredMods['monitoring'], $requiredMods['icingadb'])) {
|
||||||
|
if (! $this->has('monitoring', $requiredMods['monitoring'])
|
||||||
|
&& ! $this->has('icingadb', $requiredMods['icingadb'])
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($requiredMods['monitoring'], $requiredMods['icingadb']);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($requiredMods as $moduleName => $moduleVersion) {
|
foreach ($requiredMods as $moduleName => $moduleVersion) {
|
||||||
if (! $this->has($moduleName, $moduleVersion)) {
|
if (! $this->has($moduleName, $moduleVersion)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -891,12 +891,51 @@ class Module
|
|||||||
{
|
{
|
||||||
$requiredModules = $this->metadata()->modules ?: $this->metadata()->depends;
|
$requiredModules = $this->metadata()->modules ?: $this->metadata()->depends;
|
||||||
|
|
||||||
|
$hasIcingadb = isset($requiredModules['icingadb']);
|
||||||
|
if (isset($requiredModules['monitoring']) && ($this->isSupportingIcingadb() || $hasIcingadb)) {
|
||||||
|
$requiredMods = [];
|
||||||
|
$icingadbVersion = true;
|
||||||
|
if ($hasIcingadb) {
|
||||||
|
$icingadbVersion = isset($requiredModules['icingadb']) ? $requiredModules['icingadb'] : true;
|
||||||
|
unset($requiredModules['icingadb']);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($requiredModules as $name => $version) {
|
||||||
|
$requiredMods[$name] = $version;
|
||||||
|
if ($name === 'monitoring') {
|
||||||
|
$requiredMods['icingadb'] = $icingadbVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$requiredModules = $requiredMods;
|
||||||
|
}
|
||||||
|
|
||||||
// Both modules are deprecated and their successors are now dependencies of web itself
|
// Both modules are deprecated and their successors are now dependencies of web itself
|
||||||
unset($requiredModules['ipl'], $requiredModules['reactbundle']);
|
unset($requiredModules['ipl'], $requiredModules['reactbundle']);
|
||||||
|
|
||||||
return $requiredModules;
|
return $requiredModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether module supports icingadb
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function isSupportingIcingadb()
|
||||||
|
{
|
||||||
|
$icingadbSupportingModules = [
|
||||||
|
'cube' => '1.2.0',
|
||||||
|
'jira' => '1.2.0',
|
||||||
|
'graphite' => '1.2.0',
|
||||||
|
'director' => '1.9.0',
|
||||||
|
'toplevelview' => '0.4.0',
|
||||||
|
'businessprocess' => '2.4.0'
|
||||||
|
];
|
||||||
|
|
||||||
|
return array_key_exists($this->getName(), $icingadbSupportingModules)
|
||||||
|
&& version_compare($this->getVersion(), $icingadbSupportingModules[$this->getName()], '>=');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch module metadata
|
* Fetch module metadata
|
||||||
*
|
*
|
||||||
|
@ -440,5 +440,29 @@ a:hover > .icon-cancel {
|
|||||||
.var(color, color-critical);
|
.var(color, color-critical);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
&.or-separator {
|
||||||
|
width: 100%;
|
||||||
|
transform: translate(0, 50%);
|
||||||
|
padding-left: 3em;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
height: 1.5em;
|
||||||
|
width: 1.5em;
|
||||||
|
left: 0.5em;
|
||||||
|
border-top: 3px solid;
|
||||||
|
border-right: 3px solid;
|
||||||
|
.var(border-top-color, "gray");
|
||||||
|
.var(border-right-color, "gray");
|
||||||
|
border-top-right-radius: .50em;
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user