Commit 77992b2a authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Jigal van Hemert
Browse files

[FOLLOWUP][FEATURE] Introduce System Information dropdown item

* Align status constants to FlashMessages and Modals
* Add additional badge-info class
* Display non-production environments as warning

Resolves: #65767
Releases: master
Change-Id: Ib78860bffcd10b6a623fc498647048794d02bc67
Reviewed-on: http://review.typo3.org/38420


Reviewed-by: Jigal van Hemert's avatarJigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert's avatarJigal van Hemert <jigal.van.hemert@typo3.org>
parent 005ce460
......@@ -86,6 +86,8 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
/**
* Gets the PHP version
*
* @return void
*/
protected function getPhpVersion() {
$this->systemInformation[] = array(
......@@ -97,6 +99,8 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
/**
* Get the database info
*
* @return void
*/
protected function getDatabase() {
$this->systemInformation[] = array(
......@@ -108,29 +112,33 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
/**
* Gets the application context
*
* @return void
*/
protected function getApplicationContext() {
$applicationContext = GeneralUtility::getApplicationContext();
$this->systemInformation[] = array(
'title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.sysinfo.applicationcontext', TRUE),
'value' => (string)$applicationContext,
'status' => $applicationContext->isProduction() ? InformationStatus::STATUS_OK : InformationStatus::STATUS_ERROR,
'status' => $applicationContext->isProduction() ? InformationStatus::STATUS_OK : InformationStatus::STATUS_WARNING,
'icon' => '<span class="fa fa-tasks"></span>'
);
}
/**
* Gets the current GIT revision and branch
*
* @return void
*/
protected function getGitRevision() {
if (!StringUtility::endsWith(TYPO3_version, '-dev') || \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::isFunctionDisabled('exec')) {
return '';
return;
}
// check if git exists
CommandUtility::exec('git --version', $_, $returnCode);
if ((int)$returnCode !== 0) {
// git is not available
return '';
return;
}
$revision = trim(CommandUtility::exec('git rev-parse --short HEAD'));
......@@ -146,6 +154,8 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
/**
* Gets the system kernel and version
*
* @return void
*/
protected function getOperatingSystem() {
$kernelName = php_uname('s');
......@@ -168,6 +178,8 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
/**
* Emits the "getSystemInformation" signal
*
* @return void
*/
protected function emitGetSystemInformation() {
list($systemInformation) = $this->getSignalSlotDispatcher()->dispatch(__CLASS__, 'getSystemInformation', array(array()));
......@@ -178,6 +190,8 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
/**
* Emits the "loadMessages" signal
*
* @return void
*/
protected function emitLoadMessages() {
list($message) = $this->getSignalSlotDispatcher()->dispatch(__CLASS__, 'loadMessages', array(array()));
......@@ -217,7 +231,7 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
$item = IconUtility::getSpriteIcon('actions-system-list-open', array('title' => $title));
if ($this->totalCount > 0) {
$severityBadge = $this->highestSeverity !== InformationStatus::STATUS_DEFAULT ? 'badge-' . $this->highestSeverity : '';
$severityBadge = $this->highestSeverity !== InformationStatus::STATUS_NOTICE ? 'badge-' . $this->highestSeverity : '';
$item .= '<span id="t3js-systeminformation-counter" class="badge ' . $severityBadge . '">' . $this->totalCount . '</span>';
}
return $item;
......@@ -319,4 +333,4 @@ class SystemInformationToolbarItem extends AbstractToolbarItem implements Toolba
return $this->signalSlotDispatcher;
}
}
}
\ No newline at end of file
......@@ -22,7 +22,12 @@ class InformationStatus extends \TYPO3\CMS\Core\Type\Enumeration {
/**
* @var string
*/
const STATUS_DEFAULT = '';
const STATUS_NOTICE = '';
/**
* @var string
*/
const STATUS_INFO = 'info';
/**
* @var string
......@@ -43,7 +48,8 @@ class InformationStatus extends \TYPO3\CMS\Core\Type\Enumeration {
* @var int[]
*/
static protected $statusIntegerMap = array(
self::STATUS_DEFAULT => -1,
self::STATUS_NOTICE => -2,
self::STATUS_INFO => -1,
self::STATUS_OK => 0,
self::STATUS_WARNING => 1,
self::STATUS_ERROR => 2
......
//
// Badges
//
.badge-info {
.bg-variant(@brand-info);
}
.badge-success {
.bg-variant(@brand-success);
......
......@@ -9920,17 +9920,23 @@ table#typo3-tree tr:hover {
.label-block {
display: block;
}
.badge-info {
background-color: #6daae0;
}
a.badge-info:hover {
background-color: #4392d7;
}
.badge-success {
background-color: #1eb941;
background-color: #79a548;
}
a.badge-success:hover {
background-color: #178d32;
background-color: #5f8139;
}
.badge-warning {
background-color: #f07814;
background-color: #e8a33d;
}
a.badge-warning:hover {
background-color: #c4600d;
background-color: #d88b1a;
}
.badge-danger {
background-color: #c83c3c;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment