Move component labels to containers

This commit is contained in:
Zaid Abdulla committed 2018-12-26 00:22:07 -08:00
1 parent 30dbf0cf40
commit 7194fcab44
5 files changed
+46 -12

No files matched your search

+5 -8
View File
@@ -103,14 +103,11 @@ const component = {
return m("tr", attrs, m("td.left", k), m("td.right", val)); return m("tr", attrs, m("td.left", k), m("td.right", val));
}); });
return [ return m(
m("h2", "Device parameters"), ".all-parameters",
m( search,
".all-parameters", m(".parameter-list", m("table", m("tbody", rows)))
search, );
m(".parameter-list", m("table", m("tbody", rows)))
)
];
} }
}; };
+11
View File
@@ -2,10 +2,21 @@
import m from "mithril"; import m from "mithril";
import * as components from "../components"; import * as components from "../components";
import * as store from "../store";
import Filter from "../../common/filter";
import * as funcCache from "../../common/func-cache";
const component = { const component = {
view: vnode => { view: vnode => {
if (vnode.attrs.filter) {
const filter = store.unpackFilter(
funcCache.get(Filter.parse, vnode.attrs.filter)
);
if (!filter.test(vnode.attrs.device)) return;
}
let children = Object.values(vnode.attrs.components).map(c => { let children = Object.values(vnode.attrs.components).map(c => {
if (typeof c !== "object") return `${c}`;
const attrs = Object.assign({}, vnode.attrs, c); const attrs = Object.assign({}, vnode.attrs, c);
return m(components.get(attrs.type), attrs); return m(components.get(attrs.type), attrs);
}); });
+1 -1
View File
@@ -64,7 +64,7 @@ const component = {
m("tr.empty", m("td", { colspan: headers.length }, "No faults")) m("tr.empty", m("td", { colspan: headers.length }, "No faults"))
); );
return [m("h2", "Faults"), m("table.table", thead, tbody)]; return m("table.table", thead, tbody);
} }
}; };
+9 -1
View File
@@ -473,7 +473,6 @@ span.na {
} }
.all-parameters { .all-parameters {
clear: both;
font-family: monospace; font-family: monospace;
& > input { & > input {
font-family: monospace; font-family: monospace;
@@ -511,6 +510,15 @@ span.na {
} }
} }
.container-right {
float: right;
clear: right;
}
.container-full-width {
clear: both;
}
.device-actions { .device-actions {
margin-top: 10px; margin-top: 10px;
& > button { & > button {
+20 -2
View File
@@ -246,10 +246,28 @@
] ]
}, },
{ {
"type": "device-faults" "type": "container",
"element": "div",
"components": [
{
"type": "container",
"element": "h3",
"components": ["Faults"]
},
{"type": "device-faults"}
]
}, },
{ {
"type": "all-parameters" "type": "container",
"element": "div.container-full-width",
"components": [
{
"type": "container",
"element": "h3",
"components": ["All parameters"]
},
{"type": "all-parameters"}
]
}, },
{ {
"type": "device-actions" "type": "device-actions"