From 153d03d43fb8818c63a2b22a78e706748801fe53 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 19 Apr 2023 01:48:05 +0200 Subject: [PATCH] Moved CPU percentage on the level of the CPU entity instead of a child entity. --- .../src/components/panels/Entities/Cpu.vue | 47 ++++++++++++++++++- .../panels/Entities/MemoryStats.vue | 1 + platypush/entities/system.py | 2 + platypush/plugins/system/__init__.py | 6 +-- 4 files changed, 50 insertions(+), 6 deletions(-) mode change 120000 => 100644 platypush/backend/http/webapp/src/components/panels/Entities/Cpu.vue diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/Cpu.vue b/platypush/backend/http/webapp/src/components/panels/Entities/Cpu.vue deleted file mode 120000 index 792c769532..0000000000 --- a/platypush/backend/http/webapp/src/components/panels/Entities/Cpu.vue +++ /dev/null @@ -1 +0,0 @@ -Device.vue \ No newline at end of file diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/Cpu.vue b/platypush/backend/http/webapp/src/components/panels/Entities/Cpu.vue new file mode 100644 index 0000000000..1651837e98 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/panels/Entities/Cpu.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/MemoryStats.vue b/platypush/backend/http/webapp/src/components/panels/Entities/MemoryStats.vue index b013df2c61..5517414028 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/MemoryStats.vue +++ b/platypush/backend/http/webapp/src/components/panels/Entities/MemoryStats.vue @@ -135,6 +135,7 @@ export default { .value { text-align: right; + font-weight: bold; } } } diff --git a/platypush/entities/system.py b/platypush/entities/system.py index 687f81ac9b..cb9fbc1ff1 100644 --- a/platypush/entities/system.py +++ b/platypush/entities/system.py @@ -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__, } diff --git a/platypush/plugins/system/__init__.py b/platypush/plugins/system/__init__.py index dc455936d3..1031a63324 100644 --- a/platypush/plugins/system/__init__.py +++ b/platypush/plugins/system/__init__.py @@ -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(