refactoring

This commit is contained in:
frankknoll
2023-04-15 23:41:29 +02:00
parent 95b905c0f3
commit ebb76878f6
3 changed files with 10 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ class BatchCodeDetailsView {
#uiContainer; #uiContainer;
#headingElement; #headingElement;
#batchcodesSelectElement; #batchCodesSelectElement;
#adverseReactionReportsChartView; #adverseReactionReportsChartView;
#histogramChartView; #histogramChartView;
#chartWithSlider; #chartWithSlider;
@@ -10,7 +10,7 @@ class BatchCodeDetailsView {
constructor(uiContainer) { constructor(uiContainer) {
this.#uiContainer = uiContainer this.#uiContainer = uiContainer
this.#headingElement = this.#uiContainer.querySelector(".heading"); this.#headingElement = this.#uiContainer.querySelector(".heading");
this.#batchcodesSelectElement = new ElementWithSingleChangeEventListener(this.#uiContainer.querySelector("#batchcodesSelect")); this.#batchCodesSelectElement = new ElementWithSingleChangeEventListener(this.#uiContainer.querySelector("#batchCodesSelect"));
this.#adverseReactionReportsChartView = new AdverseReactionReportsChartView(this.#uiContainer.querySelector('#adverseReactionReportsChartView')); this.#adverseReactionReportsChartView = new AdverseReactionReportsChartView(this.#uiContainer.querySelector('#adverseReactionReportsChartView'));
this.#chartWithSlider = this.#uiContainer.querySelector('.chartWithSlider'); this.#chartWithSlider = this.#uiContainer.querySelector('.chartWithSlider');
this.#histogramChartView = new HistogramChartView(this.#chartWithSlider.querySelector("canvas")); this.#histogramChartView = new HistogramChartView(this.#chartWithSlider.querySelector("canvas"));
@@ -58,7 +58,7 @@ class BatchCodeDetailsView {
#displaySelectBatchcodeCombination(histograms) { #displaySelectBatchcodeCombination(histograms) {
BatchcodeCombinationSelection.configureSelectBatchcodeCombinationElement( BatchcodeCombinationSelection.configureSelectBatchcodeCombinationElement(
{ {
batchcodesSelectElement: this.#batchcodesSelectElement, batchCodesSelectElement: this.#batchCodesSelectElement,
histograms: histograms, histograms: histograms,
onSelect: histoDescr => this.#displayHistogram(histoDescr) onSelect: histoDescr => this.#displayHistogram(histoDescr)
}); });

View File

@@ -1,8 +1,8 @@
class BatchcodeCombinationSelection { class BatchcodeCombinationSelection {
static configureSelectBatchcodeCombinationElement({ batchcodesSelectElement, histograms, onSelect }) { static configureSelectBatchcodeCombinationElement({ batchCodesSelectElement, histograms, onSelect }) {
this.#setBatchcodeCombinationOptions(batchcodesSelectElement.element, histograms); this.#setBatchcodeCombinationOptions(batchCodesSelectElement.element, histograms);
batchcodesSelectElement.setSingleChangeEventListener( batchCodesSelectElement.setSingleChangeEventListener(
event => { event => {
const histoDescr = histograms[event.target.value]; const histoDescr = histograms[event.target.value];
onSelect(histoDescr); onSelect(histoDescr);
@@ -10,9 +10,9 @@ class BatchcodeCombinationSelection {
onSelect(histograms[0]); onSelect(histograms[0]);
} }
static #setBatchcodeCombinationOptions(batchcodesSelectElement, histograms) { static #setBatchcodeCombinationOptions(batchCodesSelectElement, histograms) {
UIUtils.clear(batchcodesSelectElement); UIUtils.clear(batchCodesSelectElement);
this.#getBatchcodeCombinationOptions(histograms).forEach(option => batchcodesSelectElement.add(option)); this.#getBatchcodeCombinationOptions(histograms).forEach(option => batchCodesSelectElement.add(option));
} }
static #getBatchcodeCombinationOptions(histograms) { static #getBatchcodeCombinationOptions(histograms) {

View File

@@ -49768,7 +49768,7 @@
<canvas id="adverseReactionReportsChartView"></canvas> <canvas id="adverseReactionReportsChartView"></canvas>
<div id="selectBatchcodeCombination"> <div id="selectBatchcodeCombination">
<label>Select batchcode combination: <label>Select batchcode combination:
<select id="batchcodesSelect" name="batchcodes"> <select id="batchCodesSelect" name="batchcodes">
</select> </select>
</label> </label>
<div class="chartWithSlider"> <div class="chartWithSlider">