From e810025a6d69080551a373275b96d6e4f7267f2c Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 17 Apr 2023 02:10:06 +0200 Subject: [PATCH] Added `Cpu` and `CpuTimes` entities. --- .../src/components/panels/Entities/Cpu.vue | 1 + .../components/panels/Entities/CpuInfo.vue | 12 +++--- .../components/panels/Entities/CpuTimes.vue | 37 +++++++++++++++++++ .../src/components/panels/Entities/meta.json | 16 ++++++++ platypush/entities/system.py | 36 ++++++++++++++++++ 5 files changed, 97 insertions(+), 5 deletions(-) create mode 120000 platypush/backend/http/webapp/src/components/panels/Entities/Cpu.vue create mode 100644 platypush/backend/http/webapp/src/components/panels/Entities/CpuTimes.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 new file mode 120000 index 00000000..792c7695 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/panels/Entities/Cpu.vue @@ -0,0 +1 @@ +Device.vue \ No newline at end of file diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/CpuInfo.vue b/platypush/backend/http/webapp/src/components/panels/Entities/CpuInfo.vue index e641ed6b..5d68e4ec 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/CpuInfo.vue +++ b/platypush/backend/http/webapp/src/components/panels/Entities/CpuInfo.vue @@ -9,7 +9,7 @@
-
CPU Info
+
@@ -18,7 +18,7 @@
-
+
Architecture
@@ -170,16 +170,18 @@ export default { .entity { .head { padding: 0.25em; + + .icon { + margin-right: 1em; + } } } .collapse-toggler { display: flex; - justify-content: center; align-items: center; flex: 1; min-height: 3em; - margin-left: 0; cursor: pointer; &:hover { @@ -187,7 +189,7 @@ export default { } } -.child { +.attributes .child { margin: 0 -0.5em; padding: 0.5em 1em; diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/CpuTimes.vue b/platypush/backend/http/webapp/src/components/panels/Entities/CpuTimes.vue new file mode 100644 index 00000000..8c845e68 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/panels/Entities/CpuTimes.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/meta.json b/platypush/backend/http/webapp/src/components/panels/Entities/meta.json index 1fae044a..aaf4e2fd 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/meta.json +++ b/platypush/backend/http/webapp/src/components/panels/Entities/meta.json @@ -16,6 +16,22 @@ }, "cpu_info": { + "name": "System", + "name_plural": "System", + "icon": { + "class": "fas fa-circle-info" + } + }, + + "cpu_times": { + "name": "System", + "name_plural": "System", + "icon": { + "class": "fas fa-clock" + } + }, + + "cpu": { "name": "System", "name_plural": "System", "icon": { diff --git a/platypush/entities/system.py b/platypush/entities/system.py index 4484dec7..2e3831b8 100644 --- a/platypush/entities/system.py +++ b/platypush/entities/system.py @@ -5,6 +5,24 @@ from platypush.common.db import Base from . import Entity +if 'cpu' not in Base.metadata: + + class Cpu(Entity): + """ + ``CPU`` ORM (container) model. + """ + + __tablename__ = 'cpu' + + id = Column( + Integer, ForeignKey(Entity.id, ondelete='CASCADE'), primary_key=True + ) + + __mapper_args__ = { + 'polymorphic_identity': __tablename__, + } + + if 'cpu_info' not in Base.metadata: class CpuInfo(Entity): @@ -34,3 +52,21 @@ if 'cpu_info' not in Base.metadata: __mapper_args__ = { 'polymorphic_identity': __tablename__, } + + +if 'cpu_times' not in Base.metadata: + + class CpuTimes(Entity): + """ + ``CpuTimes`` ORM (container) model. + """ + + __tablename__ = 'cpu_times' + + id = Column( + Integer, ForeignKey(Entity.id, ondelete='CASCADE'), primary_key=True + ) + + __mapper_args__ = { + 'polymorphic_identity': __tablename__, + }