forked from platypush/platypush
Moved CPU percentage on the level of the CPU entity instead of a child entity.
This commit is contained in:
parent
4ebfbf3851
commit
153d03d43f
4 changed files with 50 additions and 6 deletions
|
@ -1 +0,0 @@
|
|||
Device.vue
|
|
@ -0,0 +1,46 @@
|
|||
<template>
|
||||
<div class="entity cpu-container">
|
||||
<div class="head">
|
||||
<div class="col-1 icon">
|
||||
<EntityIcon
|
||||
:entity="value"
|
||||
:loading="loading"
|
||||
:error="error" />
|
||||
</div>
|
||||
|
||||
<div class="col-9 label">
|
||||
<div class="name" v-text="value.name" />
|
||||
</div>
|
||||
|
||||
<div class="col-2 value" v-text="Math.round(value.percent * 100, 1) + '%'" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import EntityMixin from "./EntityMixin"
|
||||
import EntityIcon from "./EntityIcon"
|
||||
|
||||
export default {
|
||||
name: 'Cpu',
|
||||
components: {EntityIcon},
|
||||
mixins: [EntityMixin],
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "common";
|
||||
|
||||
.cpu-container {
|
||||
.head {
|
||||
.value {
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -135,6 +135,7 @@ export default {
|
|||
|
||||
.value {
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ if 'cpu' not in Base.metadata:
|
|||
Integer, ForeignKey(Entity.id, ondelete='CASCADE'), primary_key=True
|
||||
)
|
||||
|
||||
percent = Column(Float)
|
||||
|
||||
__mapper_args__ = {
|
||||
'polymorphic_identity': __tablename__,
|
||||
}
|
||||
|
|
|
@ -807,6 +807,7 @@ class SystemPlugin(SensorPlugin, EntityManager):
|
|||
Cpu(
|
||||
id='system:cpu',
|
||||
name='CPU',
|
||||
percent=cpu['percent'],
|
||||
children=[
|
||||
CpuInfoModel(
|
||||
id='system:cpu:info',
|
||||
|
@ -857,11 +858,6 @@ class SystemPlugin(SensorPlugin, EntityManager):
|
|||
max=cpu['frequency']['max'],
|
||||
unit='MHz',
|
||||
),
|
||||
PercentSensor(
|
||||
id='system:cpu:percent',
|
||||
name='Percent',
|
||||
value=cpu['percent'],
|
||||
),
|
||||
],
|
||||
),
|
||||
MemoryStatsModel(
|
||||
|
|
Loading…
Reference in a new issue