refactoring

This commit is contained in:
frankknoll
2023-04-15 17:15:03 +02:00
parent 5927575ec8
commit 3a77fc63b3
3 changed files with 18 additions and 21 deletions

View File

@@ -14,7 +14,6 @@ class BatchCodeDetailsView {
}
#loadHistoDescrs(batchcode) {
UIUtils.clear(this.#uiContainer);
const loadingText = document.createTextNode('Loading...');
this.#uiContainer.appendChild(loadingText);
return HistoDescrsProvider
@@ -68,13 +67,14 @@ class BatchCodeDetailsView {
}
#displaySelectBatchcodeCombination(histograms, histogramChartView, chartWithSlider) {
const selectBatchcodeCombination =
BatchcodeCombinationSelection.getSelectBatchcodeCombination(
{
histograms: histograms,
onSelect: histoDescr => this.#displayHistogram(histoDescr, histogramChartView, chartWithSlider)
});
this.#uiContainer.appendChild(selectBatchcodeCombination);
const selectBatchcodeCombinationElement = this.#uiContainer.querySelector("#selectBatchcodeCombination");
BatchcodeCombinationSelection.configureSelectBatchcodeCombinationElement(
{
selectBatchcodeCombinationElement: selectBatchcodeCombinationElement,
histograms: histograms,
onSelect: histoDescr => this.#displayHistogram(histoDescr, histogramChartView, chartWithSlider)
});
this.#uiContainer.appendChild(selectBatchcodeCombinationElement);
}
#displayHistogram(histoDescr, histogramChartView, chartWithSlider) {

View File

@@ -1,8 +1,7 @@
class BatchcodeCombinationSelection {
static getSelectBatchcodeCombination({ histograms, onSelect }) {
const selectBatchcodeCombination = UIUtils.instantiateTemplate('template-selectBatchcodeCombination');
const batchcodesSelect = selectBatchcodeCombination.querySelector('#batchcodesSelect');
static configureSelectBatchcodeCombinationElement({ selectBatchcodeCombinationElement, histograms, onSelect }) {
const batchcodesSelect = selectBatchcodeCombinationElement.querySelector('#batchcodesSelect');
this.#addBatchcodeCombinationOptions(batchcodesSelect, histograms);
batchcodesSelect.addEventListener(
'change',
@@ -10,7 +9,6 @@ class BatchcodeCombinationSelection {
const histoDescr = histograms[event.target.value];
onSelect(histoDescr);
});
return selectBatchcodeCombination;
}
static #addBatchcodeCombinationOptions(batchcodesSelect, histograms) {

View File

@@ -49762,7 +49762,14 @@
<option value="Ø94F21A">Ø94F21A</option>
</select>
</p>
<div id="batchCodeDetails" style="width: 50%"></div>
<div id="batchCodeDetails" style="width: 50%">
<div id="selectBatchcodeCombination">
<label>Select batchcode combination:
<select id="batchcodesSelect" name="batchcodes">
</select>
</label>
</div>
</div>
<p><b>Data Source:</b>
<a href="https://vaers.hhs.gov/data/datasets.html" target="_blank">Vaccine Adverse Event Reporting System
(VAERS)</a>
@@ -49773,14 +49780,6 @@
<template id="template-canvas">
<canvas></canvas>
</template>
<template id="template-selectBatchcodeCombination">
<div>
<label>Select batchcode combination:
<select id="batchcodesSelect" name="batchcodes">
</select>
</label>
</div>
</template>
<template id="template-chartWithSlider">
<div class="chartWithSlider">
<div class="chartContainer">