@@ -333,12 +325,13 @@ import { mapFields } from "vuex-map-fields";
import ResultsSummary from "./ResultsSummary";
import WordCloud from "./WordCloud.vue";
import BibliographyCriteria from "./BibliographyCriteria";
+import ProgressSpinner from "./ProgressSpinner";
import { Collapse, Tab } from "bootstrap";
export default {
name: "collocation-report",
components: {
- ResultsSummary, WordCloud, BibliographyCriteria
+ ResultsSummary, WordCloud, BibliographyCriteria, ProgressSpinner
},
computed: {
...mapFields([
@@ -414,7 +407,8 @@ export default {
similarSearchProgress: "",
similarSearching: false,
timeSeriesInterval: 10,
- collocationTimePeriods: []
+ collocationTimePeriods: [],
+ progressPercent: 0
};
},
created() {
@@ -583,6 +577,9 @@ export default {
} else {
this.wholeCorpus = false
}
+ if (Object.keys(fullResults).length === 0) {
+ this.progressPercent = 0
+ }
this.collocMethod = 'compare';
this.comparedMetadataValues = this.dateRangeHandler(this.metadataInputStyle, this.dateRange, this.dateType, this.comparedMetadataValues)
let params = {
@@ -590,8 +587,8 @@ export default {
colloc_filter_choice: this.colloc_filter_choice,
colloc_within: this.colloc_within,
filter_frequency: this.filter_frequency,
- q_attribute: this.q_attribute,
- q_attribute_value: this.q_attribute_value,
+ q_attribute: this.q_attribute || "",
+ q_attribute_value: this.q_attribute_value || "",
...this.comparedMetadataValues,
start: start.toString(),
};
@@ -611,7 +608,9 @@ export default {
let start = response.data.hits_done;
if (resultsLength) {
if (moreResults) {
+ this.progressPercent = Math.trunc((start / resultsLength) * 100)
this.getOtherCollocates(response.data.collocates, start);
+ console.log(this.progressPercent)
}
else {
this.compareSearching = false;
@@ -661,12 +660,13 @@ export default {
this.mostSimilarDistributions = []
if (typeof first === 'undefined') {
first = true
+ this.progressPercent = 0
}
else {
first = false
}
this.$http
- .get(`${this.$dbUrl}/reports/collocation.py`, {
+ .post(`${this.$dbUrl}/reports/collocation.py`, {
current_collocates: [],
}, {
params: {
@@ -675,13 +675,14 @@ export default {
colloc_within: this.colloc_within,
filter_frequency: this.filter_frequency,
map_field: field.value,
- q_attribute: this.q_attribute,
- q_attribute_value: this.q_attribute_value,
+ q_attribute: this.q_attribute || "",
+ q_attribute_value: this.q_attribute_value || "",
first: first,
max_time: 2
}
}).then((response) => {
if (response.data.more_results) {
+ this.progressPercent = Math.trunc((response.data.hits_done / response.data.results_length) * 100)
this.similarCollocDistributions(field, response.data.hits_done, first);
} else {
this.getMostSimilarCollocDistribution(response.data.file_path);
@@ -692,6 +693,7 @@ export default {
},
getMostSimilarCollocDistribution(filePath) {
+ this.progressPercent = 0
this.similarSearchProgress = this.$t("collocation.similarCollocCompareMessage")
this.$http.post(`${this.$dbUrl}/scripts/get_similar_collocate_distributions.py`, {
collocates: this.collocateCounts,
@@ -894,6 +896,19 @@ input:focus::placeholder {
background: $link-color;
color: #fff;
}
+
+.spinner-container {
+ position: relative;
+}
+
+.spinner-text {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ font-size: .75rem;
+ color: $link-color;
+}
\ No newline at end of file
diff --git a/www/app/src/components/ResultsSummary.vue b/www/app/src/components/ResultsSummary.vue
index 8d351828..7adf9ca4 100644
--- a/www/app/src/components/ResultsSummary.vue
+++ b/www/app/src/components/ResultsSummary.vue
@@ -3,8 +3,9 @@
-