feat: extend system load panel (#536)
This commit is contained in:
1 parent
96d502dcc6
commit
850bb8b2e3
13 files changed
+581
-278
No files matched your search
@@ -4,220 +4,23 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div v-if="klipperReadyForGui">
|
||||
<panel
|
||||
:title="$t('Machine.SystemPanel.SystemLoad')"
|
||||
:icon="mdiMemory"
|
||||
card-class="machine-systemload-panel"
|
||||
:collapsible="true">
|
||||
<v-card-text class="px-0 py-2">
|
||||
<div v-for="(mcu, index) of mcus" :key="mcu.name">
|
||||
<v-divider v-if="index" class="my-2"></v-divider>
|
||||
<v-row class="py-0">
|
||||
<v-col class="pl-6">
|
||||
<strong style="cursor: pointer" @click="openMcuDetails(mcu)">{{ mcu.name }}</strong>
|
||||
<small v-if="mcu.chip" class="ml-2">({{ mcu.chip }})</small>
|
||||
<br />
|
||||
{{ $t('Machine.SystemPanel.Version') }}: {{ mcu.version }}
|
||||
<br />
|
||||
{{ $t('Machine.SystemPanel.Load') }}: {{ mcu.load }}, {{ $t('Machine.SystemPanel.Awake') }}:
|
||||
{{ mcu.awake }}
|
||||
<span v-if="mcu.freq !== null">
|
||||
, {{ $t('Machine.SystemPanel.Frequency') }}: {{ mcu.freqFormat }}
|
||||
</span>
|
||||
<template v-if="mcu.tempSensor">
|
||||
<span>,</span>
|
||||
<template
|
||||
v-if="
|
||||
mcu.tempSensor.measured_min_temp !== null &&
|
||||
mcu.tempSensor.measured_max_temp !== null
|
||||
">
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on">
|
||||
Temp: {{ mcu.tempSensor.temperature + '°C' }}
|
||||
</span>
|
||||
</template>
|
||||
<span>
|
||||
max: {{ mcu.tempSensor.measured_max_temp }}°C
|
||||
<br />
|
||||
min: {{ mcu.tempSensor.measured_min_temp }}°C
|
||||
</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-else>Temp: {{ mcu.tempSensor.temperature + '°C' }}</template>
|
||||
</template>
|
||||
</v-col>
|
||||
<v-col class="px-6 col-auto d-flex justify-end align-center">
|
||||
<v-progress-circular
|
||||
:rotate="-90"
|
||||
:size="55"
|
||||
:width="7"
|
||||
:value="mcu.loadPercent"
|
||||
:color="mcu.loadProgressColor">
|
||||
{{ mcu.loadPercent }}
|
||||
</v-progress-circular>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<div v-if="hostStats">
|
||||
<v-divider v-if="mcus.length" class="my-2"></v-divider>
|
||||
<v-row class="py-0">
|
||||
<v-col class="pl-6">
|
||||
<strong style="cursor: pointer" @click="hostDetailsDialog.bool = true">Host</strong>
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<small v-if="hostStats.cpuName" class="ml-2" v-bind="attrs" v-on="on">
|
||||
({{ hostStats.cpuName }})
|
||||
</small>
|
||||
</template>
|
||||
<span v-if="hostStats.cpuDesc">{{ hostStats.cpuDesc }}</span>
|
||||
</v-tooltip>
|
||||
<br />
|
||||
<span v-if="hostStats.version">
|
||||
{{ $t('Machine.SystemPanel.Version') }}: {{ hostStats.version }}
|
||||
<br />
|
||||
</span>
|
||||
<span v-if="hostStats.os">
|
||||
{{ $t('Machine.SystemPanel.Os') }}: {{ hostStats.os }}
|
||||
<br />
|
||||
</span>
|
||||
<span v-if="hostStats.release_info && hostStats.release_info.name !== '0.'">
|
||||
{{ $t('Machine.SystemPanel.Distro') }}: {{ hostStats.release_info.name }}
|
||||
{{ hostStats.release_info.version_id }}
|
||||
<span v-if="hostStats.release_info.codename">
|
||||
({{ hostStats.release_info.codename }})
|
||||
</span>
|
||||
<br />
|
||||
</span>
|
||||
<span>{{ $t('Machine.SystemPanel.Load') }}: {{ hostStats.load }}</span>
|
||||
<span v-if="hostStats.memoryFormat">
|
||||
, {{ $t('Machine.SystemPanel.Memory') }}: {{ hostStats.memoryFormat }}
|
||||
</span>
|
||||
<template v-if="hostStats.tempSensor">
|
||||
<span>,</span>
|
||||
<template
|
||||
v-if="
|
||||
hostStats.tempSensor.measured_min_temp !== null &&
|
||||
hostStats.tempSensor.measured_max_temp !== null
|
||||
">
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on">
|
||||
Temp: {{ hostStats.tempSensor.temperature + '°C' }}
|
||||
</span>
|
||||
</template>
|
||||
<span>
|
||||
max: {{ hostStats.tempSensor.measured_max_temp }}°C
|
||||
<br />
|
||||
min: {{ hostStats.tempSensor.measured_min_temp }}°C
|
||||
</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<template v-else>Temp: {{ hostStats.tempSensor.temperature + '°C' }}</template>
|
||||
</template>
|
||||
</v-col>
|
||||
<v-col class="px-6 col-auto d-flex justify-end align-center">
|
||||
<v-progress-circular
|
||||
:rotate="-90"
|
||||
:size="55"
|
||||
:width="7"
|
||||
:value="hostStats.loadPercent"
|
||||
:color="hostStats.loadProgressColor">
|
||||
{{ hostStats.loadPercent }}
|
||||
</v-progress-circular>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
<v-dialog v-model="mcuDetailsDialog.bool" :max-width="400" :max-height="500" scrollable>
|
||||
<panel
|
||||
:title="mcuDetailsDialog.headline"
|
||||
:icon="mdiTextBoxSearchOutline"
|
||||
card-class="machine-systemload-mcu-details-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="mcuDetailsDialog.bool = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="pt-5 px-0">
|
||||
<overlay-scrollbars style="height: 350px" class="px-6">
|
||||
<template v-if="mcuDetailsDialog.mcu.mcu_constants">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<span class="headline">{{ $t('Machine.SystemPanel.Constants') }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div v-for="(value, key, index) in mcuDetailsDialog.mcu.mcu_constants" :key="key">
|
||||
<v-divider v-if="index" class="my-3"></v-divider>
|
||||
<v-row>
|
||||
<v-col>{{ key }}</v-col>
|
||||
<v-col class="text-right">{{ value }}</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="mcuDetailsDialog.mcu.last_stats">
|
||||
<v-row class="mt-5">
|
||||
<v-col>
|
||||
<span class="headline">{{ $t('Machine.SystemPanel.LastStats') }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div v-for="(value, key, index) in mcuDetailsDialog.mcu.last_stats" :key="key">
|
||||
<v-divider v-if="index" class="my-3"></v-divider>
|
||||
<v-row>
|
||||
<v-col>{{ key }}</v-col>
|
||||
<v-col class="text-right">{{ value }}</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
</overlay-scrollbars>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="hostDetailsDialog.bool" :max-width="600" :max-height="500" scrollable>
|
||||
<panel
|
||||
:title="$t('Machine.SystemPanel.HostDetails')"
|
||||
:icon="mdiTextBoxSearchOutline"
|
||||
card-class="machine-systemload-host-details-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="hostDetailsDialog.bool = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="pt-5 px-0">
|
||||
<overlay-scrollbars style="height: 350px" class="px-6">
|
||||
<template v-if="Object.keys(systemInfo).length">
|
||||
<div v-for="(infoGroup, groupKey, groupIndex) of systemInfo" :key="groupKey">
|
||||
<template v-if="groupKey !== 'available_services'">
|
||||
<v-row :class="groupIndex ? 'mt-5' : ''">
|
||||
<v-col>
|
||||
<span class="headline">{{ groupKey }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div v-for="(value, key, index) in infoGroup" :key="key">
|
||||
<v-divider v-if="index" class="my-3"></v-divider>
|
||||
<v-row>
|
||||
<v-col>{{ key }}</v-col>
|
||||
<v-col class="text-right">{{ value }}</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-row class="mt-5">
|
||||
<v-col><p>No more Infos</p></v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</overlay-scrollbars>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
<template v-if="klipperReadyForGui">
|
||||
<panel
|
||||
:title="$t('Machine.SystemPanel.SystemLoad')"
|
||||
:icon="mdiMemory"
|
||||
card-class="machine-systemload-panel"
|
||||
:collapsible="true">
|
||||
<v-card-text class="px-0 py-2">
|
||||
<div v-for="(mcu, index) of mcus" :key="mcu.name">
|
||||
<v-divider v-if="index" class="my-2"></v-divider>
|
||||
<system-panel-mcu :mcu="mcu"></system-panel-mcu>
|
||||
</div>
|
||||
<div v-if="hostStats">
|
||||
<v-divider v-if="mcus.length" class="my-2"></v-divider>
|
||||
<system-panel-host></system-panel-host>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -225,28 +28,16 @@ import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '../../mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { caseInsensitiveSort } from '@/plugins/helpers'
|
||||
import { mdiCloseThick, mdiMemory, mdiTextBoxSearchOutline } from '@mdi/js'
|
||||
import { mdiCloseThick, mdiMemory } from '@mdi/js'
|
||||
import SystemPanelHost from '@/components/panels/Machine/SystemPanelHost.vue'
|
||||
import SystemPanelMcu from '@/components/panels/Machine/SystemPanelMcu.vue'
|
||||
@Component({
|
||||
components: { Panel },
|
||||
components: { SystemPanelMcu, SystemPanelHost, Panel },
|
||||
})
|
||||
export default class SystemPanel extends Mixins(BaseMixin) {
|
||||
mdiTextBoxSearchOutline = mdiTextBoxSearchOutline
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiMemory = mdiMemory
|
||||
|
||||
private mcuDetailsDialog: { bool: boolean; headline: string; mcu: any } = {
|
||||
bool: false,
|
||||
headline: '',
|
||||
mcu: {
|
||||
mcu_constants: null,
|
||||
last_stats: null,
|
||||
},
|
||||
}
|
||||
|
||||
private hostDetailsDialog: { bool: boolean } = {
|
||||
bool: false,
|
||||
}
|
||||
|
||||
get mcus() {
|
||||
const mcus = this.$store.getters['printer/getMcus'] ?? []
|
||||
|
||||
@@ -256,16 +47,5 @@ export default class SystemPanel extends Mixins(BaseMixin) {
|
||||
get hostStats() {
|
||||
return this.$store.getters['server/getHostStats'] ?? null
|
||||
}
|
||||
|
||||
get systemInfo() {
|
||||
return this.$store.state.server?.system_info ?? {}
|
||||
}
|
||||
|
||||
openMcuDetails(mcu: any) {
|
||||
this.mcuDetailsDialog.headline = mcu.name
|
||||
this.mcuDetailsDialog.mcu.mcu_constants = { ...mcu.mcu_constants }
|
||||
this.mcuDetailsDialog.mcu.last_stats = { ...mcu.last_stats }
|
||||
this.mcuDetailsDialog.bool = true
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,262 @@
|
||||
<style scoped>
|
||||
.cursor--pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template v-if="hostStats">
|
||||
<div>
|
||||
<v-row class="py-0 pr-4">
|
||||
<v-col class="pl-6">
|
||||
<strong style="cursor: pointer" @click="hostDetailsDialog = true">Host</strong>
|
||||
<template v-if="hostStats.cpuDesc">
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<small v-if="hostStats.cpuName" class="ml-2" v-bind="attrs" v-on="on">
|
||||
({{ hostStats.cpuName }})
|
||||
</small>
|
||||
</template>
|
||||
<span>{{ hostStats.cpuDesc }}</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<br />
|
||||
<div class="text-body-2">
|
||||
<div v-if="hostStats.version">
|
||||
{{ $t('Machine.SystemPanel.Values.Version', { version: hostStats.version }) }}
|
||||
</div>
|
||||
<div v-if="hostStats.os">
|
||||
{{ $t('Machine.SystemPanel.Values.Os', { os: hostStats.os }) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="
|
||||
hostStats.release_info &&
|
||||
'name' in hostStats.release_info &&
|
||||
hostStats.release_info.name !== '0.'
|
||||
"
|
||||
class="text-no-wrap">
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.Distro', {
|
||||
name: hostStats.release_info.name,
|
||||
version_id: hostStats.release_info.version_id,
|
||||
})
|
||||
}}
|
||||
<template v-if="hostStats.release_info.codename">
|
||||
({{ hostStats.release_info.codename }})
|
||||
</template>
|
||||
</div>
|
||||
<div>
|
||||
<span class="text-no-wrap">
|
||||
{{ $t('Machine.SystemPanel.Values.Load', { load: hostStats.load }) }},
|
||||
</span>
|
||||
<span v-if="hostStats.memoryFormat" class="d-inline-block text-no-wrap">
|
||||
{{ $t('Machine.SystemPanel.Values.Memory', { memory: hostStats.memoryFormat }) }},
|
||||
</span>
|
||||
<span class="text-no-wrap">
|
||||
<template v-if="hostStats.tempSensor">
|
||||
<template
|
||||
v-if="
|
||||
hostStats.tempSensor.measured_min_temp !== null &&
|
||||
hostStats.tempSensor.measured_max_temp !== null
|
||||
">
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on">
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.Temp', {
|
||||
temp: hostStats.tempSensor.temperature,
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
<span>
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.TempMax', {
|
||||
temp: hostStats.tempSensor.measured_max_temp,
|
||||
})
|
||||
}}
|
||||
<br />
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.TempMin', {
|
||||
temp: hostStats.tempSensor.measured_min_temp,
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<span v-else>
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.Temp', {
|
||||
temp: hostStats.tempSensor.temperature,
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
<template v-if="networkInterfaces">
|
||||
<div v-for="(interfaceStats, interfaceName) in networkInterfaces" :key="interfaceName">
|
||||
<span class="text-no-wrap">
|
||||
{{ interfaceName }}{{ getIpAddress(interfaceStats.details.ip_addresses) }}:
|
||||
</span>
|
||||
<span class="text-no-wrap">
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.Bandwidth', {
|
||||
bandwidth: formatFilesize(interfaceStats.bandwidth),
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
,
|
||||
<span class="text-no-wrap">
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.Received', {
|
||||
received: formatFilesize(interfaceStats.rx_bytes),
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
,
|
||||
<span class="text-no-wrap">
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.Transmitted', {
|
||||
transmitted: formatFilesize(interfaceStats.tx_bytes),
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col v-if="cpuUsage !== null" class="px-2 col-auto d-flex flex-column justify-center align-center">
|
||||
<v-progress-circular :rotate="-90" :size="55" :width="7" :value="cpuUsage" :color="cpuUsageColor">
|
||||
{{ cpuUsage }}
|
||||
</v-progress-circular>
|
||||
<span class="mt-2">{{ $t('Machine.SystemPanel.Cpu') }}</span>
|
||||
</v-col>
|
||||
<v-col v-else class="px-2 col-auto d-flex flex-column justify-center align-center">
|
||||
<v-progress-circular
|
||||
:rotate="-90"
|
||||
:size="55"
|
||||
:width="7"
|
||||
:value="hostStats.loadPercent"
|
||||
:color="hostStats.loadProgressColor">
|
||||
{{ hostStats.loadPercent }}
|
||||
</v-progress-circular>
|
||||
<span class="mt-2">{{ $t('Machine.SystemPanel.Load') }}</span>
|
||||
</v-col>
|
||||
<v-col
|
||||
v-if="hostStats.memUsage !== null"
|
||||
class="px-2 col-auto d-flex flex-column justify-center align-center">
|
||||
<v-progress-circular
|
||||
:rotate="-90"
|
||||
:size="55"
|
||||
:width="7"
|
||||
:value="hostStats.memUsage"
|
||||
:color="hostStats.memUsageColor">
|
||||
{{ hostStats.memUsage }}
|
||||
</v-progress-circular>
|
||||
<span class="mt-2">{{ $t('Machine.SystemPanel.Memory') }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-dialog v-model="hostDetailsDialog" :max-width="600" :max-height="500" scrollable>
|
||||
<panel
|
||||
:title="$t('Machine.SystemPanel.HostDetails')"
|
||||
:icon="mdiTextBoxSearchOutline"
|
||||
card-class="machine-systemload-host-details-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="hostDetailsDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="pt-5 px-0">
|
||||
<overlay-scrollbars style="height: 350px" class="px-6">
|
||||
<template v-if="Object.keys(systemInfo).length">
|
||||
<div v-for="(infoGroup, key, index) of systemInfo" :key="key">
|
||||
<template v-if="key !== 'available_services'">
|
||||
<v-row :class="index ? 'mt-5' : ''">
|
||||
<v-col>
|
||||
<span class="headline">{{ key }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div v-for="(value, key2, index2) in infoGroup" :key="key2">
|
||||
<v-divider v-if="index2" class="my-3"></v-divider>
|
||||
<v-row>
|
||||
<v-col>{{ key2 }}</v-col>
|
||||
<v-col class="text-right">{{ value }}</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-row class="mt-5">
|
||||
<v-col>
|
||||
<p>{{ $t('Machine.SystemPanel.NoMoreInfos') }}</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</overlay-scrollbars>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins } from 'vue-property-decorator'
|
||||
import BaseMixin from '../../mixins/base'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { formatFilesize } from '@/plugins/helpers'
|
||||
import { mdiTextBoxSearchOutline, mdiCloseThick } from '@mdi/js'
|
||||
@Component({
|
||||
components: { Panel },
|
||||
})
|
||||
export default class SystemPanelHost extends Mixins(BaseMixin) {
|
||||
formatFilesize = formatFilesize
|
||||
mdiCloseThick = mdiCloseThick
|
||||
mdiTextBoxSearchOutline = mdiTextBoxSearchOutline
|
||||
|
||||
private hostDetailsDialog = false
|
||||
|
||||
get hostStats() {
|
||||
return this.$store.getters['server/getHostStats'] ?? null
|
||||
}
|
||||
|
||||
get systemInfo() {
|
||||
return this.$store.state.server?.system_info ?? {}
|
||||
}
|
||||
|
||||
get directory() {
|
||||
return this.$store.getters['files/getDirectory']('gcodes')
|
||||
}
|
||||
|
||||
get disk_usage() {
|
||||
return this.directory?.disk_usage ?? { used: 0, free: 0, total: 0 }
|
||||
}
|
||||
|
||||
get cpuUsage() {
|
||||
return this.$store.getters['server/getCpuUsage'] ?? null
|
||||
}
|
||||
|
||||
get cpuUsageColor() {
|
||||
let color = 'primary'
|
||||
if (this.cpuUsage > 95) color = 'error'
|
||||
else if (this.cpuUsage > 80) color = 'warning'
|
||||
|
||||
return color
|
||||
}
|
||||
|
||||
get networkInterfaces() {
|
||||
return this.$store.getters['server/getNetworkInterfaces'] ?? null
|
||||
}
|
||||
|
||||
getIpAddress(ip_addresses: { family: string; address: string }[]) {
|
||||
const ipv4 = ip_addresses.find((address) => address.family === 'ipv4')
|
||||
if (ipv4) return ` (${ipv4.address})`
|
||||
|
||||
const ipv6 = ip_addresses.find((address) => address.family === 'ipv6')
|
||||
if (ipv6) return ` (${ipv6.address})`
|
||||
|
||||
return null
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-row class="py-0 pr-4">
|
||||
<v-col class="pl-6">
|
||||
<strong style="cursor: pointer" @click="mcuDetailsDialog = true">{{ mcu.name }}</strong>
|
||||
<small v-if="mcu.chip" class="ml-2">({{ mcu.chip }})</small>
|
||||
<br />
|
||||
<div class="text-body-2">
|
||||
<div class="text-no-wrap">
|
||||
{{ $t('Machine.SystemPanel.Values.Version', { version: mcu.version }) }}
|
||||
</div>
|
||||
<div>
|
||||
<span class="text-no-wrap">
|
||||
{{ $t('Machine.SystemPanel.Values.Load', { load: mcu.load }) }},
|
||||
</span>
|
||||
<span class="text-no-wrap">
|
||||
{{ $t('Machine.SystemPanel.Values.Awake', { awake: mcu.awake }) }},
|
||||
</span>
|
||||
<span v-if="mcu.freq !== null" class="text-no-wrap">
|
||||
{{ $t('Machine.SystemPanel.Values.Frequency', { frequency: mcu.freqFormat }) }},
|
||||
</span>
|
||||
<template v-if="mcu.tempSensor">
|
||||
<template
|
||||
v-if="
|
||||
mcu.tempSensor.measured_min_temp !== null &&
|
||||
mcu.tempSensor.measured_max_temp !== null
|
||||
">
|
||||
<v-tooltip top>
|
||||
<template #activator="{ on, attrs }">
|
||||
<span v-bind="attrs" v-on="on">
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.Temp', {
|
||||
temp: mcu.tempSensor.temperature,
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
<span>
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.TempMax', {
|
||||
temp: mcu.tempSensor.measured_max_temp,
|
||||
})
|
||||
}}
|
||||
<br />
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.TempMin', {
|
||||
temp: mcu.tempSensor.measured_min_temp,
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<span v-else class="text-no-wrap">
|
||||
{{
|
||||
$t('Machine.SystemPanel.Values.Temp', {
|
||||
temp: mcu.tempSensor.temperature,
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col class="px-2 col-auto d-flex justify-center align-center">
|
||||
<v-progress-circular
|
||||
:rotate="-90"
|
||||
:size="55"
|
||||
:width="7"
|
||||
:value="mcu.loadPercent"
|
||||
:color="mcu.loadProgressColor">
|
||||
{{ mcu.loadPercent }}
|
||||
</v-progress-circular>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-dialog v-model="mcuDetailsDialog" :max-width="400" :max-height="500" scrollable>
|
||||
<panel
|
||||
:title="mcu.name"
|
||||
icon="mdi-text-box-search-outline"
|
||||
card-class="machine-systemload-mcu-details-dialog"
|
||||
:margin-bottom="false">
|
||||
<template #buttons>
|
||||
<v-btn icon tile @click="mcuDetailsDialog = false">
|
||||
<v-icon>{{ mdiCloseThick }}</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card-text class="pt-5 px-0">
|
||||
<overlay-scrollbars style="height: 350px" class="px-6">
|
||||
<template v-if="mcu.mcu_constants">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<span class="headline">{{ $t('Machine.SystemPanel.Constants') }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div v-for="(value, key, index) in mcu.mcu_constants" :key="key">
|
||||
<v-divider v-if="index" class="my-3"></v-divider>
|
||||
<v-row>
|
||||
<v-col>{{ key }}</v-col>
|
||||
<v-col class="text-right">{{ value }}</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="mcu.last_stats">
|
||||
<v-row class="mt-5">
|
||||
<v-col>
|
||||
<span class="headline">{{ $t('Machine.SystemPanel.LastStats') }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div v-for="(value, key, index) in mcu.last_stats" :key="key">
|
||||
<v-divider v-if="index" class="my-3"></v-divider>
|
||||
<v-row>
|
||||
<v-col>{{ key }}</v-col>
|
||||
<v-col class="text-right">{{ value }}</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
</overlay-scrollbars>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Mixins, Prop } from 'vue-property-decorator'
|
||||
import BaseMixin from '../../mixins/base'
|
||||
import { formatFilesize } from '@/plugins/helpers'
|
||||
import { PrinterStateMcu } from '@/store/printer/types'
|
||||
import Panel from '@/components/ui/Panel.vue'
|
||||
import { mdiCloseThick } from '@mdi/js'
|
||||
@Component({
|
||||
components: { Panel },
|
||||
})
|
||||
export default class SystemPanelMcu extends Mixins(BaseMixin) {
|
||||
formatFilesize = formatFilesize
|
||||
mdiCloseThick = mdiCloseThick
|
||||
|
||||
@Prop({ required: true }) readonly mcu!: PrinterStateMcu
|
||||
private mcuDetailsDialog = false
|
||||
}
|
||||
</script>
|
||||
+18
-6
@@ -363,17 +363,29 @@
|
||||
"Logfiles": "Logdateien"
|
||||
},
|
||||
"SystemPanel": {
|
||||
"Awake": "Wach",
|
||||
"Constants": "Konstanten",
|
||||
"Distro": "Distribution",
|
||||
"Frequency": "Freq",
|
||||
"Cpu": "CPU",
|
||||
"HostDetails": "Host-Details",
|
||||
"LastStats": "Letzte Statistik",
|
||||
"Load": "Auslastung",
|
||||
"Memory": "Mem",
|
||||
"Os": "OS",
|
||||
"Memory": "MEM",
|
||||
"NoMoreInfos": "Keine weiteren Informationen",
|
||||
"SystemLoad": "Systemauslastung",
|
||||
"Version": "Version"
|
||||
"Values": {
|
||||
"Awake": "Wach: {awake}",
|
||||
"Bandwidth": "Bandbreite: {bandwidth}/s",
|
||||
"Distro": "Distribution: {name} {version_id}",
|
||||
"Frequency": "Freq: {frequency}",
|
||||
"Load": "Auslastung: {load}",
|
||||
"Memory": "Mem: {memory}",
|
||||
"Os": "OS: {os}",
|
||||
"Received": "Empfangen: {received}",
|
||||
"Temp": "Temp: {temp}°C",
|
||||
"TempMax": "max: {temp}°C",
|
||||
"TempMin": "min: {temp}°C",
|
||||
"Transmitted": "Versendet: {transmitted}",
|
||||
"Version": "Version: {version}"
|
||||
}
|
||||
},
|
||||
"UpdatePanel": {
|
||||
"CheckForUpdates": "auf aktualisierungen prüfen",
|
||||
|
||||
+18
-7
@@ -281,7 +281,6 @@
|
||||
"SelectedFilamentUsed": "Selected Filament Used",
|
||||
"SelectedJobs": "Selected Jobs",
|
||||
"SelectedPrinttime": "Selected Printtime",
|
||||
"ShowStatusName": "Show \"{name}\" ({count})",
|
||||
"Slicer": "Slicer",
|
||||
"SlicerVersion": "Slicer Version",
|
||||
"StartTime": "Start Time",
|
||||
@@ -360,17 +359,29 @@
|
||||
"Logfiles": "Logfiles"
|
||||
},
|
||||
"SystemPanel": {
|
||||
"Awake": "Awake",
|
||||
"Constants": "Constants",
|
||||
"Distro": "Distro",
|
||||
"Frequency": "Freq",
|
||||
"Cpu": "CPU",
|
||||
"HostDetails": "Host details",
|
||||
"LastStats": "Last stats",
|
||||
"Load": "Load",
|
||||
"Memory": "Mem",
|
||||
"Os": "OS",
|
||||
"Memory": "MEM",
|
||||
"NoMoreInfos": "No more Infos",
|
||||
"SystemLoad": "System Loads",
|
||||
"Version": "Version"
|
||||
"Values": {
|
||||
"Awake": "Awake: {awake}",
|
||||
"Bandwidth": "Bandwidth: {bandwidth}/s",
|
||||
"Distro": "Distro: {name} {version_id}",
|
||||
"Frequency": "Freq: {frequency}",
|
||||
"Load": "Load: {load}",
|
||||
"Memory": "Mem: {memory}",
|
||||
"Os": "OS: {os}",
|
||||
"Received": "Received: {received}",
|
||||
"Temp": "Temp: {temp}°C",
|
||||
"TempMax": "max: {temp}°C",
|
||||
"TempMin": "min: {temp}°C",
|
||||
"Transmitted": "Transmitted: {transmitted}",
|
||||
"Version": "Version: {version}"
|
||||
}
|
||||
},
|
||||
"UpdatePanel": {
|
||||
"CheckForUpdates": "Check for updates",
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
PrinterStateHeater,
|
||||
PrinterStateTemperatureFan,
|
||||
PrinterStateMiscellaneous,
|
||||
PrinterStateMcu,
|
||||
PrinterStateSensor,
|
||||
PrinterStateMacro,
|
||||
} from '@/store/printer/types'
|
||||
@@ -411,27 +412,8 @@ export const getters: GetterTree<PrinterState, RootState> = {
|
||||
return caseInsensitiveSort(sensors, 'name')
|
||||
},
|
||||
|
||||
getMcus: (state, getters) => {
|
||||
interface Mcu {
|
||||
name: string
|
||||
mcu_constants: { [key: string]: string | number }
|
||||
last_stats: { [key: string]: number }
|
||||
version: string
|
||||
chip: string | null
|
||||
freq: number | null
|
||||
freqFormat: string
|
||||
awake: string
|
||||
load: string
|
||||
loadPercent: number
|
||||
loadProgressColor: string
|
||||
tempSensor: {
|
||||
temperature: number
|
||||
measured_min_temp: number | null
|
||||
measured_max_temp: number | null
|
||||
}
|
||||
}
|
||||
|
||||
const mcus: Mcu[] = []
|
||||
getMcus: (state, getters): PrinterStateMcu[] => {
|
||||
const mcus: PrinterStateMcu[] = []
|
||||
|
||||
Object.keys(state).forEach((key) => {
|
||||
if (key === 'mcu' || key.startsWith('mcu ')) {
|
||||
|
||||
@@ -152,3 +152,22 @@ export interface PrinterStateKlipperConfig {
|
||||
// eslint-disable-next-line
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface PrinterStateMcu {
|
||||
name: string
|
||||
mcu_constants: { [key: string]: string | number }
|
||||
last_stats: { [key: string]: number }
|
||||
version: string
|
||||
chip: string | null
|
||||
freq: number | null
|
||||
freqFormat: string
|
||||
awake: string
|
||||
load: string
|
||||
loadPercent: number
|
||||
loadProgressColor: string
|
||||
tempSensor: {
|
||||
temperature: number
|
||||
measured_min_temp: number | null
|
||||
measured_max_temp: number | null
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,13 @@ export const actions: ActionTree<ServerState, RootState> = {
|
||||
if (payload.throttled_state !== null) commit('setThrottledState', payload.throttled_state)
|
||||
},
|
||||
|
||||
updateProcStats({ commit }, payload) {
|
||||
if ('cpu_temp' in payload) commit('setCpuTemp', payload.cpu_temp)
|
||||
if ('moonraker_stats' in payload) commit('setMoonrakerStats', payload.moonraker_stats)
|
||||
if ('network' in payload) commit('setNetworkStats', payload.network)
|
||||
if ('system_cpu_usage' in payload) commit('setCpuStats', payload.system_cpu_usage)
|
||||
},
|
||||
|
||||
setKlippyReady({ dispatch, state }) {
|
||||
if (state.klippy_connected_timer !== null) dispatch('stopKlippyConnectedInterval')
|
||||
if (state.klippy_state_timer !== null) dispatch('stopKlippyStateInterval')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GetterTree } from 'vuex'
|
||||
import { ServerState } from '@/store/server/types'
|
||||
import { ServerState, ServerStateNetworkInterface } from '@/store/server/types'
|
||||
import { formatConsoleMessage, formatFilesize, formatTime } from '@/plugins/helpers'
|
||||
|
||||
// eslint-disable-next-line
|
||||
@@ -43,6 +43,7 @@ export const getters: GetterTree<ServerState, any> = {
|
||||
cpuName: string | null
|
||||
cpuDesc: string | null
|
||||
version: string | null
|
||||
pythonVersion: string | null
|
||||
os: string | null
|
||||
release_info?: {
|
||||
name: string
|
||||
@@ -56,6 +57,8 @@ export const getters: GetterTree<ServerState, any> = {
|
||||
memUsed: string
|
||||
memAvail: string
|
||||
memTotal: string
|
||||
memUsage: null | number
|
||||
memUsageColor: string
|
||||
tempSensor: {
|
||||
temperature: number
|
||||
measured_min_temp: number | null
|
||||
@@ -72,6 +75,12 @@ export const getters: GetterTree<ServerState, any> = {
|
||||
version = rootState.printer?.software_version.split('-').slice(0, 4).join('-')
|
||||
}
|
||||
|
||||
let pythonVersion: null | string = null
|
||||
if (state.system_info?.python?.version_string) {
|
||||
const firstSpace = state.system_info?.python?.version_string.indexOf(' ')
|
||||
pythonVersion = state.system_info?.python?.version_string.slice(0, firstSpace + 1)
|
||||
}
|
||||
|
||||
const cpuCors = state.system_info?.cpu_info?.cpu_count ?? 1
|
||||
const load = Math.round((rootState.printer.system_stats?.sysload ?? 0) * 100) / 100
|
||||
const loadPercent = Math.round((load / cpuCors) * 100)
|
||||
@@ -81,15 +90,21 @@ export const getters: GetterTree<ServerState, any> = {
|
||||
else if (loadPercent > 80) loadProgressColor = 'warning'
|
||||
|
||||
let memoryFormat: null | string = null
|
||||
let memUsage: null | number = null
|
||||
const memAvail = (rootState.printer.system_stats?.memavail ?? 0) * 1024
|
||||
const memTotal = (state.system_info?.cpu_info?.total_memory ?? 0) * 1024
|
||||
|
||||
if (memAvail > 0 && memTotal > 0) {
|
||||
memoryFormat = formatFilesize(memTotal - memAvail) + ' / ' + formatFilesize(memTotal)
|
||||
memUsage = Math.round(((memTotal - memAvail) / memTotal) * 100)
|
||||
} else if (memTotal) {
|
||||
memoryFormat = formatFilesize(memTotal)
|
||||
}
|
||||
|
||||
let memUsageColor = 'primary'
|
||||
if (memUsage && memUsage > 95) memUsageColor = 'error'
|
||||
else if (memUsage && memUsage > 80) memUsageColor = 'warning'
|
||||
|
||||
let tempSensor = rootGetters['printer/getHostTempSensor']
|
||||
if (tempSensor === null) {
|
||||
tempSensor = {
|
||||
@@ -103,6 +118,7 @@ export const getters: GetterTree<ServerState, any> = {
|
||||
cpuName: state.system_info?.cpu_info?.processor ?? null,
|
||||
cpuDesc: state.system_info?.cpu_info?.cpu_desc ?? null,
|
||||
version,
|
||||
pythonVersion,
|
||||
os: state.system_info?.distribution?.name ?? null,
|
||||
release_info: state.system_info?.distribution?.release_info ?? null,
|
||||
load,
|
||||
@@ -112,10 +128,35 @@ export const getters: GetterTree<ServerState, any> = {
|
||||
memUsed: formatFilesize(memTotal - memAvail),
|
||||
memAvail: formatFilesize(memAvail),
|
||||
memTotal: formatFilesize(memTotal),
|
||||
memUsage,
|
||||
memUsageColor,
|
||||
tempSensor,
|
||||
}
|
||||
}
|
||||
|
||||
return output
|
||||
},
|
||||
|
||||
getCpuUsage: (state) => {
|
||||
if ('cpu' in state.system_cpu_usage) {
|
||||
return Math.round(state.system_cpu_usage.cpu)
|
||||
}
|
||||
|
||||
return null
|
||||
},
|
||||
|
||||
getNetworkInterfaces: (state) => {
|
||||
const interfaces: { [key: string]: ServerStateNetworkInterface } = {}
|
||||
|
||||
Object.keys(state.network_stats).forEach((interfaceName: string) => {
|
||||
if (interfaceName !== 'lo') {
|
||||
if (state.system_info?.network && interfaceName in state.system_info.network) {
|
||||
interfaces[interfaceName] = { ...state.network_stats[interfaceName] }
|
||||
interfaces[interfaceName].details = { ...state.system_info.network[interfaceName] }
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return interfaces
|
||||
},
|
||||
}
|
||||
@@ -32,6 +32,8 @@ export const getDefaultState = (): ServerState => {
|
||||
bits: 0,
|
||||
flags: [],
|
||||
},
|
||||
network_stats: {},
|
||||
system_cpu_usage: {},
|
||||
dbNamespaces: [],
|
||||
websocket_count: 0,
|
||||
moonraker_version: '',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
import { getDefaultState } from './index'
|
||||
import { MutationTree } from 'vuex'
|
||||
import { ServerState } from '@/store/server/types'
|
||||
import { ServerState, ServerStateNetworkInterface } from '@/store/server/types'
|
||||
import { formatConsoleMessage, formatTime } from '@/plugins/helpers'
|
||||
import { maxEventHistory } from '@/store/variables'
|
||||
|
||||
@@ -37,6 +37,22 @@ export const mutations: MutationTree<ServerState> = {
|
||||
Vue.set(state, 'klippy_message', 'Shutdown...')
|
||||
},
|
||||
|
||||
setCpuTemp(state, payload) {
|
||||
Vue.set(state, 'cpu_temp', payload)
|
||||
},
|
||||
|
||||
setMoonrakerStats(state, payload) {
|
||||
Vue.set(state, 'moonraker_stats', payload)
|
||||
},
|
||||
|
||||
setNetworkStats(state, payload) {
|
||||
Vue.set(state, 'network_stats', payload)
|
||||
},
|
||||
|
||||
setCpuStats(state, payload) {
|
||||
Vue.set(state, 'system_cpu_usage', payload)
|
||||
},
|
||||
|
||||
setKlippyConnectedTimer(state, timer) {
|
||||
Vue.set(state, 'klippy_connected_timer', timer)
|
||||
},
|
||||
|
||||
@@ -24,6 +24,13 @@ export interface ServerState {
|
||||
distribution: ServerStateDistribution
|
||||
sd_info: ServerStateSdInfo
|
||||
service_state: ServerStateServiceStates
|
||||
python: {
|
||||
version: string[]
|
||||
version_string: string
|
||||
}
|
||||
network: {
|
||||
[key: string]: ServerStateNetwork
|
||||
}
|
||||
} | null
|
||||
moonraker_stats: {
|
||||
cpu_usage: number
|
||||
@@ -36,6 +43,12 @@ export interface ServerState {
|
||||
bits: number
|
||||
flags: string[]
|
||||
}
|
||||
network_stats: {
|
||||
[name: string]: ServerStateNetworkInterface
|
||||
}
|
||||
system_cpu_usage: {
|
||||
[name: string]: number
|
||||
}
|
||||
dbNamespaces: string[]
|
||||
websocket_count: number
|
||||
moonraker_version: string
|
||||
@@ -107,3 +120,21 @@ export interface ServerStateServiceState {
|
||||
active_state: string
|
||||
sub_state: string
|
||||
}
|
||||
|
||||
export interface ServerStateNetwork {
|
||||
mac_address: string
|
||||
ip_addresses: ServerStateNetworkIpaddresses[]
|
||||
}
|
||||
|
||||
export interface ServerStateNetworkIpaddresses {
|
||||
family: 'ipv4' | 'ipv6'
|
||||
address: string
|
||||
is_link_local: boolean
|
||||
}
|
||||
|
||||
export interface ServerStateNetworkInterface {
|
||||
bandwidth: number
|
||||
rx_bytes: number
|
||||
tx_bytes: number
|
||||
details?: ServerStateNetwork
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export const actions: ActionTree<SocketState, RootState> = {
|
||||
break
|
||||
|
||||
case 'notify_proc_stat_update':
|
||||
commit('server/setProcStats', payload.params[0], { root: true })
|
||||
dispatch('server/updateProcStats', payload.params[0], { root: true })
|
||||
break
|
||||
|
||||
case 'notify_cpu_throttled':
|
||||
|
||||
Reference in new issue
Block a user