Skip to content

Handle long item names #347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@
$this->provideJsFile('vendor/Sortable.js');
$this->provideJsFile('behavior/sortable.js');
$this->provideJsFile('vendor/jquery.fn.sortable.js');
$this->provideCssFile('mixins.less');
7 changes: 6 additions & 1 deletion library/Businessprocess/Renderer/Breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Web\Widget\Icon;
use ipl\Html\HtmlElement;

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
11 changes: 10 additions & 1 deletion library/Businessprocess/Renderer/TileRenderer/NodeTile.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use ipl\Html\Html;
use ipl\Web\Widget\Icon;
use ipl\Web\Widget\Link;
use ipl\Html\HtmlElement;
use ipl\Web\Widget\StateBall;

class NodeTile extends BaseHtmlElement
Expand Down Expand Up @@ -88,6 +89,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 Expand Up @@ -179,7 +188,7 @@ protected function getMainNodeLink()
$node->getAlias() ?? $node->getName()
);
} else {
$link = Html::tag('a', ['href' => $url], $node->getAlias());
$link = Html::tag('a', ['href' => $url, 'title' => $node->getAlias()], $node->getAlias());
}

return $link;
Expand Down
2 changes: 1 addition & 1 deletion library/Businessprocess/Renderer/TreeRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public function renderNode(BpConfig $bp, Node $node, $path = array())

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

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

if ($node instanceof BpNode) {
$summary->add(Html::tag('span', ['class' => 'op'], $node->operatorHtml()));
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' => $title], $title))
->add(Html::tag('span', ['class' => 'text', 'title' => $description], $description))
));

$tiles = Html::tag('div', ['class' => 'bp-root-tiles']);
Expand Down
2 changes: 2 additions & 0 deletions library/Businessprocess/Web/Component/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
use Icinga\Module\Businessprocess\State\MonitoringState;
use Icinga\Module\Businessprocess\Storage\Storage;
use ipl\Html\BaseHtmlElement;
use ipl\Html\FormattedString;
use ipl\Html\Html;
use ipl\Html\HtmlElement;

class Dashboard extends BaseHtmlElement
{
Expand Down
10 changes: 10 additions & 0 deletions public/css/mixins.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.line-clamp(@numOfLines: 2) when (@numOfLines > 1) {
display: -webkit-box;
-webkit-line-clamp: @numOfLines;
-webkit-box-orient: vertical;
}

.text-ellipsis() {
overflow: hidden;
text-overflow: ellipsis;
}
63 changes: 57 additions & 6 deletions public/css/module.less
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ ul.bp {
> span {
font-size: 1.25em;

&.text {
flex: 1 1 auto;
width: 0;
.text-ellipsis();
white-space: nowrap;
}

&.op {
padding: .1em .5em;
border-radius: .5em;
Expand Down Expand Up @@ -344,6 +351,10 @@ ul.broken-files {
}

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

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

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

.header-id {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
}
}
}
}
Expand Down Expand Up @@ -450,7 +469,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 +484,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,12 +500,17 @@ td > a > .state-badges {

> a {
display: block;
}

> a {
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();
.line-clamp(2);
}

&:hover {
Expand Down Expand Up @@ -634,6 +656,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 @@ -737,6 +760,22 @@ td > a > .state-badges {
text-decoration: underline;
}

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

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

.text {
white-space: nowrap;
}
}

#layout.twocols, #layout.layout-minimal, div.compact {
.breadcrumb {
font-size: 0.833em;
Expand All @@ -745,6 +784,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