Skip to content

Commit

Permalink
frontend: update networking widgets for using the pi svg with css colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Feb 20, 2025
1 parent 9321e95 commit 996eb48
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion core/frontend/src/components/wifi/WifiTrayMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default Vue.extend({
},
mounted() {
commander.getEnvironmentVariables().then((environment_variables) => {
this.disabled_services = ((environment_variables?.BLUEOS_DISABLE_SERVICES as string) ?? '').split(',') as string[]
this.disabled_services = (environment_variables?.BLUEOS_DISABLE_SERVICES as string ?? '').split(',') as string[]
})
},
})
Expand Down
20 changes: 17 additions & 3 deletions core/frontend/src/widgets/Networking.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<v-card class="d-flex align-center justify-center" height="40">
<v-card-title class="d-flex align-center">
<span class="vertical-text mr-1">eth0</span>
<img src="/img/icons/pi.svg" alt="Pi" class="pi-icon mr-1" height="30">
<!-- eslint-disable vue/no-v-html -->
<i class="pi-icon mr-1" v-html="image" />
<div class="d-flex flex-column">
<div class="d-flex align-center text-caption" style="margin-bottom: -5px">
<v-icon small>
Expand All @@ -22,18 +23,20 @@
</template>

<script lang="ts">
import axios from 'axios'
import Vue from 'vue'
import { OneMoreTime } from '@/one-more-time'
import system_information, { FetchType } from '@/store/system-information'
import { formatBandwidth } from '@/utils/networking';
import { formatBandwidth } from '@/utils/networking'
export default Vue.extend({
name: 'ETh0Widget',
data() {
return {
timer: 0,
check_backend_status_task: new OneMoreTime({ delay: 2000, disposeWith: this }),
image: '',
}
},
computed: {
Expand All @@ -46,10 +49,11 @@ export default Vue.extend({
return eth0?.download_speed ?? 0
},
},
mounted() {
async mounted() {
this.check_backend_status_task.setAction(() => {
system_information.fetchSystemInformation(FetchType.SystemNetworkType)
})
this.loadImage()
},
beforeDestroy() {
clearInterval(this.timer)
Expand All @@ -58,6 +62,11 @@ export default Vue.extend({
formatBandwidth(bytesPerSecond: number): string {
return formatBandwidth(bytesPerSecond)
},
async loadImage() {
const url = (await import('@/assets/img/icons/pi.svg')).default as string
const response = await axios.get(url)
this.image = response.data
},
},
})
</script>
Expand All @@ -71,4 +80,9 @@ export default Vue.extend({
width: 20px;
margin-left: -18px;
}
.pi-icon :deep(svg) {
width: 35px;
margin-bottom: -10px;
}
</style>
18 changes: 16 additions & 2 deletions core/frontend/src/widgets/WifiNetworking.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<v-card class="d-flex align-center justify-center" height="40">
<v-card-title class="d-flex align-center">
<span class="vertical-text mr-1">Wifi</span>
<img src="/img/icons/pi.svg" alt="Pi" class="pi-icon mr-1" height="30">
<!-- eslint-disable vue/no-v-html -->
<i class="pi-icon mr-1" v-html="image" />
<div class="d-flex flex-column">
<div class="d-flex align-center text-caption" style="margin-bottom: -5px">
<v-icon small>
Expand All @@ -22,6 +23,7 @@
</template>

<script lang="ts">
import axios from 'axios'
import Vue from 'vue'
import { OneMoreTime } from '@/one-more-time'
Expand All @@ -34,6 +36,7 @@ export default Vue.extend({
return {
timer: 0,
check_backend_status_task: new OneMoreTime({ delay: 2000, disposeWith: this }),
image: '',
}
},
computed: {
Expand All @@ -46,10 +49,11 @@ export default Vue.extend({
return eth0?.download_speed ?? 0
},
},
mounted() {
async mounted() {
this.check_backend_status_task.setAction(() => {
system_information.fetchSystemInformation(FetchType.SystemNetworkType)
})
this.loadImage()
},
beforeDestroy() {
clearInterval(this.timer)
Expand All @@ -58,6 +62,11 @@ export default Vue.extend({
formatBandwidth(bytesPerSecond: number): string {
return formatBandwidth(bytesPerSecond)
},
async loadImage() {
const url = (await import('@/assets/img/icons/pi.svg')).default as string
const response = await axios.get(url)
this.image = response.data
},
},
})
</script>
Expand All @@ -71,4 +80,9 @@ export default Vue.extend({
width: 20px;
margin-left: -18px;
}
.pi-icon :deep(svg) {
width: 35px;
margin-bottom: -10px;
}
</style>

0 comments on commit 996eb48

Please sign in to comment.