Added Cpu and CpuTimes entities.

This commit is contained in:
Fabio Manganiello 2023-04-17 02:10:06 +02:00
parent 65481dc6b4
commit e810025a6d
Signed by: blacklight
GPG key ID: D90FBA7F76362774
5 changed files with 97 additions and 5 deletions

View file

@ -0,0 +1 @@
Device.vue

View file

@ -9,7 +9,7 @@
</div> </div>
<div class="col-10 label"> <div class="col-10 label">
<div class="name">CPU Info</div> <div class="name" v-text="value.name" />
</div> </div>
<div class="col-1 collapse-toggler" @click.stop="isCollapsed = !isCollapsed"> <div class="col-1 collapse-toggler" @click.stop="isCollapsed = !isCollapsed">
@ -18,7 +18,7 @@
</div> </div>
</div> </div>
<div class="body children fade-in" v-if="!isCollapsed"> <div class="body children attributes fade-in" v-if="!isCollapsed">
<div class="child" v-if="value.architecture"> <div class="child" v-if="value.architecture">
<div class="col-s-12 col-m-6 label"> <div class="col-s-12 col-m-6 label">
<div class="name">Architecture</div> <div class="name">Architecture</div>
@ -170,16 +170,18 @@ export default {
.entity { .entity {
.head { .head {
padding: 0.25em; padding: 0.25em;
.icon {
margin-right: 1em;
}
} }
} }
.collapse-toggler { .collapse-toggler {
display: flex; display: flex;
justify-content: center;
align-items: center; align-items: center;
flex: 1; flex: 1;
min-height: 3em; min-height: 3em;
margin-left: 0;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
@ -187,7 +189,7 @@ export default {
} }
} }
.child { .attributes .child {
margin: 0 -0.5em; margin: 0 -0.5em;
padding: 0.5em 1em; padding: 0.5em 1em;

View file

@ -0,0 +1,37 @@
<template>
<div class="entity cpu-times-container">
<div class="head">
<div class="col-1 icon">
<EntityIcon
:entity="value"
:loading="loading"
:error="error" />
</div>
<div class="col-11 label">
<div class="name" v-text="value.name" />
</div>
</div>
</div>
</template>
<script>
import EntityMixin from "./EntityMixin"
import EntityIcon from "./EntityIcon"
export default {
name: 'CpuTimes',
components: {EntityIcon},
mixins: [EntityMixin],
}
</script>
<style lang="scss" scoped>
@import "common";
.entity {
.icon {
margin-right: 1em;
}
}
</style>

View file

@ -16,6 +16,22 @@
}, },
"cpu_info": { "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": "System",
"name_plural": "System", "name_plural": "System",
"icon": { "icon": {

View file

@ -5,6 +5,24 @@ from platypush.common.db import Base
from . import Entity 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: if 'cpu_info' not in Base.metadata:
class CpuInfo(Entity): class CpuInfo(Entity):
@ -34,3 +52,21 @@ if 'cpu_info' not in Base.metadata:
__mapper_args__ = { __mapper_args__ = {
'polymorphic_identity': __tablename__, '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__,
}