Skip to content

Commit

Permalink
Handle long item names
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 authored and nilmerg committed Aug 8, 2023
1 parent af4b98f commit ec53c8a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 10 deletions.
7 changes: 6 additions & 1 deletion library/Businessprocess/Renderer/Breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Icinga\Module\Businessprocess\Web\Url;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Html\HtmlElement;
use ipl\Web\Widget\Icon;

class Breadcrumb extends BaseHtmlElement
Expand Down Expand Up @@ -42,7 +43,11 @@ public static function create(Renderer $renderer)
)
));
$breadcrumb->add(Html::tag('li')->add(
Html::tag('a', ['href' => $bpUrl], $bp->getTitle())
Html::tag(
'a',
['href' => $bpUrl],
HtmlElement::create('span', ['class' => 'text', 'title' => $bp->getTitle()], $bp->getTitle())
)
));
$path = $renderer->getCurrentPath();

Expand Down
9 changes: 9 additions & 0 deletions library/Businessprocess/Renderer/TileRenderer/NodeTile.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Icinga\Web\Url;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Html\HtmlElement;
use ipl\Web\Widget\Icon;
use ipl\Web\Widget\StateBall;

Expand Down Expand Up @@ -87,6 +88,14 @@ public function render()
if (! $node instanceof ImportedNode || $node->getBpConfig()->hasNode($node->getName())) {
$link = $this->getMainNodeLink();
if ($renderer->isBreadcrumb()) {
$link->setContent(
HtmlElement::create(
'span',
['class' => ['text', 'process-title'], 'title' => $link->getContent()],
$link->getContent()
)
);

$state = strtolower($node->getStateName());
if ($node->isHandled()) {
$state = $state . ' handled';
Expand Down
4 changes: 2 additions & 2 deletions library/Businessprocess/Web/Component/BpDashboardTile.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function __construct(BpConfig $bp, $title, $description, $icon, $url, $ur
'div',
['class' => 'bp-link', 'data-base-target' => '_main'],
(new Link(new Icon($icon), Url::fromPath($url, $urlParams ?: []), $attributes))
->add(Html::tag('span', ['class' => 'header'], $title))
->add($description)
->add(Html::tag('span', ['class' => ['header', 'text']], $title))
->add(Html::tag('span', ['class' => 'text', 'title' => $description], $description))
));

$tiles = Html::tag('div', ['class' => 'bp-root-tiles']);
Expand Down
52 changes: 45 additions & 7 deletions public/css/module.less
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ ul.broken-files {
}

.bp-link {
.text {
.line-clamp(2);
}

> a {
text-decoration: none;
color: @gray;
Expand All @@ -354,6 +358,12 @@ ul.broken-files {

> span.header {
color: @text-color;

.header-id {
display: block;
max-width: 100%;
.text-ellipsis();
}
}
}
}
Expand Down Expand Up @@ -450,7 +460,8 @@ td > a > .state-badges {
.tiles > div {
color: @text-color-on-icinga-blue;
width: 12em;
display: inline-block;
display: flex;
flex-direction: column;
float: left;
vertical-align: top;
margin-right: 0.2em;
Expand All @@ -464,11 +475,8 @@ td > a > .state-badges {
}

.state-badges {
position: absolute;
bottom: 0;
right: 0;
text-align: end;
margin: 0.5em;
text-align: center;
font-size: 0.5em;
}

Expand All @@ -483,13 +491,14 @@ td > a > .state-badges {

> a,
.missing-node-msg {
display: block;
text-decoration: none;
font-size: 0.7em;
text-align: center;
padding: 1em 1em 0;
padding: 0 1em;
font-weight: bold;
word-wrap: break-word;
.text-ellipsis-multiline();
.line-clamp(2);
}

.missing-node-msg {
Expand Down Expand Up @@ -639,6 +648,7 @@ td > a > .state-badges {
color: @icinga-blue;
margin: 0;
font-size: 1.2em;
max-width: 10em;
text-decoration: none;
padding-left: 2em;
line-height: 2.5em;
Expand Down Expand Up @@ -742,6 +752,22 @@ td > a > .state-badges {
text-decoration: underline;
}

.text {
display: block;
.text-ellipsis-multiline();
}

.breadcrumb li a {
.process-title {
margin-top: -2.5em;
margin-left: 1.2em;
}

.text {
.line-clamp(1);
}
}

#layout.twocols, #layout.layout-minimal, div.compact {
.breadcrumb {
font-size: 0.833em;
Expand All @@ -750,6 +776,18 @@ td > a > .state-badges {

/** END of breadcrumb **/

.tiles .process-node {
justify-content: space-between;
}

.tiles .monitored-node {
padding-bottom: 1.5em;

> a {
margin-top: auto;
margin-bottom: auto;
}
}

ul.error, ul.warning {
padding: 0;
Expand Down

0 comments on commit ec53c8a

Please sign in to comment.