Tidy up controller and make sure the different targets are properly separated

If not, it wouldn't show stalled if there were entropy bubbles in the page
This commit is contained in:
Jorge Manrubia
2025-06-06 09:15:51 +02:00
parent 6287acf5ba
commit f742749b0f
2 changed files with 10 additions and 10 deletions
@@ -4,7 +4,7 @@ import { signedDifferenceInDays } from "helpers/date_helpers"
const REFRESH_INTERVAL = 3_600_000 // 1 hour (in milliseconds)
export default class extends Controller {
static targets = [ "entropy", "top", "center", "bottom", "stalled" ]
static targets = [ "entropy", "entropyTop", "entropyCenter", "entropyBottom", "stalled", "stalledTop", "stalledCenter", "stalledBottom" ]
static values = { entropy: Object, stalled: Object }
#timer
@@ -47,9 +47,9 @@ export default class extends Controller {
}
#render({ target, top, center, bottom }) {
this.topTarget.innerHTML = top
this.centerTarget.innerHTML = center
this.bottomTarget.innerHTML = bottom
this[`${target}TopTarget`].innerHTML = top
this[`${target}CenterTarget`].innerHTML = center
this[`${target}BottomTarget`].innerHTML = bottom
const entropyTarget = target === "entropy"
this.entropyTarget.toggleAttribute("hidden", !entropyTarget)