def __init__(self, *args): super().__init__(*args) self.content = document.createElement("div") self.content.classList.add("content") self.node.appendChild(self.content) hider = document.createElement("div") hider.classList.add("scrollhider") self.node.appendChild(hider) self._create()
def __init__(self, container, dbname, key, title, unit): self.dbname = dbname self.key = key self.title = title self.unit = unit self.node = document.createElement("div") self.node.classList.add("panel") container.appendChild(self.node) self.titlenode = document.createElement("div") self.titlenode.classList.add("title") self.titlenode.innerText = title self.node.appendChild(self.titlenode)
def __init__(self, *args): super().__init__(*args) self.canvas = document.createElement("canvas") self.node.appendChild(self.canvas)
def on_init(): for dbname, data in data_per_db.items(): # Create panel container (and a title) title_el = document.createElement("div") container_el = document.createElement("div") title_el.innerText = dbname # .replace("_", " ") title_el.classList.add("panelcontainertitle") container_el.classList.add("panelcontainer") document.body.appendChild(title_el) document.body.appendChild(container_el) if dbname == "system" and window.info: panels.append( InfoPanel(container_el, dbname, "info", "system info")) # Collect panel types panel_kinds = {} for i in range(len(data)): aggr = data[i] for key in aggr.keys(): panel_kinds[key] = True # Sort the panel types - count, dcount, num, cat panel_kinds = panel_kinds.keys() panel_kinds.sort(key=panel_sort_func) # Create panels for i in range(len(panel_kinds)): key = panel_kinds[i] # Select panel class key_parts = key.split("|") if len(key_parts) == 2: name, type = key_parts unit = "" elif len(key_parts) == 3: name, type, unit = key_parts else: continue if type == "time": continue # skip time info elif type == "count": title = "# " + name Cls = CountPanel # noqa: N806 elif type == "dcount": title = "# daily " + name Cls = DailyCountPanel # noqa: N806 elif type == "mcount": title = "# monthly " + name Cls = MonthlyCountPanel # noqa: N806 elif type == "cat": title = name + "'s" Cls = CategoricalPanel # noqa: N806 elif type == "num": title = name Cls = NumericalPanel # noqa: N806 else: window.console.warn(f"Don't know what to do with {key}") continue if unit: title = title + " " + unit # Create panel panel = Cls(container_el, dbname, key, title, unit) panels.append(panel) on_hash_change() # calls on_resize()