refactoring
This commit is contained in:
30
docs/BatchcodeCombinationSelection.js
Normal file
30
docs/BatchcodeCombinationSelection.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
class BatchcodeCombinationSelection {
|
||||||
|
|
||||||
|
getSelectBatchcodeCombination({ histograms, onSelect }) {
|
||||||
|
const selectBatchcodeCombination = UIUtils.instantiateTemplate('template-selectBatchcodeCombination');
|
||||||
|
const batchcodesSelect = selectBatchcodeCombination.querySelector('#batchcodesSelect');
|
||||||
|
this.#addBatchcodeCombinationOptions(batchcodesSelect, histograms);
|
||||||
|
batchcodesSelect.addEventListener(
|
||||||
|
'change',
|
||||||
|
event => {
|
||||||
|
const histoDescr = histograms[event.target.value];
|
||||||
|
onSelect(histoDescr);
|
||||||
|
});
|
||||||
|
return selectBatchcodeCombination;
|
||||||
|
}
|
||||||
|
|
||||||
|
#addBatchcodeCombinationOptions(batchcodesSelect, histograms) {
|
||||||
|
this.#getBatchcodeCombinationOptions(histograms).forEach(option => batchcodesSelect.add(option));
|
||||||
|
}
|
||||||
|
|
||||||
|
#getBatchcodeCombinationOptions(histograms) {
|
||||||
|
return histograms.map(this.#getBatchcodeCombinationOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
#getBatchcodeCombinationOption(histoDescr, index) {
|
||||||
|
const option = document.createElement("option");
|
||||||
|
option.text = histoDescr.batchcodes.join(', ');
|
||||||
|
option.value = index;
|
||||||
|
return option;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,34 +92,3 @@ class HistogramView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BatchcodeCombinationSelection {
|
|
||||||
|
|
||||||
getSelectBatchcodeCombination({ histograms, onSelect }) {
|
|
||||||
const selectBatchcodeCombination = UIUtils.instantiateTemplate('template-selectBatchcodeCombination');
|
|
||||||
const batchcodesSelect = selectBatchcodeCombination.querySelector('#batchcodesSelect');
|
|
||||||
this.#addBatchcodeCombinationOptions(batchcodesSelect, histograms);
|
|
||||||
batchcodesSelect.addEventListener(
|
|
||||||
'change',
|
|
||||||
event => {
|
|
||||||
const histoDescr = histograms[event.target.value];
|
|
||||||
onSelect(histoDescr);
|
|
||||||
});
|
|
||||||
return selectBatchcodeCombination;
|
|
||||||
}
|
|
||||||
|
|
||||||
#addBatchcodeCombinationOptions(batchcodesSelect, histograms) {
|
|
||||||
this.#getBatchcodeCombinationOptions(histograms).forEach(option => batchcodesSelect.add(option));
|
|
||||||
}
|
|
||||||
|
|
||||||
#getBatchcodeCombinationOptions(histograms) {
|
|
||||||
return histograms.map(this.#getBatchcodeCombinationOption);
|
|
||||||
}
|
|
||||||
|
|
||||||
#getBatchcodeCombinationOption(histoDescr, index) {
|
|
||||||
const option = document.createElement("option");
|
|
||||||
option.text = histoDescr.batchcodes.join(', ');
|
|
||||||
option.value = index;
|
|
||||||
return option;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
<script src="./UIUtils.js"></script>
|
<script src="./UIUtils.js"></script>
|
||||||
<script src="./batchCodeTable.js"></script>
|
<script src="./batchCodeTable.js"></script>
|
||||||
<script src="./HistogramChartView.js"></script>
|
<script src="./HistogramChartView.js"></script>
|
||||||
|
<script src="./BatchcodeCombinationSelection.js"></script>
|
||||||
<script src="./HistogramView.js"></script>
|
<script src="./HistogramView.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user