diff --git a/docs/HistoDescrsProvider.js b/docs/HistoDescrsProvider.js
new file mode 100644
index 00000000000..e1f1943f796
--- /dev/null
+++ b/docs/HistoDescrsProvider.js
@@ -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;
+ });
+ }
+}
\ No newline at end of file
diff --git a/docs/HistogramView.js b/docs/HistogramView.js
index e77575db19a..76b9e7a4cfd 100644
--- a/docs/HistogramView.js
+++ b/docs/HistogramView.js
@@ -15,13 +15,10 @@ class HistogramView {
#loadHistoDescrsForBatchcode(batchcode) {
const loadingText = document.createTextNode('Loading...');
this.#uiContainer.appendChild(loadingText);
- return fetch(`data/histograms/${batchcode}.json`)
- .then(response => {
- loadingText.remove();
- return response.json();
- })
+ return HistoDescrsProvider
+ .getHistoDescrsForBatchcode(batchcode)
.then(histoDescrs => {
- histoDescrs.histograms.sort((histoDescr1, histoDescr2) => histoDescr1.batchcodes.length - histoDescr2.batchcodes.length);
+ loadingText.remove();
return histoDescrs;
});
}
diff --git a/docs/batchCodeTable.html b/docs/batchCodeTable.html
index f54600e5cc6..d81c5c9c870 100644
--- a/docs/batchCodeTable.html
+++ b/docs/batchCodeTable.html
@@ -22,6 +22,7 @@
+