Skip to content

Commit af4b98f

Browse files
sukhwinder33445nilmerg
authored andcommitted
Use fontawesome icons with ipl\Web\Widget\Icon class everywhere
1 parent 1360e1e commit af4b98f

File tree

10 files changed

+87
-69
lines changed

10 files changed

+87
-69
lines changed

application/controllers/ProcessController.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use ipl\Html\Text;
3535
use ipl\Web\Control\SortControl;
3636
use ipl\Web\Widget\Link;
37+
use ipl\Web\Widget\Icon;
3738

3839
class ProcessController extends Controller
3940
{
@@ -184,7 +185,7 @@ protected function prepareControls($bp, $renderer)
184185
'href' => $this->url()->without('showFullscreen')->without('view'),
185186
'title' => $this->translate('Leave full screen and switch back to normal mode')
186187
],
187-
Html::tag('i', ['class' => 'icon icon-resize-small'])
188+
new Icon('down-left-and-up-right-to-center')
188189
));
189190
}
190191

@@ -603,10 +604,12 @@ protected function createConfigActionBar(BpConfig $config, $showDiff = false)
603604
'a',
604605
[
605606
'href' => Url::fromPath('businessprocess/process/source', $params),
606-
'class' => 'icon-doc-text',
607607
'title' => $this->translate('Show source code')
608608
],
609-
$this->translate('Source')
609+
[
610+
new Icon('file-lines'),
611+
$this->translate('Source'),
612+
]
610613
));
611614
} else {
612615
$params = array(
@@ -618,22 +621,26 @@ protected function createConfigActionBar(BpConfig $config, $showDiff = false)
618621
'a',
619622
[
620623
'href' => Url::fromPath('businessprocess/process/source', $params),
621-
'class' => 'icon-flapping',
622624
'title' => $this->translate('Highlight changes')
623625
],
624-
$this->translate('Diff')
626+
[
627+
new Icon('shuffle'),
628+
$this->translate('Diff')
629+
]
625630
));
626631
}
627632

628633
$actionBar->add(Html::tag(
629634
'a',
630635
[
631636
'href' => Url::fromPath('businessprocess/process/download', ['config' => $config->getName()]),
632-
'class' => 'icon-download',
633637
'target' => '_blank',
634638
'title' => $this->translate('Download process configuration')
635639
],
636-
$this->translate('Download')
640+
[
641+
new Icon('download'),
642+
$this->translate('Download')
643+
]
637644
));
638645

639646
return $actionBar;

library/Businessprocess/BpNode.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Icinga\Exception\ConfigurationError;
66
use Icinga\Exception\NotFoundError;
77
use Icinga\Module\Businessprocess\Exception\NestingError;
8+
use ipl\Web\Widget\Icon;
89

910
class BpNode extends Node
1011
{
@@ -639,7 +640,7 @@ public function operatorHtml()
639640
}
640641
}
641642

642-
public function getIcon()
643+
public function getIcon(): Icon
643644
{
644645
$this->icon = $this->hasParents() ? 'cubes' : 'sitemap';
645646
return parent::getIcon();

library/Businessprocess/HostNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class HostNode extends MonitoredNode
3131

3232
protected $className = 'host';
3333

34-
protected $icon = 'host';
34+
protected $icon = 'laptop';
3535

3636
public function __construct($object)
3737
{

library/Businessprocess/Node.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Icinga\Exception\ProgrammingError;
66
use ipl\Html\Html;
7+
use ipl\Web\Widget\Icon;
78

89
abstract class Node
910
{
@@ -463,14 +464,12 @@ public function getObjectClassName()
463464

464465
public function getLink()
465466
{
466-
return Html::tag('a', ['href' => '#', 'class' => 'toggle'], Html::tag('i', [
467-
'class' => 'icon icon-down-dir'
468-
]));
467+
return Html::tag('a', ['href' => '#', 'class' => 'toggle'], new Icon('caret-down'));
469468
}
470469

471-
public function getIcon()
470+
public function getIcon(): Icon
472471
{
473-
return Html::tag('i', ['class' => 'icon icon-' . ($this->icon ?: 'attention-circled')]);
472+
return new Icon($this->icon ?? 'circle-exclamation');
474473
}
475474

476475
public function operatorHtml()

library/Businessprocess/Renderer/Breadcrumb.php

Lines changed: 2 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\Web\Widget\Icon;
1011

1112
class Breadcrumb extends BaseHtmlElement
1213
{
@@ -37,7 +38,7 @@ public static function create(Renderer $renderer)
3738
'href' => Url::fromPath('businessprocess'),
3839
'title' => mt('businessprocess', 'Show Overview')
3940
],
40-
Html::tag('i', ['class' => 'icon icon-home'])
41+
new Icon('house')
4142
)
4243
));
4344
$breadcrumb->add(Html::tag('li')->add(

library/Businessprocess/Renderer/TileRenderer/NodeTile.php

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44

55
use Icinga\Date\DateFormatter;
66
use Icinga\Module\Businessprocess\BpNode;
7-
use Icinga\Module\Businessprocess\HostNode;
87
use Icinga\Module\Businessprocess\ImportedNode;
98
use Icinga\Module\Businessprocess\MonitoredNode;
109
use Icinga\Module\Businessprocess\Node;
1110
use Icinga\Module\Businessprocess\Renderer\Renderer;
12-
use Icinga\Module\Businessprocess\ServiceNode;
1311
use Icinga\Web\Url;
1412
use ipl\Html\BaseHtmlElement;
1513
use ipl\Html\Html;
@@ -202,14 +200,14 @@ protected function addDetailsActions()
202200
'href' => $url->with('mode', 'tile'),
203201
'title' => mt('businessprocess', 'Show tiles for this subtree')
204202
],
205-
Html::tag('i', ['class' => 'icon icon-dashboard'])
203+
new Icon('grip')
206204
))->add(Html::tag(
207205
'a',
208206
[
209207
'href' => $url->with('mode', 'tree'),
210208
'title' => mt('businessprocess', 'Show this subtree as a tree')
211209
],
212-
Html::tag('i', ['class' => 'icon icon-sitemap'])
210+
new Icon('sitemap')
213211
));
214212
if ($node instanceof ImportedNode) {
215213
if ($node->getBpConfig()->hasNode($node->getName())) {
@@ -223,7 +221,7 @@ protected function addDetailsActions()
223221
'Show this process as part of its original configuration'
224222
)
225223
],
226-
Html::tag('i', ['class' => 'icon icon-forward'])
224+
new Icon('share')
227225
));
228226
}
229227
}
@@ -238,28 +236,19 @@ protected function addDetailsActions()
238236
'class' => 'node-info',
239237
'title' => sprintf('%s: %s', mt('businessprocess', 'More information'), $url)
240238
],
241-
Html::tag('i', ['class' => 'icon icon-info-circled'])
239+
new Icon('info')
242240
);
243241
if (preg_match('#^http(?:s)?://#', $url)) {
244242
$link->addAttributes(['target' => '_blank']);
245243
}
246244
$this->actions()->add($link);
247245
}
248246
} else {
249-
// $url = $this->makeMonitoredNodeUrl($node);
250-
if ($node instanceof ServiceNode) {
251-
$this->actions()->add(Html::tag(
252-
'a',
253-
['href' => $node->getUrl(), 'data-base-target' => '_next'],
254-
Html::tag('i', ['class' => 'icon icon-service'])
255-
));
256-
} elseif ($node instanceof HostNode) {
257-
$this->actions()->add(Html::tag(
258-
'a',
259-
['href' => $node->getUrl(), 'data-base-target' => '_next'],
260-
Html::tag('i', ['class' => 'icon icon-host'])
261-
));
262-
}
247+
$this->actions()->add(Html::tag(
248+
'a',
249+
['href' => $node->getUrl(), 'data-base-target' => '_next'],
250+
$node->getIcon()
251+
));
263252
}
264253

265254
if ($node->isAcknowledged()) {
@@ -299,7 +288,7 @@ protected function addActionLinks()
299288
'Show the business impact of this node by simulating a specific state'
300289
)
301290
],
302-
Html::tag('i', ['class' => 'icon icon-magic'])
291+
new Icon('wand-magic-sparkles')
303292
));
304293

305294
$this->actions()->add(Html::tag(
@@ -310,7 +299,7 @@ protected function addActionLinks()
310299
->with('editmonitorednode', $this->node->getName()),
311300
'title' => mt('businessprocess', 'Modify this monitored node')
312301
],
313-
Html::tag('i', ['class' => 'icon icon-edit'])
302+
new Icon('edit')
314303
));
315304
}
316305

@@ -327,7 +316,7 @@ protected function addActionLinks()
327316
->with('editnode', $this->node->getName()),
328317
'title' => mt('businessprocess', 'Modify this business process node')
329318
],
330-
Html::tag('i', ['class' => 'icon icon-edit'])
319+
new Icon('edit')
331320
));
332321

333322
$addUrl = $baseUrl->with([
@@ -341,7 +330,7 @@ protected function addActionLinks()
341330
'href' => $addUrl,
342331
'title' => mt('businessprocess', 'Add a new sub-node to this business process')
343332
],
344-
Html::tag('i', ['class' => 'icon icon-plus'])
333+
new Icon('plus')
345334
));
346335
}
347336
}
@@ -358,7 +347,7 @@ protected function addActionLinks()
358347
'href' => $baseUrl->with($params),
359348
'title' => mt('businessprocess', 'Delete this node')
360349
],
361-
Html::tag('i', ['class' => 'icon icon-cancel'])
350+
new Icon('xmark')
362351
));
363352
}
364353
}

library/Businessprocess/Renderer/TreeRenderer.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function getNodeIcons(Node $node, array $path = null, BpNode $parent = nu
120120
{
121121
$icons = [];
122122
if (empty($path) && $node instanceof BpNode) {
123-
$icons[] = Html::tag('i', ['class' => 'icon icon-sitemap']);
123+
$icons[] = new Icon('sitemap');
124124
} else {
125125
$icons[] = $node->getIcon();
126126
}
@@ -137,7 +137,7 @@ public function getNodeIcons(Node $node, array $path = null, BpNode $parent = nu
137137
]);
138138

139139
if ($node->isAcknowledged()) {
140-
$icons[] = Html::tag('i', ['class' => 'icon icon-ok']);
140+
$icons[] = new Icon('check');
141141
} elseif ($node->isInDowntime()) {
142142
$icons[] = new Icon('plug');
143143
}
@@ -157,7 +157,8 @@ public function getOverriddenState($fakeState, Node $node)
157157
)
158158
])
159159
);
160-
$overriddenState->add(Html::tag('i', ['class' => 'icon icon-right-small']));
160+
161+
$overriddenState->add(new Icon('arrow-right'));
161162
$overriddenState->add(
162163
(new StateBall(strtolower($node->getStateName($fakeState)), StateBall::SIZE_MEDIUM))
163164
->addAttributes([
@@ -232,7 +233,7 @@ public function renderNode(BpConfig $bp, Node $node, $path = array())
232233
$summary->add($this->getActionIcons($bp, $node));
233234
} elseif ($differentConfig) {
234235
$summary->add($this->actionIcon(
235-
'forward',
236+
'share',
236237
$this->getSourceUrl($node)->addParams(['mode' => 'tree'])->getAbsoluteUrl(),
237238
mt('businessprocess', 'Show this process as part of its original configuration')
238239
)->addAttributes(['data-base-target' => '_next']));
@@ -331,7 +332,7 @@ protected function createEditAction(BpConfig $bp, BpNode $node)
331332
protected function createSimulationAction(BpConfig $bp, Node $node)
332333
{
333334
return $this->actionIcon(
334-
'magic',
335+
'wand-magic-sparkles',
335336
$this->getUrl()->with(array(
336337
//'config' => $bp->getName(),
337338
'action' => 'simulation',
@@ -345,7 +346,7 @@ protected function createInfoAction(BpNode $node)
345346
{
346347
$url = $node->getInfoUrl();
347348
return $this->actionIcon(
348-
'help',
349+
'question',
349350
$url,
350351
sprintf('%s: %s', mt('businessprocess', 'More information'), $url)
351352
)->addAttributes(['target' => '_blank']);
@@ -360,7 +361,7 @@ protected function actionIcon($icon, $url, $title)
360361
'title' => $title,
361362
'class' => 'action-link'
362363
],
363-
Html::tag('i', ['class' => 'icon icon-' . $icon])
364+
new Icon($icon)
364365
);
365366
}
366367

library/Businessprocess/ServiceNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ServiceNode extends MonitoredNode
1515

1616
protected $className = 'service';
1717

18-
protected $icon = 'service';
18+
protected $icon = 'gear';
1919

2020
public function __construct($object)
2121
{

0 commit comments

Comments
 (0)