mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-05-28 04:34:08 -04:00
Use fontawesome icons with ipl\Web\Widget\Icon class everywhere
This commit is contained in:
parent
1360e1e4a0
commit
af4b98faeb
10 changed files with 87 additions and 69 deletions
|
|
@ -34,6 +34,7 @@ use ipl\Html\TemplateString;
|
|||
use ipl\Html\Text;
|
||||
use ipl\Web\Control\SortControl;
|
||||
use ipl\Web\Widget\Link;
|
||||
use ipl\Web\Widget\Icon;
|
||||
|
||||
class ProcessController extends Controller
|
||||
{
|
||||
|
|
@ -184,7 +185,7 @@ class ProcessController extends Controller
|
|||
'href' => $this->url()->without('showFullscreen')->without('view'),
|
||||
'title' => $this->translate('Leave full screen and switch back to normal mode')
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-resize-small'])
|
||||
new Icon('down-left-and-up-right-to-center')
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -603,10 +604,12 @@ class ProcessController extends Controller
|
|||
'a',
|
||||
[
|
||||
'href' => Url::fromPath('businessprocess/process/source', $params),
|
||||
'class' => 'icon-doc-text',
|
||||
'title' => $this->translate('Show source code')
|
||||
],
|
||||
$this->translate('Source')
|
||||
[
|
||||
new Icon('file-lines'),
|
||||
$this->translate('Source'),
|
||||
]
|
||||
));
|
||||
} else {
|
||||
$params = array(
|
||||
|
|
@ -618,10 +621,12 @@ class ProcessController extends Controller
|
|||
'a',
|
||||
[
|
||||
'href' => Url::fromPath('businessprocess/process/source', $params),
|
||||
'class' => 'icon-flapping',
|
||||
'title' => $this->translate('Highlight changes')
|
||||
],
|
||||
$this->translate('Diff')
|
||||
[
|
||||
new Icon('shuffle'),
|
||||
$this->translate('Diff')
|
||||
]
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -629,11 +634,13 @@ class ProcessController extends Controller
|
|||
'a',
|
||||
[
|
||||
'href' => Url::fromPath('businessprocess/process/download', ['config' => $config->getName()]),
|
||||
'class' => 'icon-download',
|
||||
'target' => '_blank',
|
||||
'title' => $this->translate('Download process configuration')
|
||||
],
|
||||
$this->translate('Download')
|
||||
[
|
||||
new Icon('download'),
|
||||
$this->translate('Download')
|
||||
]
|
||||
));
|
||||
|
||||
return $actionBar;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace Icinga\Module\Businessprocess;
|
|||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Exception\NotFoundError;
|
||||
use Icinga\Module\Businessprocess\Exception\NestingError;
|
||||
use ipl\Web\Widget\Icon;
|
||||
|
||||
class BpNode extends Node
|
||||
{
|
||||
|
|
@ -639,7 +640,7 @@ class BpNode extends Node
|
|||
}
|
||||
}
|
||||
|
||||
public function getIcon()
|
||||
public function getIcon(): Icon
|
||||
{
|
||||
$this->icon = $this->hasParents() ? 'cubes' : 'sitemap';
|
||||
return parent::getIcon();
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class HostNode extends MonitoredNode
|
|||
|
||||
protected $className = 'host';
|
||||
|
||||
protected $icon = 'host';
|
||||
protected $icon = 'laptop';
|
||||
|
||||
public function __construct($object)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace Icinga\Module\Businessprocess;
|
|||
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use ipl\Html\Html;
|
||||
use ipl\Web\Widget\Icon;
|
||||
|
||||
abstract class Node
|
||||
{
|
||||
|
|
@ -463,14 +464,12 @@ abstract class Node
|
|||
|
||||
public function getLink()
|
||||
{
|
||||
return Html::tag('a', ['href' => '#', 'class' => 'toggle'], Html::tag('i', [
|
||||
'class' => 'icon icon-down-dir'
|
||||
]));
|
||||
return Html::tag('a', ['href' => '#', 'class' => 'toggle'], new Icon('caret-down'));
|
||||
}
|
||||
|
||||
public function getIcon()
|
||||
public function getIcon(): Icon
|
||||
{
|
||||
return Html::tag('i', ['class' => 'icon icon-' . ($this->icon ?: 'attention-circled')]);
|
||||
return new Icon($this->icon ?? 'circle-exclamation');
|
||||
}
|
||||
|
||||
public function operatorHtml()
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Icinga\Module\Businessprocess\Renderer\TileRenderer\NodeTile;
|
|||
use Icinga\Module\Businessprocess\Web\Url;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
use ipl\Html\Html;
|
||||
use ipl\Web\Widget\Icon;
|
||||
|
||||
class Breadcrumb extends BaseHtmlElement
|
||||
{
|
||||
|
|
@ -37,7 +38,7 @@ class Breadcrumb extends BaseHtmlElement
|
|||
'href' => Url::fromPath('businessprocess'),
|
||||
'title' => mt('businessprocess', 'Show Overview')
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-home'])
|
||||
new Icon('house')
|
||||
)
|
||||
));
|
||||
$breadcrumb->add(Html::tag('li')->add(
|
||||
|
|
|
|||
|
|
@ -4,12 +4,10 @@ namespace Icinga\Module\Businessprocess\Renderer\TileRenderer;
|
|||
|
||||
use Icinga\Date\DateFormatter;
|
||||
use Icinga\Module\Businessprocess\BpNode;
|
||||
use Icinga\Module\Businessprocess\HostNode;
|
||||
use Icinga\Module\Businessprocess\ImportedNode;
|
||||
use Icinga\Module\Businessprocess\MonitoredNode;
|
||||
use Icinga\Module\Businessprocess\Node;
|
||||
use Icinga\Module\Businessprocess\Renderer\Renderer;
|
||||
use Icinga\Module\Businessprocess\ServiceNode;
|
||||
use Icinga\Web\Url;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
use ipl\Html\Html;
|
||||
|
|
@ -202,14 +200,14 @@ class NodeTile extends BaseHtmlElement
|
|||
'href' => $url->with('mode', 'tile'),
|
||||
'title' => mt('businessprocess', 'Show tiles for this subtree')
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-dashboard'])
|
||||
new Icon('grip')
|
||||
))->add(Html::tag(
|
||||
'a',
|
||||
[
|
||||
'href' => $url->with('mode', 'tree'),
|
||||
'title' => mt('businessprocess', 'Show this subtree as a tree')
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-sitemap'])
|
||||
new Icon('sitemap')
|
||||
));
|
||||
if ($node instanceof ImportedNode) {
|
||||
if ($node->getBpConfig()->hasNode($node->getName())) {
|
||||
|
|
@ -223,7 +221,7 @@ class NodeTile extends BaseHtmlElement
|
|||
'Show this process as part of its original configuration'
|
||||
)
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-forward'])
|
||||
new Icon('share')
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -238,7 +236,7 @@ class NodeTile extends BaseHtmlElement
|
|||
'class' => 'node-info',
|
||||
'title' => sprintf('%s: %s', mt('businessprocess', 'More information'), $url)
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-info-circled'])
|
||||
new Icon('info')
|
||||
);
|
||||
if (preg_match('#^http(?:s)?://#', $url)) {
|
||||
$link->addAttributes(['target' => '_blank']);
|
||||
|
|
@ -246,20 +244,11 @@ class NodeTile extends BaseHtmlElement
|
|||
$this->actions()->add($link);
|
||||
}
|
||||
} else {
|
||||
// $url = $this->makeMonitoredNodeUrl($node);
|
||||
if ($node instanceof ServiceNode) {
|
||||
$this->actions()->add(Html::tag(
|
||||
'a',
|
||||
['href' => $node->getUrl(), 'data-base-target' => '_next'],
|
||||
Html::tag('i', ['class' => 'icon icon-service'])
|
||||
));
|
||||
} elseif ($node instanceof HostNode) {
|
||||
$this->actions()->add(Html::tag(
|
||||
'a',
|
||||
['href' => $node->getUrl(), 'data-base-target' => '_next'],
|
||||
Html::tag('i', ['class' => 'icon icon-host'])
|
||||
));
|
||||
}
|
||||
$this->actions()->add(Html::tag(
|
||||
'a',
|
||||
['href' => $node->getUrl(), 'data-base-target' => '_next'],
|
||||
$node->getIcon()
|
||||
));
|
||||
}
|
||||
|
||||
if ($node->isAcknowledged()) {
|
||||
|
|
@ -299,7 +288,7 @@ class NodeTile extends BaseHtmlElement
|
|||
'Show the business impact of this node by simulating a specific state'
|
||||
)
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-magic'])
|
||||
new Icon('wand-magic-sparkles')
|
||||
));
|
||||
|
||||
$this->actions()->add(Html::tag(
|
||||
|
|
@ -310,7 +299,7 @@ class NodeTile extends BaseHtmlElement
|
|||
->with('editmonitorednode', $this->node->getName()),
|
||||
'title' => mt('businessprocess', 'Modify this monitored node')
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-edit'])
|
||||
new Icon('edit')
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -327,7 +316,7 @@ class NodeTile extends BaseHtmlElement
|
|||
->with('editnode', $this->node->getName()),
|
||||
'title' => mt('businessprocess', 'Modify this business process node')
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-edit'])
|
||||
new Icon('edit')
|
||||
));
|
||||
|
||||
$addUrl = $baseUrl->with([
|
||||
|
|
@ -341,7 +330,7 @@ class NodeTile extends BaseHtmlElement
|
|||
'href' => $addUrl,
|
||||
'title' => mt('businessprocess', 'Add a new sub-node to this business process')
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-plus'])
|
||||
new Icon('plus')
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -358,7 +347,7 @@ class NodeTile extends BaseHtmlElement
|
|||
'href' => $baseUrl->with($params),
|
||||
'title' => mt('businessprocess', 'Delete this node')
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-cancel'])
|
||||
new Icon('xmark')
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class TreeRenderer extends Renderer
|
|||
{
|
||||
$icons = [];
|
||||
if (empty($path) && $node instanceof BpNode) {
|
||||
$icons[] = Html::tag('i', ['class' => 'icon icon-sitemap']);
|
||||
$icons[] = new Icon('sitemap');
|
||||
} else {
|
||||
$icons[] = $node->getIcon();
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ class TreeRenderer extends Renderer
|
|||
]);
|
||||
|
||||
if ($node->isAcknowledged()) {
|
||||
$icons[] = Html::tag('i', ['class' => 'icon icon-ok']);
|
||||
$icons[] = new Icon('check');
|
||||
} elseif ($node->isInDowntime()) {
|
||||
$icons[] = new Icon('plug');
|
||||
}
|
||||
|
|
@ -157,7 +157,8 @@ class TreeRenderer extends Renderer
|
|||
)
|
||||
])
|
||||
);
|
||||
$overriddenState->add(Html::tag('i', ['class' => 'icon icon-right-small']));
|
||||
|
||||
$overriddenState->add(new Icon('arrow-right'));
|
||||
$overriddenState->add(
|
||||
(new StateBall(strtolower($node->getStateName($fakeState)), StateBall::SIZE_MEDIUM))
|
||||
->addAttributes([
|
||||
|
|
@ -232,7 +233,7 @@ class TreeRenderer extends Renderer
|
|||
$summary->add($this->getActionIcons($bp, $node));
|
||||
} elseif ($differentConfig) {
|
||||
$summary->add($this->actionIcon(
|
||||
'forward',
|
||||
'share',
|
||||
$this->getSourceUrl($node)->addParams(['mode' => 'tree'])->getAbsoluteUrl(),
|
||||
mt('businessprocess', 'Show this process as part of its original configuration')
|
||||
)->addAttributes(['data-base-target' => '_next']));
|
||||
|
|
@ -331,7 +332,7 @@ class TreeRenderer extends Renderer
|
|||
protected function createSimulationAction(BpConfig $bp, Node $node)
|
||||
{
|
||||
return $this->actionIcon(
|
||||
'magic',
|
||||
'wand-magic-sparkles',
|
||||
$this->getUrl()->with(array(
|
||||
//'config' => $bp->getName(),
|
||||
'action' => 'simulation',
|
||||
|
|
@ -345,7 +346,7 @@ class TreeRenderer extends Renderer
|
|||
{
|
||||
$url = $node->getInfoUrl();
|
||||
return $this->actionIcon(
|
||||
'help',
|
||||
'question',
|
||||
$url,
|
||||
sprintf('%s: %s', mt('businessprocess', 'More information'), $url)
|
||||
)->addAttributes(['target' => '_blank']);
|
||||
|
|
@ -360,7 +361,7 @@ class TreeRenderer extends Renderer
|
|||
'title' => $title,
|
||||
'class' => 'action-link'
|
||||
],
|
||||
Html::tag('i', ['class' => 'icon icon-' . $icon])
|
||||
new Icon($icon)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class ServiceNode extends MonitoredNode
|
|||
|
||||
protected $className = 'service';
|
||||
|
||||
protected $icon = 'service';
|
||||
protected $icon = 'gear';
|
||||
|
||||
public function __construct($object)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use Icinga\Module\Businessprocess\Renderer\Renderer;
|
|||
use Icinga\Module\Businessprocess\Renderer\TreeRenderer;
|
||||
use Icinga\Web\Url;
|
||||
use ipl\Html\Html;
|
||||
use ipl\Web\Widget\Icon;
|
||||
|
||||
class RenderedProcessActionBar extends ActionBar
|
||||
{
|
||||
|
|
@ -34,8 +35,8 @@ class RenderedProcessActionBar extends ActionBar
|
|||
}
|
||||
|
||||
$link->add([
|
||||
Html::tag('i', ['class' => 'icon icon-dashboard' . ($renderer instanceof TreeRenderer ? '' : ' active')]),
|
||||
Html::tag('i', ['class' => 'icon icon-sitemap' . ($renderer instanceof TreeRenderer ? ' active' : '')])
|
||||
new Icon('grip', ['class' => $renderer instanceof TreeRenderer ? null : 'active']),
|
||||
new Icon('sitemap', ['class' => $renderer instanceof TreeRenderer ? 'active' : null])
|
||||
]);
|
||||
|
||||
$this->add(
|
||||
|
|
@ -50,9 +51,11 @@ class RenderedProcessActionBar extends ActionBar
|
|||
'data-base-target' => '_main',
|
||||
'href' => $url->with('showFullscreen', true),
|
||||
'title' => mt('businessprocess', 'Switch to fullscreen mode'),
|
||||
'class' => 'icon-resize-full-alt'
|
||||
],
|
||||
mt('businessprocess', 'Fullscreen')
|
||||
[
|
||||
new Icon('maximize'),
|
||||
mt('businessprocess', 'Fullscreen')
|
||||
]
|
||||
));
|
||||
|
||||
$hasChanges = $config->hasSimulations() || $config->hasBeenChanged();
|
||||
|
|
@ -66,8 +69,7 @@ class RenderedProcessActionBar extends ActionBar
|
|||
'Imported processes can only be changed in their original configuration'
|
||||
)
|
||||
]);
|
||||
$span->add(Html::tag('i', ['class' => 'icon icon-lock']))
|
||||
->add(mt('businessprocess', 'Editing Locked'));
|
||||
$span->add([new Icon('lock'), mt('businessprocess', 'Editing Locked')]);
|
||||
$this->add($span);
|
||||
} else {
|
||||
$this->add(Html::tag(
|
||||
|
|
@ -75,9 +77,11 @@ class RenderedProcessActionBar extends ActionBar
|
|||
[
|
||||
'href' => $url->with('unlocked', true),
|
||||
'title' => mt('businessprocess', 'Click to unlock editing for this process'),
|
||||
'class' => 'icon-lock'
|
||||
],
|
||||
mt('businessprocess', 'Unlock Editing')
|
||||
[
|
||||
new Icon('lock'),
|
||||
mt('businessprocess', 'Unlock Editing')
|
||||
]
|
||||
));
|
||||
}
|
||||
} elseif (! $hasChanges) {
|
||||
|
|
@ -86,9 +90,11 @@ class RenderedProcessActionBar extends ActionBar
|
|||
[
|
||||
'href' => $url->without('unlocked')->without('action'),
|
||||
'title' => mt('businessprocess', 'Click to lock editing for this process'),
|
||||
'class' => 'icon-lock-open'
|
||||
],
|
||||
mt('businessprocess', 'Lock Editing')
|
||||
[
|
||||
new Icon('lock-open'),
|
||||
mt('businessprocess', 'Lock Editing')
|
||||
]
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -100,9 +106,11 @@ class RenderedProcessActionBar extends ActionBar
|
|||
'data-base-target' => '_next',
|
||||
'href' => Url::fromPath('businessprocess/process/config', $this->currentProcessParams($url)),
|
||||
'title' => mt('businessprocess', 'Modify this process'),
|
||||
'class' => 'icon-wrench'
|
||||
],
|
||||
mt('businessprocess', 'Config')
|
||||
[
|
||||
new Icon('wrench'),
|
||||
mt('businessprocess', 'Config')
|
||||
]
|
||||
));
|
||||
} else {
|
||||
$this->add(Html::tag(
|
||||
|
|
@ -113,9 +121,11 @@ class RenderedProcessActionBar extends ActionBar
|
|||
'editnode' => $url->getParam('node')
|
||||
])->getAbsoluteUrl(),
|
||||
'title' => mt('businessprocess', 'Modify this process'),
|
||||
'class' => 'icon-wrench'
|
||||
],
|
||||
mt('businessprocess', 'Config')
|
||||
[
|
||||
new Icon('wrench'),
|
||||
mt('businessprocess', 'Config')
|
||||
]
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -126,9 +136,12 @@ class RenderedProcessActionBar extends ActionBar
|
|||
[
|
||||
'href' => $url->with('action', 'add'),
|
||||
'title' => mt('businessprocess', 'Add a new business process node'),
|
||||
'class' => 'icon-plus button-link'
|
||||
'class' => 'button-link'
|
||||
],
|
||||
mt('businessprocess', 'Add Node')
|
||||
[
|
||||
new Icon('plus'),
|
||||
mt('businessprocess', 'Add Node')
|
||||
]
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,14 +132,11 @@ ul.bp {
|
|||
}
|
||||
|
||||
li {
|
||||
i.icon-service {
|
||||
> .icon,
|
||||
summary > .icon {
|
||||
opacity: .75;
|
||||
}
|
||||
|
||||
i.icon-sitemap {
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
span.state-ball ~ i:last-of-type {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
|
@ -260,6 +257,16 @@ ul.bp {
|
|||
.overridden-state {
|
||||
margin-left: auto;
|
||||
margin-right: 1em;
|
||||
|
||||
i.icon {
|
||||
font-size: 0.75em;
|
||||
line-height: 0.08333em;
|
||||
vertical-align: 0.125em;
|
||||
|
||||
&::before {
|
||||
margin: 0 .3em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue