Add tabledefs & ui item indexes
This commit is contained in:
parent
30b20f8e18
commit
a24ba21ba8
4 changed files with 24 additions and 10 deletions
9
src/static/js/tabledefs/index.mjs
Normal file
9
src/static/js/tabledefs/index.mjs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
import cpu from './cpu.mjs';
|
||||||
|
import cpu_live from './cpu_live.mjs';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
cpu,
|
||||||
|
cpu_live
|
||||||
|
}
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
import Emel from 'emel';
|
import Emel from 'emel';
|
||||||
|
|
||||||
|
import tabledefs from '../tabledefs/index.mjs';
|
||||||
import forkawesome_emel from './forkawesome_emel.mjs';
|
import forkawesome_emel from './forkawesome_emel.mjs';
|
||||||
|
|
||||||
import tabledefs from './tabledefs/index.mjs';
|
|
||||||
|
|
||||||
class GlobalUI {
|
class GlobalUI {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import Emel from 'emel';
|
import Emel from 'emel';
|
||||||
import fa_emel from './forkawesome_emel.mjs';
|
import fa_emel from './forkawesome_emel.mjs';
|
||||||
|
|
||||||
import UITable from './UITable.mjs';
|
import ui_item_index from './ui_item_index.mjs';
|
||||||
|
|
||||||
class TableView {
|
class TableView {
|
||||||
constructor(el) {
|
constructor(el) {
|
||||||
|
@ -32,15 +32,13 @@ class TableView {
|
||||||
el.classList.add("data-item");
|
el.classList.add("data-item");
|
||||||
el_dataitems.appendChild(el);
|
el_dataitems.appendChild(el);
|
||||||
|
|
||||||
let item_manager = null;
|
if(typeof ui_item_index[def.type] !== "undefined") {
|
||||||
switch(def.type) {
|
let item_manager = new ui_item_index[def.type](el, def);
|
||||||
case "table":
|
this.el_parts.set(def.name, item_manager);
|
||||||
item_manager = new UITable(el, def);
|
}
|
||||||
break;
|
else {
|
||||||
default:
|
|
||||||
console.warn(`Unknown item definition type '${def.type}', ignoring. This is probably a bug.`);
|
console.warn(`Unknown item definition type '${def.type}', ignoring. This is probably a bug.`);
|
||||||
}
|
}
|
||||||
this.el_parts.set(def.name, item_manager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.el.replaceChildren(parts);
|
this.el.replaceChildren(parts);
|
||||||
|
|
7
src/static/js/ui/ui_item_index.mjs
Normal file
7
src/static/js/ui/ui_item_index.mjs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
import UITable from './UITable.mjs';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
table: UITable
|
||||||
|
};
|
Loading…
Reference in a new issue