Skip to content

Commit

Permalink
hitsInProgress in kwicStore
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Jun 17, 2024
1 parent 8aa88ea commit 4e45f4b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/scripts/components/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ angular.module("korpApp").component("results", {
aborted="aborted"
loading="loading"
active="active"
hits-in-progress="hitsInProgress"
hits-in-progress="$ctrl.hitsInProgress"
hits="$ctrl.hits"
kwic-input="kwic"
corpus-hits="corpusHits"
Expand Down Expand Up @@ -149,7 +149,7 @@ angular.module("korpApp").component("results", {
$rootScope.graphTabs.length ||
$rootScope.mapTabs.length

kwicStore.syncTo($ctrl, ["hits"])
kwicStore.syncTo($ctrl, ["hits", "hitsInProgress"])
},
],
})
6 changes: 2 additions & 4 deletions app/scripts/controllers/kwic_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ export class KwicCtrl {
const s = scope

s.initialSearch = true
/** Number of search hits, may change while search is in progress. */
s.hitsProgress = undefined

this.setupListeners()

Expand Down Expand Up @@ -148,7 +146,7 @@ export class KwicCtrl {
s.onProgress = (progressObj, isPaging) => {
s.progress = Math.round(progressObj["stats"])
if (!isPaging && progressObj["total_results"] !== null) {
s.hitsInProgress = progressObj["total_results"]
kwicStore.set("hitsInProgress", progressObj["total_results"])
}
}

Expand Down Expand Up @@ -211,7 +209,7 @@ export class KwicCtrl {
s.loading = false
if (!isPaging) {
kwicStore.set("hits", data.hits)
s.hitsInProgress = data.hits
kwicStore.set("hitsInProgress", data.hits)
s.corpusHits = data.corpus_hits
}
}
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/store/kwic.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import { createStore } from "./store"
type KwicState = {
/** Number of total search hits, updated when a search is completed. */
hits?: number
/** Number of search hits, may change while search is in progress. */
hitsInProgress?: number
}

const init = () => ({
hits: undefined,
hitsInProgress: undefined,
})

const kwicStore = createStore<KwicState>("kwic", init)
Expand Down

0 comments on commit 4e45f4b

Please sign in to comment.