refactoring
This commit is contained in:
11
docs/HistoDescrsProvider.js
Normal file
11
docs/HistoDescrsProvider.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
class HistoDescrsProvider {
|
||||||
|
|
||||||
|
static getHistoDescrsForBatchcode(batchcode) {
|
||||||
|
return fetch(`data/histograms/${batchcode}.json`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(histoDescrs => {
|
||||||
|
histoDescrs.histograms.sort((histoDescr1, histoDescr2) => histoDescr1.batchcodes.length - histoDescr2.batchcodes.length);
|
||||||
|
return histoDescrs;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,13 +15,10 @@ class HistogramView {
|
|||||||
#loadHistoDescrsForBatchcode(batchcode) {
|
#loadHistoDescrsForBatchcode(batchcode) {
|
||||||
const loadingText = document.createTextNode('Loading...');
|
const loadingText = document.createTextNode('Loading...');
|
||||||
this.#uiContainer.appendChild(loadingText);
|
this.#uiContainer.appendChild(loadingText);
|
||||||
return fetch(`data/histograms/${batchcode}.json`)
|
return HistoDescrsProvider
|
||||||
.then(response => {
|
.getHistoDescrsForBatchcode(batchcode)
|
||||||
loadingText.remove();
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(histoDescrs => {
|
.then(histoDescrs => {
|
||||||
histoDescrs.histograms.sort((histoDescr1, histoDescr2) => histoDescr1.batchcodes.length - histoDescr2.batchcodes.length);
|
loadingText.remove();
|
||||||
return histoDescrs;
|
return histoDescrs;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
<script src="./Utils.js"></script>
|
<script src="./Utils.js"></script>
|
||||||
<script src="./UIUtils.js"></script>
|
<script src="./UIUtils.js"></script>
|
||||||
<script src="./batchCodeTable.js"></script>
|
<script src="./batchCodeTable.js"></script>
|
||||||
|
<script src="./HistoDescrsProvider.js"></script>
|
||||||
<script src="./HistogramChartView.js"></script>
|
<script src="./HistogramChartView.js"></script>
|
||||||
<script src="./BatchcodeCombinationSelection.js"></script>
|
<script src="./BatchcodeCombinationSelection.js"></script>
|
||||||
<script src="./HistogramView.js"></script>
|
<script src="./HistogramView.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user