Skip to content

Commit dcc1a5f

Browse files
committed
Handle long item names
1 parent ce812c0 commit dcc1a5f

File tree

5 files changed

+62
-5
lines changed

5 files changed

+62
-5
lines changed

library/Businessprocess/Renderer/Breadcrumb.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Icinga\Module\Businessprocess\Web\Url;
88
use ipl\Html\BaseHtmlElement;
99
use ipl\Html\Html;
10+
use ipl\Html\HtmlElement;
1011

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

library/Businessprocess/Renderer/TileRenderer/NodeTile.php

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

1819
class NodeTile extends BaseHtmlElement
@@ -182,7 +183,11 @@ protected function getMainNodeLink()
182183
if ($node instanceof MonitoredNode) {
183184
$link = Html::tag('a', ['href' => $url, 'data-base-target' => '_next'], $node->getAlias());
184185
} else {
185-
$link = Html::tag('a', ['href' => $url], $node->getAlias());
186+
$link = Html::tag(
187+
'a',
188+
['href' => $url],
189+
HtmlElement::create('span', ['class' => 'text', 'title' => $node->getAlias()], $node->getAlias())
190+
);
186191
}
187192

188193
return $link;

library/Businessprocess/Web/Component/BpDashboardTile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(BpConfig $bp, $title, $description, $icon, $url, $ur
2525
['class' => 'bp-link', 'data-base-target' => '_main'],
2626
Html::tag('a', $attributes, Html::tag('i', ['class' => 'icon icon-' . $icon]))
2727
->add(Html::tag('span', ['class' => 'header'], $title))
28-
->add($description)
28+
->add(Html::tag('span', ['class' => 'text', 'title' => $description], $description))
2929
));
3030

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

library/Businessprocess/Web/Component/Dashboard.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
use Icinga\Module\Businessprocess\State\MonitoringState;
1010
use Icinga\Module\Businessprocess\Storage\Storage;
1111
use ipl\Html\BaseHtmlElement;
12+
use ipl\Html\FormattedString;
1213
use ipl\Html\Html;
14+
use ipl\Html\HtmlElement;
1315

1416
class Dashboard extends BaseHtmlElement
1517
{
@@ -88,9 +90,16 @@ protected function __construct(Auth $auth, Storage $storage)
8890
$meta = $storage->loadMetadata($name);
8991
$title = $meta->get('Title');
9092
if ($title) {
91-
$title = sprintf('%s (%s)', $title, $name);
93+
$title = FormattedString::create(
94+
'%s %s',
95+
HtmlElement::create('span', ['class' => 'text', 'title' => $title], $title),
96+
HtmlElement::create('span', ['class' => 'header-id', 'title' => $name], '(' . $name . ')')
97+
);
9298
} else {
93-
$title = $name;
99+
$title = FormattedString::create(
100+
'%s',
101+
HtmlElement::create('span', ['class' => 'text', 'title' => $name], $name)
102+
);
94103
}
95104

96105
$bp = $storage->loadProcess($name);

public/css/module.less

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ a:focus {
66
}
77
}
88

9+
.text {
10+
display: block;
11+
overflow: hidden;
12+
text-overflow: ellipsis;
13+
max-width: 100%;
14+
}
15+
916
.action-bar {
1017
display: flex;
1118
align-items: center;
@@ -317,6 +324,11 @@ ul.bp {
317324
}
318325

319326
.bp-link {
327+
.text {
328+
display: -webkit-box;
329+
-webkit-line-clamp: 2;
330+
-webkit-box-orient: vertical;
331+
}
320332
> a {
321333
text-decoration: none;
322334
color: @gray;
@@ -327,6 +339,18 @@ ul.bp {
327339

328340
> span.header {
329341
color: @text-color;
342+
.text {
343+
display: -webkit-box;
344+
-webkit-line-clamp: 2;
345+
-webkit-box-orient: vertical;
346+
}
347+
.header-id {
348+
display: block;
349+
white-space: nowrap;
350+
overflow: hidden;
351+
text-overflow: ellipsis;
352+
max-width: 100%;
353+
}
330354
}
331355
}
332356
}
@@ -599,6 +623,7 @@ td > a > .state-badges {
599623
color: @icinga-blue;
600624
margin: 0;
601625
font-size: 1.2em;
626+
max-width: 10em;
602627
text-decoration: none;
603628
padding-left: 2em;
604629
line-height: 2.5em;
@@ -708,8 +733,21 @@ td > a > .state-badges {
708733
}
709734
}
710735

736+
.breadcrumb .process-node {
737+
.text {
738+
white-space: nowrap;
739+
margin-top: -2.5em;
740+
margin-left: 1.2em;
741+
}
742+
}
743+
711744
/** END of breadcrumb **/
712745

746+
.tiles .process-node .text {
747+
display: -webkit-box;
748+
-webkit-line-clamp: 2;
749+
-webkit-box-orient: vertical;
750+
}
713751

714752
ul.error, ul.warning {
715753
padding: 0;

0 commit comments

Comments
 (0)