table headings
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Timo Hocker 2020-09-02 12:05:48 +02:00
parent 4174e26496
commit 6e9d634f74
4 changed files with 46 additions and 16 deletions

View File

@ -4,6 +4,13 @@
class="table_view"
>
<table>
<tr v-if="headings.length > 0">
<th
v-for="(heading,key) of headings"
:key="key"
v-text="heading"
/>
</tr>
<tr
v-for="(item,key) of items"
:key="key"
@ -30,6 +37,10 @@ export default {
columns: {
type: Array,
required: true
},
headings: {
type: Array,
default: () => []
}
},
methods: { resolve_data }
@ -38,7 +49,7 @@ export default {
<style>
.table_view {
overflow: auto;
overflow-y: scoll;
width: max-content;
max-width: 100%;
max-height: 100vh;
@ -54,7 +65,7 @@ tr:nth-child(odd) {
color: var(--color-accent);
}
td {
td, th {
border: var(--sub-container-border);
padding: 3px;
}

View File

@ -10,6 +10,7 @@
v-else
:items="data"
:columns="config.columns"
:headings="config.headings"
/>
</template>

View File

@ -6,17 +6,10 @@
*/
export default {
sources: [
{
name: 'default',
limit: 140,
offset: 0
},
{
name: 'secondary',
limit: 10,
offset: 0
}
sources: [
{ name: 'default', limit: 140, offset: 0 },
{ name: 'secondary', limit: 10, offset: 0 },
{ name: 'version', limit: 1, offset: 0 }
],
displays: [
{
@ -50,12 +43,31 @@ export default {
]
},
{
source: 'secondary',
type: 'table',
source: 'secondary',
type: 'table',
headings: [
'timestamp',
'temperature',
'humidity',
'light',
'fan'
],
columns: [
'timestamp',
'data'
'data/temperature',
'data/humidity',
'data/light',
'data/latch'
]
},
{
source: 'version',
type: 'table',
headings: [ 'hardware version' ],
columns: [ 'message' ],
x: '',
y: [],
remove_duplicates: false
}
]
};

View File

@ -47,6 +47,12 @@ export default {
'chart'
]
},
{
name: 'headings',
type: 'array',
child: { type: 'string' },
if: { prop: 'type', op: '=', val: 'table' }
},
{
name: 'columns',
type: 'array',