From 291249b92a2d529ef4db44ed6975f3c8b95a31a1 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Thu, 10 Aug 2023 14:48:32 +0200 Subject: [PATCH 1/2] Use `Icon` & `IcingaIcon` widget --- library/X509/CertificateDetails.php | 3 ++- library/X509/CertificatesTable.php | 17 +++++------------ library/X509/ChainDetails.php | 19 ++++++------------- library/X509/UsageTable.php | 6 ++---- public/css/module.less | 2 +- 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/library/X509/CertificateDetails.php b/library/X509/CertificateDetails.php index 131c7011..26c2db3f 100644 --- a/library/X509/CertificateDetails.php +++ b/library/X509/CertificateDetails.php @@ -8,6 +8,7 @@ use Icinga\Module\X509\Model\X509Certificate; use ipl\Html\BaseHtmlElement; use ipl\Html\Html; +use ipl\Web\Widget\IcingaIcon; /** * Widget to display X.509 certificate details @@ -92,7 +93,7 @@ protected function assemble() ]); $this->add([ - Html::tag('h2', [Html::tag('i', ['class' => 'x509-icon-cert']), $this->cert->subject]), + Html::tag('h2', [new IcingaIcon('certificate'), $this->cert->subject]), Html::tag('h3', mt('x509', 'Subject Name')), $subject, Html::tag('h3', mt('x509', 'Issuer Name')), diff --git a/library/X509/CertificatesTable.php b/library/X509/CertificatesTable.php index bf9cc82a..1c1970ec 100644 --- a/library/X509/CertificatesTable.php +++ b/library/X509/CertificatesTable.php @@ -7,6 +7,8 @@ use Icinga\Module\X509\Model\X509Certificate; use Icinga\Web\Url; use ipl\Html\Html; +use ipl\Web\Widget\IcingaIcon; +use ipl\Web\Widget\Icon; /** * Table widget to display X.509 certificates @@ -37,10 +39,7 @@ protected function createColumns() return null; } - return Html::tag( - 'i', - ['class' => 'x509-icon-ca', 'title' => mt('x509', 'Is Certificate Authority')] - ); + return new IcingaIcon('ca-check-circle', ['title' => mt('x509', 'Is Certificate Authority')]); } ], @@ -51,10 +50,7 @@ protected function createColumns() return null; } - return Html::tag( - 'i', - ['class' => 'x509-icon-self-signed', 'title' => mt('x509', 'Is Self-Signed')] - ); + return new IcingaIcon('refresh-cert', ['title' => mt('x509', 'Is Self-Signed')]); } ], @@ -65,10 +61,7 @@ protected function createColumns() return null; } - return Html::tag( - 'i', - ['class' => 'icon icon-thumbs-up', 'title' => mt('x509', 'Is Trusted')] - ); + return new Icon('thumbs-up', ['title' => mt('x509', 'Is Trusted')]); } ], diff --git a/library/X509/ChainDetails.php b/library/X509/ChainDetails.php index e604bbda..722b7b3b 100644 --- a/library/X509/ChainDetails.php +++ b/library/X509/ChainDetails.php @@ -7,6 +7,8 @@ use Icinga\Module\X509\Model\X509Certificate; use Icinga\Web\Url; use ipl\Html\Html; +use ipl\Web\Widget\IcingaIcon; +use ipl\Web\Widget\Icon; /** * Table widget to display X.509 chain details @@ -24,7 +26,7 @@ public function createColumns() [ 'attributes' => ['class' => 'icon-col'], 'renderer' => function () { - return Html::tag('i', ['class' => 'x509-icon-cert']); + return new IcingaIcon('certificate', ['title' => mt('x509', 'Is a x509 certificate')]); } ], @@ -46,10 +48,7 @@ public function createColumns() return null; } - return Html::tag( - 'i', - ['class' => 'x509-icon-ca', 'title' => mt('x509', 'Is Certificate Authority')] - ); + return new IcingaIcon('ca-check-circle', ['title' => mt('x509', 'Is Certificate Authority')]); } ], @@ -60,10 +59,7 @@ public function createColumns() return null; } - return Html::tag( - 'i', - ['class' => 'x509-icon-self-signed', 'title' => mt('x509', 'Is Self-Signed')] - ); + return new IcingaIcon('refresh-cert', ['title' => mt('x509', 'Is Self-Signed')]); } ], @@ -74,10 +70,7 @@ public function createColumns() return null; } - return Html::tag( - 'i', - ['class' => 'icon icon-thumbs-up', 'title' => mt('x509', 'Is Trusted')] - ); + return new Icon('thumbs-up', ['title' => mt('x509', 'Is Trusted')]); } ], diff --git a/library/X509/UsageTable.php b/library/X509/UsageTable.php index 32461e09..109e5eec 100644 --- a/library/X509/UsageTable.php +++ b/library/X509/UsageTable.php @@ -6,7 +6,7 @@ use Icinga\Module\X509\Model\X509Certificate; use Icinga\Web\Url; -use ipl\Html\Html; +use ipl\Web\Widget\Icon; /** * Table widget to display X.509 certificate usage @@ -27,9 +27,7 @@ public function createColumns() return $data->chain->valid; }, 'renderer' => function ($valid) { - $icon = $valid ? 'check -ok' : 'block -critical'; - - return Html::tag('i', ['class' => "icon icon-{$icon}"]); + return new Icon($valid ? 'circle-check' : 'ban', ['class' => $valid ? '-ok' : '-critical']); } ], diff --git a/public/css/module.less b/public/css/module.less index 36c91dab..13d00ddd 100644 --- a/public/css/module.less +++ b/public/css/module.less @@ -7,7 +7,7 @@ @cert-segment-color-4: #6A4C93; .cert-details { - .x509-icon-cert { + .iicon-certificate { font-size: 5em; } From de3d61a53fd4e6a4ba92ec4760912892a653e847 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Thu, 10 Aug 2023 14:49:38 +0200 Subject: [PATCH 2/2] Remove font files & `IconsController` --- application/controllers/IconsController.php | 32 ------------ configuration.php | 2 - public/css/icons.less | 52 -------------------- public/font/icons.eot | Bin 2140 -> 0 bytes public/font/icons.svg | 44 ----------------- public/font/icons.ttf | Bin 1972 -> 0 bytes public/font/icons.woff | Bin 1424 -> 0 bytes 7 files changed, 130 deletions(-) delete mode 100644 application/controllers/IconsController.php delete mode 100644 public/css/icons.less delete mode 100644 public/font/icons.eot delete mode 100644 public/font/icons.svg delete mode 100644 public/font/icons.ttf delete mode 100644 public/font/icons.woff diff --git a/application/controllers/IconsController.php b/application/controllers/IconsController.php deleted file mode 100644 index 110054eb..00000000 --- a/application/controllers/IconsController.php +++ /dev/null @@ -1,32 +0,0 @@ -_helper->viewRenderer->setNoRender(true); - $this->_helper->layout()->disableLayout(); - } - - public function indexAction() - { - $file = realpath( - $this->Module()->getBaseDir() . '/public/font/icons.' . $this->params->get('q', 'svg') - ); - - if ($file === false) { - $this->httpNotFound('File does not exist'); - } - - readfile($file); - } -} diff --git a/configuration.php b/configuration.php index 4cfe7636..259e1fcc 100644 --- a/configuration.php +++ b/configuration.php @@ -37,5 +37,3 @@ 'label' => $this->translate('SNI'), 'url' => 'sni' )); - -$this->provideCssFile('icons.less'); diff --git a/public/css/icons.less b/public/css/icons.less deleted file mode 100644 index 73701b5d..00000000 --- a/public/css/icons.less +++ /dev/null @@ -1,52 +0,0 @@ -/* Icinga Web 2 X.509 Module | (c) 2018 Icinga GmbH | GPLv2 */ - -[class^='x509-icon-'], [class*=' x509-icon-'] { - &:before { - font-style: normal; - font-weight: normal; - speak: none; - - display: inline-block; - text-decoration: inherit; - width: 1em; - margin-right: .2em; - text-align: center; - /* opacity: .8; */ - - /* For safety - reset parent styles, that can break glyph codes*/ - font-variant: normal; - text-transform: none; - - /* fix buttons height, for twitter bootstrap */ - line-height: 1em; - - /* Animation center compensation - margins should be symmetric */ - /* remove if not needed */ - margin-left: .2em; - - /* Font smoothing. That was taken from TWBS */ - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - - /* Uncomment for 3D effect */ - /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ - } -} - -@font-face { - font-family: 'Icinga Web 2 Module X.509'; - src: url('../x509/icons?q=eot#iefix') format('embedded-opentype'), - url('../x509/icons?q=woff') format('woff'), - url('../x509/icons?q=ttf') format('truetype'), - url('../x509/icons?q=svg#icinga-icons') format('svg'); - font-weight: normal; - font-style: normal; -} - -[class^='x509-icon-'], [class*=' x509-icon-'] { - font-family: 'Icinga Web 2 Module X.509'; -} - -.x509-icon-ca:before { content: '\e000'; } -.x509-icon-self-signed:before { content: '\e001'; } -.x509-icon-cert:before { content: '\e002'; } diff --git a/public/font/icons.eot b/public/font/icons.eot deleted file mode 100644 index 96af7378344f3022da7d8f51a4b973b4171eac13..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2140 zcmd^B&2L*p5TDuiY^QPS)Q&%r*0JN*u}d2#sXx=Cn7AQzD5)G8NT6y}xsH<<;xwdI zn^qj)zyXm%MWjm5ONCUahz}uw5C?<`7cOuDM5Q8OpoaqDSR_Pi^V|1cnp7fx0UPb? zZ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2Cn^&=x`12~(QI@KTTVU`$ZYBPGl^1X70oEVF;@djl zj~v1V1wR3KD8ec%Lyk@&3kA4HV;H94GK~|kMz$(>{O1)^G{J8?lplaTI@O0orD>K` zl69K1O5-BUbWxd4M2O5{%t48yLcczREz^3%zlUg|)(15S8FG}6{t5EA;H6xtxY(XA YtXG5Ug{Aev#)@7j#ie3CS1nNdzrMs2Q2+n{ diff --git a/public/font/icons.woff b/public/font/icons.woff deleted file mode 100644 index 6c74bc3e69abdcd82326352098dddde088933f8d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1424 zcmY*YeKga182`<@OlBiQEy9F~O_JsuYANfINEQ;^-;8-_6t-Gg+H87}w8gv}%FDeK zqNdArDelG;vw4Xwm7O~j>2i0yJA9L;x9kV1&89@A zA)h;r$4`tJuklQXqr?J$t^<_k2Eo(RZ+R{O5+RKYacc+;28HnO zgk%N_(ijj&K`=pA008|IRh!3$_!=!>?Z9XA;4p=5DyxhN#)6<=U5 zaCrkK5oJr`UC{w@u<&5u>zzy~fy)(fc{MqSXgGWynona(!0v9DL?V;O6&wrQA6xFa z5xhZ`M7D8h&o#RouVRYl;bKz<1Hfn!X~8O+6Eqleh)6iToX9Qa<=phIwkkhlfS)5s z_Rvd>jiI4fWjlp?=tD&Fry5oC#z79xY&GPSEN{{Qm-xJ3G;he^ z4bb&N*mcMy9FQ2RvyMM(*kJ#(qeI3omUB#u;%LN1R8c_N_*o4@b0MRAx4G}Ez=w^g zspbS!XS4ZHeccM`V{Uy;9e>)clNu6-Zhn7>;7>*lAuy@i)`WHA_U$&)OV!sz+D(+e96ZBs%F4_{_JsjU8wq_5kt5gv*=Q^YQ zMvle%NYk9i(^FsC+LxE@|7dWwHePNhSd-bTSSDHj!u3e;Yz0)Lbng^e?_2sJy2K-! zKXL6w@yEG4Y7NJ)YheSr2X}0r{p*V`*Q$dGuGA|ldB(zDEgiOw9?&yl*z7+xhykZ9 z3NJ}{jIe^DiX+UuZk<{3tsU%*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