mirror of
https://github.com/zaphar/Heracles.git
synced 2025-07-23 12:39:50 -04:00
fix: got rid of shadowRoot
plotly didn't play well with it.
This commit is contained in:
parent
d78c1ea26c
commit
59f8a5401a
@ -122,10 +122,6 @@ pub async fn index(State(config): State<Config>) -> Markup {
|
|||||||
script src="/js/plotly.js" { }
|
script src="/js/plotly.js" { }
|
||||||
script src="/js/htmx.js" { }
|
script src="/js/htmx.js" { }
|
||||||
script src="/js/lib.js" { }
|
script src="/js/lib.js" { }
|
||||||
template id="timeseries_template" {
|
|
||||||
div;
|
|
||||||
div;
|
|
||||||
}
|
|
||||||
(app(State(config.clone())).await)
|
(app(State(config.clone())).await)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,13 @@ class TimeseriesGraph extends HTMLElement {
|
|||||||
#intervalId;
|
#intervalId;
|
||||||
#pollSeconds;
|
#pollSeconds;
|
||||||
#label;
|
#label;
|
||||||
|
#targetNode = null;
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
const root = this.attachShadow({ mode: "open" });
|
|
||||||
var template = document.getElementById("timeseries_template");
|
|
||||||
this.#width = 800;
|
this.#width = 800;
|
||||||
this.#height = 600;
|
this.#height = 600;
|
||||||
this.#pollSeconds = 30;
|
this.#pollSeconds = 30;
|
||||||
root.appendChild(template.content.cloneNode(true));
|
this.#targetNode = this.appendChild(document.createElement("div"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static observedAttributes = ['uri', 'width', 'height', 'poll-seconds'];
|
static observedAttributes = ['uri', 'width', 'height', 'poll-seconds'];
|
||||||
@ -56,8 +55,8 @@ class TimeseriesGraph extends HTMLElement {
|
|||||||
static elementName = "timeseries-graph";
|
static elementName = "timeseries-graph";
|
||||||
|
|
||||||
getTargetNode() {
|
getTargetNode() {
|
||||||
console.log("shadowroot: ", this.shadowRoot);
|
console.log("targetNode: ", this.#targetNode);
|
||||||
return this.shadowRoot.firstChild;
|
return this.#targetNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
stopInterval() {
|
stopInterval() {
|
||||||
@ -96,7 +95,7 @@ class TimeseriesGraph extends HTMLElement {
|
|||||||
const labels = pair[0];
|
const labels = pair[0];
|
||||||
var trace = {
|
var trace = {
|
||||||
type: "scatter",
|
type: "scatter",
|
||||||
mode: "lines",
|
mode: "lines+text",
|
||||||
x: [],
|
x: [],
|
||||||
y: []
|
y: []
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user