Skip to content

Commit b50285b

Browse files
committed
Handle long item names
1 parent 8923476 commit b50285b

File tree

8 files changed

+89
-11
lines changed

8 files changed

+89
-11
lines changed

configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@
6262
$this->provideJsFile('vendor/Sortable.js');
6363
$this->provideJsFile('behavior/sortable.js');
6464
$this->provideJsFile('vendor/jquery.fn.sortable.js');
65+
$this->provideCssFile('mixins.less');

library/Businessprocess/Renderer/Breadcrumb.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use ipl\Html\BaseHtmlElement;
99
use ipl\Html\Html;
1010
use ipl\Web\Widget\Icon;
11+
use ipl\Html\HtmlElement;
1112

1213
class Breadcrumb extends BaseHtmlElement
1314
{
@@ -42,7 +43,11 @@ public static function create(Renderer $renderer)
4243
)
4344
));
4445
$breadcrumb->add(Html::tag('li')->add(
45-
Html::tag('a', ['href' => $bpUrl], $bp->getTitle())
46+
Html::tag(
47+
'a',
48+
['href' => $bpUrl],
49+
HtmlElement::create('span', ['class' => 'text', 'title' => $bp->getTitle()], $bp->getTitle())
50+
)
4651
));
4752
$path = $renderer->getCurrentPath();
4853

library/Businessprocess/Renderer/TileRenderer/NodeTile.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use ipl\Html\Html;
1414
use ipl\Web\Widget\Icon;
1515
use ipl\Web\Widget\Link;
16+
use ipl\Html\HtmlElement;
1617
use ipl\Web\Widget\StateBall;
1718

1819
class NodeTile extends BaseHtmlElement
@@ -88,6 +89,14 @@ public function render()
8889
if (! $node instanceof ImportedNode || $node->getBpConfig()->hasNode($node->getName())) {
8990
$link = $this->getMainNodeLink();
9091
if ($renderer->isBreadcrumb()) {
92+
$link->setContent(
93+
HtmlElement::create(
94+
'span',
95+
['class' => ['text', 'process-title'], 'title' => $link->getContent()],
96+
$link->getContent()
97+
)
98+
);
99+
91100
$state = strtolower($node->getStateName());
92101
if ($node->isHandled()) {
93102
$state = $state . ' handled';
@@ -179,7 +188,7 @@ protected function getMainNodeLink()
179188
$node->getAlias() ?? $node->getName()
180189
);
181190
} else {
182-
$link = Html::tag('a', ['href' => $url], $node->getAlias());
191+
$link = Html::tag('a', ['href' => $url, 'title' => $node->getAlias()], $node->getAlias());
183192
}
184193

185194
return $link;

library/Businessprocess/Renderer/TreeRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function renderNode(BpConfig $bp, Node $node, $path = array())
218218

219219
$summary->add($this->getNodeIcons($node, $path));
220220

221-
$summary->add(Html::tag('span', null, $node->getAlias()));
221+
$summary->add(Html::tag('span', ['class' => 'text', 'title' => $node->getAlias()], $node->getAlias()));
222222

223223
if ($node instanceof BpNode) {
224224
$summary->add(Html::tag('span', ['class' => 'op'], $node->operatorHtml()));

library/Businessprocess/Web/Component/BpDashboardTile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public function __construct(BpConfig $bp, $title, $description, $icon, $url, $ur
2222
'div',
2323
['class' => 'bp-link', 'data-base-target' => '_main'],
2424
(new Link(new Icon($icon), Url::fromPath($url, $urlParams ?: []), $attributes))
25-
->add(Html::tag('span', ['class' => 'header'], $title))
26-
->add($description)
25+
->add(Html::tag('span', ['class' => ['header', 'text'], 'title' => $title], $title))
26+
->add(Html::tag('span', ['class' => 'text', 'title' => $description], $description))
2727
));
2828

2929
$tiles = Html::tag('div', ['class' => 'bp-root-tiles']);

library/Businessprocess/Web/Component/Dashboard.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
use Icinga\Module\Businessprocess\State\MonitoringState;
1212
use Icinga\Module\Businessprocess\Storage\Storage;
1313
use ipl\Html\BaseHtmlElement;
14+
use ipl\Html\FormattedString;
1415
use ipl\Html\Html;
16+
use ipl\Html\HtmlElement;
1517

1618
class Dashboard extends BaseHtmlElement
1719
{

public/css/mixins.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.line-clamp(@numOfLines: 2) when (@numOfLines > 1) {
2+
display: -webkit-box;
3+
-webkit-line-clamp: @numOfLines;
4+
-webkit-box-orient: vertical;
5+
}
6+
7+
.text-ellipsis() {
8+
overflow: hidden;
9+
text-overflow: ellipsis;
10+
}

public/css/module.less

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ ul.bp {
181181
> span {
182182
font-size: 1.25em;
183183

184+
&.text {
185+
flex: 1 1 auto;
186+
width: 0;
187+
.text-ellipsis();
188+
white-space: nowrap;
189+
}
190+
184191
&.op {
185192
padding: .1em .5em;
186193
border-radius: .5em;
@@ -344,6 +351,10 @@ ul.broken-files {
344351
}
345352

346353
.bp-link {
354+
.text {
355+
.line-clamp(2);
356+
}
357+
347358
> a {
348359
text-decoration: none;
349360
color: @gray;
@@ -354,6 +365,14 @@ ul.broken-files {
354365

355366
> span.header {
356367
color: @text-color;
368+
369+
.header-id {
370+
display: block;
371+
white-space: nowrap;
372+
overflow: hidden;
373+
text-overflow: ellipsis;
374+
max-width: 100%;
375+
}
357376
}
358377
}
359378
}
@@ -450,7 +469,8 @@ td > a > .state-badges {
450469
.tiles > div {
451470
color: @text-color-on-icinga-blue;
452471
width: 12em;
453-
display: inline-block;
472+
display: flex;
473+
flex-direction: column;
454474
float: left;
455475
vertical-align: top;
456476
margin-right: 0.2em;
@@ -464,11 +484,8 @@ td > a > .state-badges {
464484
}
465485

466486
.state-badges {
467-
position: absolute;
468-
bottom: 0;
469-
right: 0;
487+
text-align: end;
470488
margin: 0.5em;
471-
text-align: center;
472489
font-size: 0.5em;
473490
}
474491

@@ -483,12 +500,17 @@ td > a > .state-badges {
483500

484501
> a {
485502
display: block;
503+
}
504+
505+
> a {
486506
text-decoration: none;
487507
font-size: 0.7em;
488508
text-align: center;
489-
padding: 1em 1em 0;
509+
padding: 0 1em;
490510
font-weight: bold;
491511
word-wrap: break-word;
512+
.text-ellipsis();
513+
.line-clamp(2);
492514
}
493515

494516
&:hover {
@@ -634,6 +656,7 @@ td > a > .state-badges {
634656
color: @icinga-blue;
635657
margin: 0;
636658
font-size: 1.2em;
659+
max-width: 10em;
637660
text-decoration: none;
638661
padding-left: 2em;
639662
line-height: 2.5em;
@@ -737,6 +760,22 @@ td > a > .state-badges {
737760
text-decoration: underline;
738761
}
739762

763+
.text {
764+
display: block;
765+
.text-ellipsis();
766+
}
767+
768+
.breadcrumb li a {
769+
.process-title {
770+
margin-top: -2.5em;
771+
margin-left: 1.2em;
772+
}
773+
774+
.text {
775+
white-space: nowrap;
776+
}
777+
}
778+
740779
#layout.twocols, #layout.layout-minimal, div.compact {
741780
.breadcrumb {
742781
font-size: 0.833em;
@@ -745,6 +784,18 @@ td > a > .state-badges {
745784

746785
/** END of breadcrumb **/
747786

787+
.tiles .process-node {
788+
justify-content: space-between;
789+
}
790+
791+
.tiles .monitored-node {
792+
padding-bottom: 1.5em;
793+
794+
> a {
795+
margin-top: auto;
796+
margin-bottom: auto;
797+
}
798+
}
748799

749800
ul.error, ul.warning {
750801
padding: 0;

0 commit comments

Comments
 (0)