mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
Merge branch 'feature/show-icinga-web-2-s-version-in-the-frontend-9247'
resolves #9247 resolves #9381
This commit is contained in:
commit
7cbafe7793
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -8,4 +8,4 @@ Vagrantfile export-ignore
|
|||||||
.puppet* eol=lf
|
.puppet* eol=lf
|
||||||
|
|
||||||
# Include version information on `git archive'
|
# Include version information on `git archive'
|
||||||
/application/VERSION export-subst
|
/application/GITCOMMIT export-subst
|
||||||
|
1
application/GITCOMMIT
Normal file
1
application/GITCOMMIT
Normal file
@ -0,0 +1 @@
|
|||||||
|
$Format:%H %ci$
|
@ -1 +0,0 @@
|
|||||||
$Format:%H%d %ci$
|
|
@ -3,13 +3,23 @@
|
|||||||
|
|
||||||
namespace Icinga\Controllers;
|
namespace Icinga\Controllers;
|
||||||
|
|
||||||
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Application\Version;
|
use Icinga\Application\Version;
|
||||||
use Icinga\Web\Controller\ActionController;
|
use Icinga\Web\Controller;
|
||||||
|
|
||||||
class AboutController extends ActionController
|
class AboutController extends Controller
|
||||||
{
|
{
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$this->view->version = Version::get();
|
$this->view->version = Version::get();
|
||||||
|
$this->view->modules = Icinga::app()->getModuleManager()->getLoadedModules();
|
||||||
|
$this->view->tabs = $this->getTabs()->add(
|
||||||
|
'about',
|
||||||
|
array(
|
||||||
|
'label' => $this->translate('About'),
|
||||||
|
'title' => $this->translate('About Icinga Web 2'),
|
||||||
|
'url' => 'about'
|
||||||
|
)
|
||||||
|
)->activate('about');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,128 @@
|
|||||||
<div class="content">
|
<div class="controls">
|
||||||
<h1>Icinga Web 2</h1>
|
<?= $tabs; ?>
|
||||||
<?php
|
</div>
|
||||||
$versionInfo = array();
|
<div class="content about">
|
||||||
if ($version !== false) {
|
<?= $this->img(
|
||||||
foreach (array(
|
'img/logo_icinga_big_dark.png',
|
||||||
'appVersion' => $this->translate('Version: %s'),
|
null,
|
||||||
'gitCommitID' => $this->translate('Git commit ID: %s'),
|
array(
|
||||||
'gitCommitDate' => $this->translate('Git commit date: %s')
|
'width' => 400,
|
||||||
) as $key => $label) {
|
'class' => 'about-logo'
|
||||||
if (array_key_exists($key, $version) && null !== ($value = $version[$key])) {
|
)
|
||||||
$versionInfo[] = sprintf($label, htmlspecialchars($value));
|
); ?>
|
||||||
}
|
<p class="about-version">
|
||||||
}
|
<?php if (isset($version['appVersion'])): ?>
|
||||||
}
|
<strong><?= $this->translate('Version'); ?>:</strong> <?= $this->escape($version['appVersion']); ?>
|
||||||
|
<?php endif ?>
|
||||||
echo (
|
<?php if (isset($version['gitCommitID'])): ?>
|
||||||
0 === count($versionInfo)
|
<br>
|
||||||
? '<p class="message-error">' . $this->translate(
|
<strong><?= $this->translate('Git commit ID'); ?>:</strong> <?= $this->escape($version['gitCommitID']); ?>
|
||||||
'Can\'t determine Icinga Web 2\'s version'
|
<?php endif ?>
|
||||||
)
|
<?php if (isset($version['gitCommitDate'])): ?>
|
||||||
: '<p>' . nl2br(implode("\n", $versionInfo), false)
|
<br>
|
||||||
) . '</p>';
|
<strong><?= $this->translate('Git commit date'); ?>:</strong> <?= $this->escape($version['gitCommitDate']); ?>
|
||||||
?>
|
<?php endif ?>
|
||||||
|
</p>
|
||||||
|
<p class="about-license">
|
||||||
|
<strong><?= $this->translate('Copyright'); ?></strong>: © 2013-<?= date('Y'); ?> <?= $this->qlink(
|
||||||
|
$this->translate('The Icinga Project'),
|
||||||
|
'https://www.icinga.org',
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'target' => '_blank'
|
||||||
|
)
|
||||||
|
); ?>
|
||||||
|
<br>
|
||||||
|
<strong><?= $this->translate('License'); ?></strong>: GNU GPL v2+
|
||||||
|
</p>
|
||||||
|
<p class="about-social">
|
||||||
|
<?= $this->qlink(
|
||||||
|
null,
|
||||||
|
'https://www.twitter.com/icinga',
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'target' => '_blank',
|
||||||
|
'icon' => 'twitter',
|
||||||
|
'title' => $this->translate('Icinga on Twitter')
|
||||||
|
)
|
||||||
|
); ?> <?= $this->qlink(
|
||||||
|
null,
|
||||||
|
'https://www.facebook.com/icinga',
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'target' => '_blank',
|
||||||
|
'icon' => 'facebook-squared',
|
||||||
|
'title' => $this->translate('Icinga on Facebook')
|
||||||
|
)
|
||||||
|
); ?>
|
||||||
|
</p>
|
||||||
|
<div class="about-urls">
|
||||||
|
<div><?= $this->qlink(
|
||||||
|
null,
|
||||||
|
'https://dev.icinga.org/projects/icingaweb2',
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'target' => '_blank',
|
||||||
|
'img' => 'img/bugreport.png',
|
||||||
|
'title' => $this->translate('Report a bug')
|
||||||
|
)
|
||||||
|
); ?> <?= $this->qlink(
|
||||||
|
null,
|
||||||
|
'https://www.icinga.org/services/support',
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'target' => '_blank',
|
||||||
|
'img' => 'img/support.png',
|
||||||
|
'title' => $this->translate('Support / Mailinglists')
|
||||||
|
)
|
||||||
|
); ?></div>
|
||||||
|
<div><?= $this->qlink(
|
||||||
|
null,
|
||||||
|
'https://wiki.icinga.org',
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'target' => '_blank',
|
||||||
|
'img' => 'img/wiki.png',
|
||||||
|
'title' => $this->translate('Icinga Wiki')
|
||||||
|
)
|
||||||
|
); ?> <?= $this->qlink(
|
||||||
|
null,
|
||||||
|
'https://docs.icinga.org/',
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'target' => '_blank',
|
||||||
|
'img' => 'img/docs.png',
|
||||||
|
'title' => $this->translate('Icinga Documentation')
|
||||||
|
)
|
||||||
|
); ?></div>
|
||||||
|
</div>
|
||||||
|
<h2><?= $this->translate('Loaded modules') ?></h2>
|
||||||
|
<table class="action alternating about-modules" data-base-target="_next">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?= $this->translate('Name') ?></th>
|
||||||
|
<th><?= $this->translate('Version') ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($modules as $module): ?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?php if ($this->hasPermission('config/modules')): ?>
|
||||||
|
<?= $this->qlink(
|
||||||
|
$module->getName(),
|
||||||
|
'config/module/',
|
||||||
|
array('name' => $module->getName()),
|
||||||
|
array('title' => sprintf($this->translate('Show the overview of the %s module'), $module->getName()))
|
||||||
|
); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= $this->escape($module->getName()); ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<td>
|
||||||
|
<?= $this->escape($module->getVersion()); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -204,7 +204,7 @@ rm -rf %{buildroot}
|
|||||||
%{basedir}/application/forms
|
%{basedir}/application/forms
|
||||||
%{basedir}/application/layouts
|
%{basedir}/application/layouts
|
||||||
%{basedir}/application/views
|
%{basedir}/application/views
|
||||||
%{basedir}/application/VERSION
|
%{basedir}/application/GITCOMMIT
|
||||||
%{basedir}/doc
|
%{basedir}/doc
|
||||||
%{basedir}/modules
|
%{basedir}/modules
|
||||||
%{basedir}/public
|
%{basedir}/public
|
||||||
|
@ -8,33 +8,42 @@ namespace Icinga\Application;
|
|||||||
*/
|
*/
|
||||||
class Version
|
class Version
|
||||||
{
|
{
|
||||||
|
const VERSION = '2.0.0-rc1';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the version of this instance of Icinga Web 2
|
* Get the version of this instance of Icinga Web 2
|
||||||
*
|
*
|
||||||
* @return array|false array on success, false otherwise
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function get()
|
public static function get()
|
||||||
{
|
{
|
||||||
if (false === ($appVersion = @file_get_contents(
|
$version = array('appVersion' => self::VERSION);
|
||||||
Icinga::app()->getApplicationDir() . DIRECTORY_SEPARATOR . 'VERSION'
|
|
||||||
))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$matches = array();
|
if (false !== ($appVersion = @file_get_contents(Icinga::app()->getApplicationDir('GITCOMMIT')))) {
|
||||||
if (false === ($res = preg_match(
|
$matches = array();
|
||||||
'/(?<!.)\s*(?P<gitCommitID>\w+)(?:\s*\(.*?(?:(?<=[\(,])\s*tag\s*:\s*v(?P<appVersion>.+?)\s*(?=[\),]).*?)?\))?\s*(?P<gitCommitDate>\S+)/ms',
|
if (@preg_match('/^(?P<gitCommitID>\w+) (?P<gitCommitDate>\S+)/', $appVersion, $matches)) {
|
||||||
$appVersion,
|
return array_merge($version, $matches);
|
||||||
$matches
|
|
||||||
)) || $res === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($matches as $key => $value) {
|
|
||||||
if (is_int($key) || $value === '') {
|
|
||||||
unset($matches[$key]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $matches;
|
|
||||||
|
$gitDir = Icinga::app()->getBaseDir('.git');
|
||||||
|
$gitHead = @file_get_contents($gitDir . DIRECTORY_SEPARATOR . 'HEAD');
|
||||||
|
if (false !== $gitHead) {
|
||||||
|
$matches = array();
|
||||||
|
if (@preg_match('/(?<!.)ref:\s+(.+?)$/ms', $gitHead, $matches)) {
|
||||||
|
$gitCommitID = @file_get_contents($gitDir . DIRECTORY_SEPARATOR . $matches[1]);
|
||||||
|
} else {
|
||||||
|
$gitCommitID = $gitHead;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== $gitCommitID) {
|
||||||
|
$matches = array();
|
||||||
|
if (@preg_match('/(?<!.)(?P<gitCommitID>[0-9a-f]+)$/ms', $gitCommitID, $matches)) {
|
||||||
|
return array_merge($version, $matches);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@ class StyleSheet
|
|||||||
'css/icinga/selection-toolbar.less',
|
'css/icinga/selection-toolbar.less',
|
||||||
'css/icinga/login.less',
|
'css/icinga/login.less',
|
||||||
'css/icinga/logo.less',
|
'css/icinga/logo.less',
|
||||||
'css/icinga/controls.less'
|
'css/icinga/controls.less',
|
||||||
|
'css/icinga/about.less'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function compileForPdf()
|
public static function compileForPdf()
|
||||||
|
@ -43,6 +43,11 @@ $this->addHelperFunction('qlink', function ($title, $url, $params = null, $prope
|
|||||||
$icon = $view->icon($properties['icon']);
|
$icon = $view->icon($properties['icon']);
|
||||||
unset($properties['icon']);
|
unset($properties['icon']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('img', $properties)) {
|
||||||
|
$icon = $view->img($properties['img']);
|
||||||
|
unset($properties['img']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf(
|
return sprintf(
|
||||||
|
9
public/css/icinga/about.less
Normal file
9
public/css/icinga/about.less
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
div.about {
|
||||||
|
width: 600px;
|
||||||
|
margin: 0 auto;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.about-modules {
|
||||||
|
text-align: initial;
|
||||||
|
}
|
||||||
|
}
|
BIN
public/img/bugreport.png
Normal file
BIN
public/img/bugreport.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
public/img/docs.png
Normal file
BIN
public/img/docs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
public/img/support.png
Normal file
BIN
public/img/support.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
BIN
public/img/wiki.png
Normal file
BIN
public/img/wiki.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Loading…
x
Reference in New Issue
Block a user