Display spinner animation during loading

This commit is contained in:
Zaid Abdulla committed 2021-02-16 00:09:24 -08:00
1 parent 4871613c67
commit 688811317c
23 files changed
+447 -307

No files matched your search

+16 -4
View File
@@ -42,13 +42,25 @@ export const component: ClosureComponent = (): Component => {
view: (vnode) => {
document.title = `${vnode.attrs["deviceId"]} - Devices - GenieACS`;
const dev = store.fetch("devices", vnode.attrs["deviceFilter"]).value;
if (!dev.length) return "Loading";
const dev = store.fetch("devices", vnode.attrs["deviceFilter"]);
if (!dev.value.length) {
if (!dev.fulfilling)
return m("p.error", `No such device ${vnode.attrs["deviceId"]}`);
return m(
"loading",
{ queries: [dev] },
m("div", { style: "height: 100px;" })
);
}
const conf = config.ui.device;
const cmps = [];
for (const c of Object.values(conf))
cmps.push(m.context({ device: dev[0] }, c["type"], c));
for (const c of Object.values(conf)) {
cmps.push(
m.context({ device: dev.value[0], deviceQuery: dev }, c["type"], c)
);
}
return [m("h1", vnode.attrs["deviceId"]), cmps];
},