π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
Adds ability to use Font Awesome for icon image
Alicia Sykes4c07382dd3d2
diff --git a/src/components/LinkItems/ItemIcon.vue b/src/components/LinkItems/ItemIcon.vueindex 806ea1c3..5a3936f5 100644--- a/src/components/LinkItems/ItemIcon.vue+++ b/src/components/LinkItems/ItemIcon.vue@@ -1,15 +1,12 @@<template>- <img- v-if="icon"- :src="getAppropriateImgPath(icon, url)"- class="tile-icon"- />+ <i v-if="determineImageType(icon) === 'font-awesome'" :class="icon"></i>+ <img v-else-if="icon" :src="getIconPath(icon, url)" class="tile-icon" /></template><script>export default {- name: 'Item',+ name: 'Icon',props: {icon: String,url: String,@@ -41,40 +38,28 @@ export default {}return '';},+ getLocalImagePath(img) {+ return `/img/item-icons/tile-icons/${img}`;+ },/* Checks if the icon is from a local image, remote URL, SVG or font-awesome */- getAppropriateImgPath(img, url) {- const imageType = this.determineImageType(img);- switch (imageType) {- case 'url':- return img;- case 'img':- return `/img/item-icons/tile-icons/${img}`;- case 'favicon':- return this.getFavicon(url);- case 'svg':- return img;- case 'fas':- return img;- default:- return '';+ getIconPath(img, url) {+ switch (this.determineImageType(img)) {+ case 'url': return img;+ case 'img': return this.getLocalImagePath(img);+ case 'favicon': return this.getFavicon(url);+ case 'svg': return img;+ default: return '';}},/* Checks if the icon is from a local image, remote URL, SVG or font-awesome */determineImageType(img) {let imgType = '';- if (this.isUrl(img)) {- imgType = 'url';- } else if (this.isImage(img)) {- imgType = 'img';- // } else if (fileExtRegex.exec(img)[1] === 'svg') {- // imgType = 'svg';- } else if (img.includes('fas')) {- imgType = 'fas';- } else if (img === 'favicon') {- imgType = 'favicon';- } else {- imgType = 'none';- }+ if (this.isUrl(img)) imgType = 'url';+ else if (this.isImage(img)) imgType = 'img';+ else if (img.substr(4) === ('.svg' || '.SVG')) imgType = 'svg';+ else if (img.includes('fa-')) imgType = 'font-awesome';+ else if (img === 'favicon') imgType = 'favicon';+ else imgType = 'none';return imgType;},},@@ -82,9 +67,12 @@ export default {</script><style scoped lang="scss">--.tile-icon {- width: 60px;- filter: var(--item-icon-transform);-}+ .tile-icon {+ width: 60px;+ filter: var(--item-icon-transform);+ }+ i.fas, i.fab {+ font-size: 1.5rem;+ color: currentColor;+ }</style>diff --git a/src/data/conf.yml b/src/data/conf.ymlindex efccf6dc..f91da606 100644--- a/src/data/conf.yml+++ b/src/data/conf.yml@@ -2,23 +2,12 @@pageInfo:title: Hello Worlddescription: 'This is a demo'-appConfig:- theme: 'default'- externalStyleSheet: 'https://bootswatch.com/4/solar/bootstrap.min.css'- cssThemes: ['hello', 'world']- enableFontAwesome: true- fontAwesomeKey: ''- hiddenComponents:- - footer: true- navigation: false- pageTitle: falsesections:- name: Firewallitems:- title: OPNsensedescription: Firewall Central Managementicon: networking/opnsense.png- iconType: imgtarget: iframeurl: https://192.168.1.1- title: NetData@@ -28,27 +17,22 @@ sections:- title: MalTraildescription: Malicious traffic detection systemicon: networking/maltrail.png- iconType: imgurl: http://192.168.1.1:8338- title: Ntopngdescription: Network traffic probe and network use monitoricon: networking/ntop.png- iconType: imgurl: http://192.168.1.1:3001- title: Senseidescription: Additional data featuresicon: networking/sensei.png- iconType: imgurl: https://192.168.1.1/ui/sensei/- title: Monitdescription: Status of firewall system alertsicon: networking/monit.png- iconType: imgurl: https://192.168.1.1/ui/monit/status- title: Firewall Logsdescription: Real-time view of firewall data and logsicon: networking/logs.png- iconType: imgurl: https://192.168.1.1/ui/diagnostics/firewall/log- title: WireGuarddescription: Manage WireGuard client and server on firewall