Skip to content

Commit

Permalink
ui: Allow font-awesome icon usage and optimise icon size inconsistency (
Browse files Browse the repository at this point in the history
apache#9744)

Signed-off-by: Rohit Yadav <[email protected]>
Co-authored-by: dahn <[email protected]>
  • Loading branch information
rohityadavcloud and DaanHoogland authored Dec 9, 2024
1 parent 971a5b2 commit 4876761
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
6 changes: 6 additions & 0 deletions ui/src/components/menu/SMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
v-if="item.meta.icon && typeof (item.meta.icon) === 'string'"
:icon="item.meta.icon"
@click="() => { handleClickParentMenu(item) }" />
<font-awesome-icon
v-else-if="item.meta.icon && Array.isArray(item.meta.icon)"
:icon="item.meta.icon"
class="anticon"
:style="[$store.getters.darkMode ? { color: 'rgba(255, 255, 255, 0.65)' } : { color: '#888' }]"
@click="() => { handleClickParentMenu(item) }" />
<span>{{ $t(item.meta.title) }}</span>
</router-link>
</a-menu-item>
Expand Down
26 changes: 20 additions & 6 deletions ui/src/components/view/InfoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
<resource-icon :image="getImage(resource.icon && resource.icon.base64image || images.template || images.iso || resourceIcon)" size="4x" style="margin-right: 5px"/>
</span>
<span v-else>
<os-logo v-if="resource.ostypeid || resource.ostypename" :osId="resource.ostypeid" :osName="resource.ostypename" size="4x" @update-osname="setResourceOsType"/>
<os-logo v-if="resource.ostypeid || resource.ostypename" :osId="resource.ostypeid" :osName="resource.ostypename" size="3x" @update-osname="setResourceOsType"/>
<render-icon v-else-if="typeof $route.meta.icon ==='string'" style="font-size: 36px" :icon="$route.meta.icon" />
<font-awesome-icon
v-else-if="$route.meta.icon && Array.isArray($route.meta.icon)"
:icon="$route.meta.icon"
size="4x"
size="3x"
class="anticon"
:style="[$store.getters.darkMode ? { color: 'rgba(255, 255, 255, 0.65)' } : { color: '#888' }]" />
<render-icon v-else style="font-size: 36px" :svgIcon="$route.meta.icon" />
Expand Down Expand Up @@ -179,7 +179,10 @@
<div class="resource-detail-item" v-if="('cpunumber' in resource && 'cpuspeed' in resource) || resource.cputotal">
<div class="resource-detail-item__label">{{ $t('label.cpu') }}</div>
<div class="resource-detail-item__details">
<appstore-outlined />
<font-awesome-icon
:icon="['fa-solid', 'fa-microchip']"
class="anticon"
:style="[$store.getters.darkMode ? { color: 'rgba(255, 255, 255, 0.65)' } : { color: '#888' }]" />
<span v-if="'cpunumber' in resource && 'cpuspeed' in resource">{{ resource.cpunumber }} CPU x {{ (resource.cpuspeed / 1000.0).toFixed(2) }} GHz
<a-tooltip placement="top">
<template #title>
Expand Down Expand Up @@ -214,7 +217,11 @@
<div class="resource-detail-item" v-if="'memory' in resource">
<div class="resource-detail-item__label">{{ $t('label.memory') }}</div>
<div class="resource-detail-item__details">
<bulb-outlined />{{ resource.memory + ' ' + $t('label.mb.memory') }}
<font-awesome-icon
:icon="['fa-solid', 'fa-memory']"
class="anticon"
:style="[$store.getters.darkMode ? { color: 'rgba(255, 255, 255, 0.65)' } : { color: '#888' }]" />
{{ resource.memory + ' ' + $t('label.mb.memory') }}
</div>
<div>
<span v-if="resource.memorykbs && resource.memoryintfreekbs">
Expand Down Expand Up @@ -355,7 +362,10 @@
v-for="(eth, index) in resource.nic"
:key="eth.id"
style="margin-left: -24px; margin-top: 5px;">
<api-outlined />
<font-awesome-icon
:icon="['fa-solid', 'fa-ethernet']"
class="anticon"
:style="[$store.getters.darkMode ? { color: 'rgba(255, 255, 255, 0.65)' } : { color: '#888' }]" />
<strong>eth{{ index }}</strong>&nbsp;
<copy-label :label="eth.ip6address ? eth.ipaddress + ', ' + eth.ip6address : eth.ipaddress" />&nbsp;
<a-tag v-if="eth.isdefault">
Expand All @@ -380,7 +390,11 @@
v-for="network in resource.networks"
:key="network.id"
style="margin-top: 5px;">
<api-outlined />{{ network.name }}
<font-awesome-icon
:icon="['fa-solid', 'fa-ethernet']"
class="anticon"
:style="[$store.getters.darkMode ? { color: 'rgba(255, 255, 255, 0.65)' } : { color: '#888' }]" />
{{ network.name }}
<span v-if="resource.defaultnetworkid === network.id">
({{ $t('label.default') }})
</span>
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/view/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<span v-if="record.icon && record.icon.base64image">
<resource-icon :image="record.icon.base64image" size="2x"/>
</span>
<os-logo v-else :osId="record.ostypeid" :osName="record.osdisplayname" size="2x" />
<os-logo v-else :osId="record.ostypeid" :osName="record.osdisplayname" size="xl" />
</span>
<span style="min-width: 120px" >
<QuickView
Expand All @@ -57,12 +57,12 @@
</span>
<span v-if="$showIcon() && !['vm', 'vnfapp'].includes($route.path.split('/')[1])" style="margin-right: 5px">
<resource-icon v-if="$showIcon() && record.icon && record.icon.base64image" :image="record.icon.base64image" size="2x"/>
<os-logo v-else-if="record.ostypename" :osName="record.ostypename" size="2x" />
<os-logo v-else-if="record.ostypename" :osName="record.ostypename" size="xl" />
<render-icon v-else-if="typeof $route.meta.icon ==='string'" style="font-size: 16px;" :icon="$route.meta.icon"/>
<render-icon v-else style="font-size: 16px;" :svgIcon="$route.meta.icon" />
</span>
<span v-else :style="{ 'margin-right': record.ostypename ? '5px' : '0' }">
<os-logo v-if="record.ostypename" :osName="record.ostypename" size="1x" />
<os-logo v-if="record.ostypename" :osName="record.ostypename" size="xl" />
</span>

<span v-if="record.hasannotations">
Expand Down
8 changes: 2 additions & 6 deletions ui/src/core/ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@
import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

// import { fab } from '@fortawesome/free-brands-svg-icons'
// import { fas } from '@fortawesome/free-solid-svg-icons'
// import { far } from '@fortawesome/free-regular-svg-icons'

import { faCentos, faUbuntu, faDebian, faSuse, faRedhat, faFedora, faLinux, faFreebsd, faApple, faWindows, faJava } from '@fortawesome/free-brands-svg-icons'
import { faCompactDisc, faCameraRetro, faDharmachakra } from '@fortawesome/free-solid-svg-icons'
import { fas, faCompactDisc, faCameraRetro, faDharmachakra } from '@fortawesome/free-solid-svg-icons'

library.add(faCentos, faUbuntu, faDebian, faSuse, faRedhat, faFedora, faLinux, faFreebsd, faApple, faWindows, faJava)
library.add(faCompactDisc, faCameraRetro, faDharmachakra)
library.add(fas, faCompactDisc, faCameraRetro, faDharmachakra)

export default {
install: (app) => {
Expand Down

0 comments on commit 4876761

Please sign in to comment.