mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Cleanup css and php code
This commit is contained in:
parent
3035bb0538
commit
80fc6a4229
14 changed files with 5 additions and 324 deletions
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Common;
|
||||
|
||||
trait CaptionDisabled
|
||||
{
|
||||
/** @var bool */
|
||||
protected $captionDisabled = false;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCaptionDisabled(): bool
|
||||
{
|
||||
return $this->captionDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $captionDisabled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCaptionDisabled(bool $captionDisabled = true): self
|
||||
{
|
||||
$this->captionDisabled = $captionDisabled;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Common;
|
||||
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
|
||||
trait ListItemCommonLayout
|
||||
{
|
||||
use CaptionDisabled;
|
||||
|
||||
protected function assembleHeader(BaseHtmlElement $header): void
|
||||
{
|
||||
$header->addHtml($this->createTitle());
|
||||
$header->add($this->createTimestamp());
|
||||
}
|
||||
|
||||
protected function assembleMain(BaseHtmlElement $main): void
|
||||
{
|
||||
$main->addHtml($this->createHeader());
|
||||
if (!$this->isCaptionDisabled()) {
|
||||
$main->addHtml($this->createCaption());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2021 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Common;
|
||||
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
|
||||
trait ListItemDetailedLayout
|
||||
{
|
||||
protected function assembleHeader(BaseHtmlElement $header): void
|
||||
{
|
||||
$header->add($this->createTitle());
|
||||
$header->add($this->createTimestamp());
|
||||
}
|
||||
|
||||
protected function assembleMain(BaseHtmlElement $main): void
|
||||
{
|
||||
$main->add($this->createHeader());
|
||||
$main->add($this->createCaption());
|
||||
$main->add($this->createFooter());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Common;
|
||||
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
|
||||
trait ListItemMinimalLayout
|
||||
{
|
||||
use CaptionDisabled;
|
||||
|
||||
protected function assembleHeader(BaseHtmlElement $header): void
|
||||
{
|
||||
$header->add($this->createTitle());
|
||||
if (! $this->isCaptionDisabled()) {
|
||||
$header->add($this->createCaption());
|
||||
}
|
||||
$header->add($this->createTimestamp());
|
||||
}
|
||||
|
||||
protected function assembleMain(BaseHtmlElement $main): void
|
||||
{
|
||||
$main->add($this->createHeader());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2021 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Common;
|
||||
|
||||
trait NoSubjectLink
|
||||
{
|
||||
/** @var bool */
|
||||
protected $noSubjectLink = false;
|
||||
|
||||
/**
|
||||
* Set whether a list item's subject should be a link
|
||||
*
|
||||
* @param bool $state
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNoSubjectLink(bool $state = true): self
|
||||
{
|
||||
$this->noSubjectLink = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether a list item's subject should be a link
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getNoSubjectLink(): bool
|
||||
{
|
||||
return $this->noSubjectLink;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2021 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Common;
|
||||
|
||||
trait ObjectLinkDisabled
|
||||
{
|
||||
/** @var bool */
|
||||
protected $objectLinkDisabled = false;
|
||||
|
||||
/**
|
||||
* Set whether list items should render host and service links
|
||||
*
|
||||
* @param bool $state
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setObjectLinkDisabled(bool $state = true): self
|
||||
{
|
||||
$this->objectLinkDisabled = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether list items should render host and service links
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getObjectLinkDisabled(): bool
|
||||
{
|
||||
return $this->objectLinkDisabled;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Common;
|
||||
|
||||
trait ViewMode
|
||||
{
|
||||
/** @var string */
|
||||
protected $viewMode;
|
||||
|
||||
/**
|
||||
* Get the view mode
|
||||
*
|
||||
* @return ?string
|
||||
*/
|
||||
public function getViewMode()
|
||||
{
|
||||
return $this->viewMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the view mode
|
||||
*
|
||||
* @param string $viewMode
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setViewMode(string $viewMode): self
|
||||
{
|
||||
$this->viewMode = $viewMode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -287,14 +287,10 @@ class EventRenderer implements ItemRenderer
|
|||
$title->addHtml(new Link($subjectLabel, Links::event($item), ['class' => 'subject']));
|
||||
}
|
||||
|
||||
if ($item->object_type === 'host') {
|
||||
if (isset($item->host->id)) {
|
||||
$link = $this->createHostLink($item->host, true);
|
||||
}
|
||||
} else {
|
||||
if (isset($item->host->id, $item->service->id)) {
|
||||
$link = $this->createServiceLink($item->service, $item->host, true);
|
||||
}
|
||||
if ($item->object_type === 'host' && isset($item->host->id)) {
|
||||
$link = $this->createHostLink($item->host, true);
|
||||
} elseif (isset($item->host->id, $item->service->id)) {
|
||||
$link = $this->createServiceLink($item->service, $item->host, true);
|
||||
}
|
||||
|
||||
$title->addHtml(Text::create(' '));
|
||||
|
|
@ -308,6 +304,7 @@ class EventRenderer implements ItemRenderer
|
|||
if ($item->event_type === 'notification') {
|
||||
$item->notification->host = $item->host;
|
||||
$item->notification->service = $item->service;
|
||||
|
||||
$this->notificationRenderer->assembleCaption($item->notification, $caption, $layout);
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ class HostgroupGridRenderer implements ItemRenderer
|
|||
$url = Url::fromPath('icingadb/hosts');
|
||||
$urlFilter = Filter::all(Filter::equal('hostgroup.name', $item->name));
|
||||
|
||||
|
||||
if ($item->hosts_down_unhandled > 0) {
|
||||
$urlFilter->add(Filter::equal('host.state.soft_state', 1))
|
||||
->add(Filter::equal('host.state.is_handled', 'n'))
|
||||
|
|
|
|||
|
|
@ -10,15 +10,12 @@ use ipl\Html\Attributes;
|
|||
use ipl\Html\HtmlDocument;
|
||||
use ipl\Html\HtmlElement;
|
||||
use ipl\Html\Text;
|
||||
use ipl\I18n\Translation;
|
||||
use ipl\Web\Common\ItemRenderer;
|
||||
use ipl\Web\Widget\Link;
|
||||
|
||||
/** @implements ItemRenderer<User> */
|
||||
class UserRenderer implements ItemRenderer
|
||||
{
|
||||
use Translation;
|
||||
|
||||
public function assembleAttributes($item, Attributes $attributes, string $layout): void
|
||||
{
|
||||
$attributes->get('class')->addValue('user');
|
||||
|
|
|
|||
|
|
@ -10,15 +10,12 @@ use ipl\Html\Attributes;
|
|||
use ipl\Html\HtmlDocument;
|
||||
use ipl\Html\HtmlElement;
|
||||
use ipl\Html\Text;
|
||||
use ipl\I18n\Translation;
|
||||
use ipl\Web\Common\ItemRenderer;
|
||||
use ipl\Web\Widget\Link;
|
||||
|
||||
/** @implements ItemRenderer<Usergroup> */
|
||||
class UsergroupRenderer implements ItemRenderer
|
||||
{
|
||||
use Translation;
|
||||
|
||||
public function assembleAttributes($item, Attributes $attributes, string $layout): void
|
||||
{
|
||||
$attributes->get('class')->addValue('user-group');
|
||||
|
|
|
|||
|
|
@ -109,24 +109,6 @@ div.show-more {
|
|||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.item-list {
|
||||
width: 100%;
|
||||
|
||||
.list-item .main {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.list-item .visual {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.list-item .visual,
|
||||
.list-item .main {
|
||||
padding-bottom: .25em;
|
||||
padding-top: .25em;
|
||||
}
|
||||
}
|
||||
|
||||
.search-controls .continue-with {
|
||||
margin-right: -.5em;
|
||||
margin-left: .5em;
|
||||
|
|
@ -341,7 +323,6 @@ form[name="form_confirm_removal"] {
|
|||
margin-left: .28125em; // calculated width;
|
||||
}
|
||||
|
||||
&.default-layout .title .affected-objects, // TODO: Drop once the new list-item layout is used everywhere
|
||||
.default-item-layout .title .affected-objects {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,65 +53,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.item-list.minimal, // TODO: Remove this once the new list-item layout is used everywhere
|
||||
.item-list.minimal-item-layout {
|
||||
> .empty-state {
|
||||
padding: .25em;
|
||||
}
|
||||
}
|
||||
|
||||
.item-list.minimal {
|
||||
// TODO: Can be entirely dropped once the new list-item layout is used everywhere
|
||||
.list-item {
|
||||
header {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
p {
|
||||
display: inline;
|
||||
|
||||
& + p {
|
||||
margin-left: .417em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.caption {
|
||||
flex: 1 1 auto;
|
||||
height: 1.5em;
|
||||
margin-right: 1em;
|
||||
width: 0;
|
||||
|
||||
.line-clamp("reset");
|
||||
}
|
||||
|
||||
.caption,
|
||||
.caption .plugin-output {
|
||||
.text-ellipsis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-list.detailed .list-item {
|
||||
// TODO: Can be entirely dropped once the new list-item layout is used everywhere
|
||||
.title {
|
||||
word-break: break-word;
|
||||
-webkit-hyphens: auto;
|
||||
-ms-hyphens: auto;
|
||||
hyphens: auto;
|
||||
}
|
||||
|
||||
.caption {
|
||||
display: block;
|
||||
height: auto;
|
||||
max-height: 7.5em; /* 5 lines */
|
||||
position: relative;
|
||||
|
||||
.line-clamp(4)
|
||||
}
|
||||
}
|
||||
|
||||
.item-list {
|
||||
.icon-image {
|
||||
width: 3em;
|
||||
|
|
@ -129,7 +70,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
&.minimal, // TODO: Remove this once the new list-item layout is used everywhere
|
||||
&.minimal-item-layout {
|
||||
.icon-image {
|
||||
height: 2em;
|
||||
|
|
@ -139,19 +79,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Can be simplified (`.controls .list-item`) once the only list-items in controls are those in the multi select views
|
||||
.controls .item-list:not(.detailed):not(.minimal) .list-item {
|
||||
.plugin-output { //TODO: why ?? multiselect items has bigger gap now
|
||||
//seems dead code, remove it when cleaning up
|
||||
line-height: 1.5
|
||||
}
|
||||
|
||||
.caption {
|
||||
height: 2.5em;
|
||||
}
|
||||
}
|
||||
|
||||
.controls .item-list.minimal .icon-image, // TODO: Remove this once the new list-item layout is used everywhere
|
||||
.controls .minimal-item-layout .icon-image {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,9 +75,3 @@ ul.item-list li:last-child:not(:first-child) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.comment-popup .main .caption {
|
||||
// This is necessary to limit the visible comment lines
|
||||
// because the popup is shown in detailed list mode only
|
||||
height: 3em;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue