Skip to content

Commit 438609f

Browse files
committed
Merge branch 'release/v0.9.14'
2 parents e3041c0 + e37f97e commit 438609f

20 files changed

Lines changed: 275 additions & 100 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [[0.9.14]](https://github.com/thoth-pub/thoth/releases/tag/v0.9.14) - 2023-03-01
10+
### Changed
11+
- Upgrade `openssl-src` to v111.25.0
12+
- Upgrade `bumpalo` to v3.12.0
13+
14+
### Fixed
15+
- [#326](https://github.com/thoth-pub/thoth/issues/326) - Debounce search queries
16+
917
## [[0.9.13]](https://github.com/thoth-pub/thoth/releases/tag/v0.9.13) - 2023-02-21
1018
### Changed
1119
- Input actix keep alive via CLI arguments

Cargo.lock

Lines changed: 15 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth"
3-
version = "0.9.13"
3+
version = "0.9.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" }
1616
members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"]
1717

1818
[dependencies]
19-
thoth-api = { version = "0.9.13", path = "thoth-api", features = ["backend"] }
20-
thoth-api-server = { version = "0.9.13", path = "thoth-api-server" }
21-
thoth-app-server = { version = "0.9.13", path = "thoth-app-server" }
22-
thoth-errors = { version = "0.9.13", path = "thoth-errors" }
23-
thoth-export-server = { version = "0.9.13", path = "thoth-export-server" }
19+
thoth-api = { version = "0.9.14", path = "thoth-api", features = ["backend"] }
20+
thoth-api-server = { version = "0.9.14", path = "thoth-api-server" }
21+
thoth-app-server = { version = "0.9.14", path = "thoth-app-server" }
22+
thoth-errors = { version = "0.9.14", path = "thoth-errors" }
23+
thoth-export-server = { version = "0.9.14", path = "thoth-export-server" }
2424
clap = "2.33.3"
2525
dialoguer = "0.7.1"
2626
dotenv = "0.15.0"

thoth-api-server/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api-server"
3-
version = "0.9.13"
3+
version = "0.9.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth"
99
readme = "README.md"
1010

1111
[dependencies]
12-
thoth-api = { version = "0.9.13", path = "../thoth-api", features = ["backend"] }
13-
thoth-errors = { version = "0.9.13", path = "../thoth-errors" }
12+
thoth-api = { version = "0.9.14", path = "../thoth-api", features = ["backend"] }
13+
thoth-errors = { version = "0.9.14", path = "../thoth-errors" }
1414
actix-web = "4.3.0"
1515
actix-cors = "0.6.4"
1616
actix-identity = "0.4.0"

thoth-api/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api"
3-
version = "0.9.13"
3+
version = "0.9.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" }
1616
backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web"]
1717

1818
[dependencies]
19-
thoth-errors = { version = "0.9.13", path = "../thoth-errors" }
19+
thoth-errors = { version = "0.9.14", path = "../thoth-errors" }
2020
actix-web = { version = "4.3.0", optional = true }
2121
argon2rs = "0.2.5"
2222
isbn2 = "0.4.0"

thoth-app-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-app-server"
3-
version = "0.9.13"
3+
version = "0.9.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"

thoth-app/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-app"
3-
version = "0.9.13"
3+
version = "0.9.14"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -41,5 +41,5 @@ uuid = { version = "0.8.2", features = ["serde", "v4"] }
4141
# `getrandom` is a dependency of `uuid`, we need to explicitly import and include the `js` feature to enable wasm
4242
# https://docs.rs/getrandom/latest/getrandom/#webassembly-support
4343
getrandom = { version = "0.2", features = ["js"] }
44-
thoth-api = { version = "0.9.13", path = "../thoth-api" }
45-
thoth-errors = { version = "0.9.13", path = "../thoth-errors" }
44+
thoth-api = { version = "0.9.14", path = "../thoth-api" }
45+
thoth-errors = { version = "0.9.14", path = "../thoth-errors" }

thoth-app/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start_url": "/?homescreen=1",
1010
"background_color": "#ffffff",
1111
"theme_color": "#ffdd57",
12-
"version": "0.9.13",
12+
"version": "0.9.14",
1313
"icons": [
1414
{
1515
"src": "\/android-icon-36x36.png",

thoth-app/src/component/affiliations_form.rs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use gloo_timers::callback::Timeout;
12
use thoth_api::model::affiliation::AffiliationWithInstitution;
23
use thoth_api::model::institution::Institution;
34
use thoth_errors::ThothError;
@@ -46,6 +47,7 @@ use crate::models::Dropdown;
4647
use crate::string::CANCEL_BUTTON;
4748
use crate::string::EDIT_BUTTON;
4849
use crate::string::REMOVE_BUTTON;
50+
use crate::DEFAULT_DEBOUNCING_TIMEOUT;
4951

5052
use super::ToElementValue;
5153
use super::ToOption;
@@ -62,6 +64,9 @@ pub struct AffiliationsFormComponent {
6264
delete_affiliation: PushDeleteAffiliation,
6365
update_affiliation: PushUpdateAffiliation,
6466
notification_bus: NotificationDispatcher,
67+
search_callback: Callback<()>,
68+
search_query: String,
69+
debounce_timeout: Option<Timeout>,
6570
}
6671

6772
#[derive(Default)]
@@ -77,7 +82,8 @@ pub enum Msg {
7782
SetInstitutionsFetchState(FetchActionInstitutions),
7883
GetInstitutions,
7984
ToggleSearchResultDisplay(bool),
80-
SearchInstitution(String),
85+
SearchQueryChanged(String),
86+
SearchInstitution,
8187
SetAffiliationCreateState(PushActionCreateAffiliation),
8288
CreateAffiliation,
8389
SetAffiliationUpdateState(PushActionUpdateAffiliation),
@@ -111,6 +117,8 @@ impl Component for AffiliationsFormComponent {
111117
let delete_affiliation = Default::default();
112118
let update_affiliation = Default::default();
113119
let notification_bus = NotificationBus::dispatcher();
120+
let search_callback = ctx.link().callback(|_| Msg::SearchInstitution);
121+
let search_query: String = Default::default();
114122

115123
ctx.link().send_message(Msg::GetAffiliations);
116124
ctx.link().send_message(Msg::GetInstitutions);
@@ -127,6 +135,9 @@ impl Component for AffiliationsFormComponent {
127135
delete_affiliation,
128136
update_affiliation,
129137
notification_bus,
138+
search_callback,
139+
search_query,
140+
debounce_timeout: None,
130141
}
131142
}
132143

@@ -138,7 +149,7 @@ impl Component for AffiliationsFormComponent {
138149
if show_form {
139150
let body = InstitutionsRequestBody {
140151
variables: SearchVariables {
141-
limit: Some(9999),
152+
limit: Some(25),
142153
..Default::default()
143154
},
144155
..Default::default()
@@ -391,11 +402,26 @@ impl Component for AffiliationsFormComponent {
391402
self.show_results = value;
392403
true
393404
}
394-
Msg::SearchInstitution(value) => {
405+
Msg::SearchQueryChanged(value) => {
406+
self.search_query = value;
407+
// cancel previous timeout
408+
self.debounce_timeout = self.debounce_timeout.take().and_then(|timeout| {
409+
timeout.cancel();
410+
None
411+
});
412+
// start new timeout
413+
let search_callback = self.search_callback.clone();
414+
let timeout = Timeout::new(DEFAULT_DEBOUNCING_TIMEOUT, move || {
415+
search_callback.emit(());
416+
});
417+
self.debounce_timeout = Some(timeout);
418+
false
419+
}
420+
Msg::SearchInstitution => {
395421
let body = InstitutionsRequestBody {
396422
variables: SearchVariables {
397-
filter: Some(value),
398-
limit: Some(9999),
423+
filter: Some(self.search_query.clone()),
424+
limit: Some(25),
399425
..Default::default()
400426
},
401427
..Default::default()
@@ -531,7 +557,7 @@ impl Component for AffiliationsFormComponent {
531557
placeholder="Search Institution"
532558
aria-haspopup="true"
533559
aria-controls="institutions-menu"
534-
oninput={ ctx.link().callback(|e: InputEvent| Msg::SearchInstitution(e.to_value())) }
560+
oninput={ ctx.link().callback(|e: InputEvent| Msg::SearchQueryChanged(e.to_value())) }
535561
onfocus={ ctx.link().callback(|_| Msg::ToggleSearchResultDisplay(true)) }
536562
onblur={ ctx.link().callback(|_| Msg::ToggleSearchResultDisplay(false)) }
537563
/>

thoth-app/src/component/catalogue.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub struct CatalogueComponent {
2525
limit: i32,
2626
offset: i32,
2727
page_size: i32,
28-
search_term: String,
28+
search_query: String,
2929
data: Vec<WorkWithRelations>,
3030
result_count: i32,
3131
fetch_data: FetchWorks,
@@ -39,7 +39,7 @@ pub enum Msg {
3939
PaginateData,
4040
#[allow(dead_code)]
4141
Search(String),
42-
ChangeSearchTerm(String),
42+
SearchQueryChanged(String),
4343
TriggerSearch,
4444
NextPage,
4545
PreviousPage,
@@ -53,7 +53,7 @@ impl Component for CatalogueComponent {
5353
let offset: i32 = Default::default();
5454
let page_size: i32 = 10;
5555
let limit: i32 = page_size;
56-
let search_term: String = Default::default();
56+
let search_query: String = Default::default();
5757
let result_count: i32 = Default::default();
5858
let data = Default::default();
5959
let fetch_data = Default::default();
@@ -64,7 +64,7 @@ impl Component for CatalogueComponent {
6464
limit,
6565
offset,
6666
page_size,
67-
search_term,
67+
search_query,
6868
data,
6969
result_count,
7070
fetch_data,
@@ -93,7 +93,7 @@ impl Component for CatalogueComponent {
9393
false
9494
}
9595
Msg::PaginateData => {
96-
let filter = self.search_term.clone();
96+
let filter = self.search_query.clone();
9797
let body = WorksRequestBody {
9898
variables: Variables {
9999
limit: Some(self.limit),
@@ -115,8 +115,8 @@ impl Component for CatalogueComponent {
115115
// needed because of macro, but unused here
116116
false
117117
}
118-
Msg::ChangeSearchTerm(term) => {
119-
self.search_term = term;
118+
Msg::SearchQueryChanged(term) => {
119+
self.search_query = term;
120120
false
121121
}
122122
Msg::TriggerSearch => {
@@ -178,9 +178,9 @@ impl Component for CatalogueComponent {
178178
<input
179179
class="input"
180180
type="search"
181-
value={ self.search_term.clone() }
181+
value={ self.search_query.clone() }
182182
placeholder={ self.search_text() }
183-
oninput={ ctx.link().callback(|e: InputEvent| Msg::ChangeSearchTerm(e.to_value())) }
183+
oninput={ ctx.link().callback(|e: InputEvent| Msg::SearchQueryChanged(e.to_value())) }
184184
/>
185185
<span class="icon is-left">
186186
<i class="fas fa-search" aria-hidden="true"></i>

0 commit comments

Comments
 (0)