Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes: confirm publication delete (#266), subjectCount filter default (#271), filter contributors on lastName (#272) #278

Merged
merged 5 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions thoth-api/src/contributor/crud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ impl Crud for Contributor {
query = query.filter(
full_name
.ilike(format!("%{}%", filter))
.or(last_name.ilike(format!("%{}%", filter)))
.or(orcid.ilike(format!("%{}%", filter))),
);
}
Expand Down Expand Up @@ -104,6 +105,7 @@ impl Crud for Contributor {
query = query.filter(
full_name
.ilike(format!("%{}%", filter))
.or(last_name.ilike(format!("%{}%", filter)))
.or(orcid.ilike(format!("%{}%", filter))),
);
}
Expand Down
15 changes: 12 additions & 3 deletions thoth-api/src/graphql/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ impl QueryRoot {
offset(default = 0, description = "The number of items to skip"),
filter(
default = "".to_string(),
description = "A query string to search. This argument is a test, do not rely on it. At present it simply searches for case insensitive literals on full_name and orcid"
description = "A query string to search. This argument is a test, do not rely on it. At present it simply searches for case insensitive literals on full_name, last_name and orcid"
),
order(
default = ContributorOrderBy::default(),
Expand Down Expand Up @@ -455,7 +455,7 @@ impl QueryRoot {
arguments(
filter(
default = "".to_string(),
description = "A query string to search. This argument is a test, do not rely on it. At present it simply searches for case insensitive literals on full_name and orcid",
description = "A query string to search. This argument is a test, do not rely on it. At present it simply searches for case insensitive literals on full_name, last_name and orcid",
),
)
)]
Expand Down Expand Up @@ -815,7 +815,16 @@ impl QueryRoot {
Subject::from_id(&context.db, &subject_id).map_err(|e| e.into())
}

#[graphql(description = "Get the total number of subjects associated to works")]
#[graphql(
description = "Get the total number of subjects associated to works",
arguments(
filter(
default = "".to_string(),
description = "A query string to search. This argument is a test, do not rely on it. At present it simply searches for case insensitive literals on subject_code",
),
subject_type(description = "A specific type to filter by"),
)
)]
fn subject_count(
context: &Context,
filter: String,
Expand Down
14 changes: 10 additions & 4 deletions thoth-app/src/component/publication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::agent::notification_bus::NotificationBus;
use crate::agent::notification_bus::NotificationDispatcher;
use crate::agent::notification_bus::NotificationStatus;
use crate::agent::notification_bus::Request;
use crate::component::delete_dialogue::ConfirmDeleteComponent;
use crate::component::prices_form::PricesFormComponent;
use crate::component::utils::Loader;
use crate::models::publication::delete_publication_mutation::DeletePublicationRequest;
Expand All @@ -32,7 +33,6 @@ use crate::models::publication::publication_query::PublicationRequestBody;
use crate::models::publication::publication_query::Variables;
use crate::route::AdminRoute;
use crate::route::AppRoute;
use crate::string::DELETE_BUTTON;

pub struct PublicationComponent {
publication: PublicationWithRelations,
Expand Down Expand Up @@ -219,9 +219,15 @@ impl Component for PublicationComponent {
</div>
<div class="level-right">
<p class="level-item">
<button class="button is-danger" onclick=self.link.callback(|_| Msg::DeletePublication)>
{ DELETE_BUTTON }
</button>
<ConfirmDeleteComponent
onclick=self.link.callback(|_| Msg::DeletePublication)
object_name=self
.publication.isbn
.as_ref()
.map(|s| s.to_string())
.unwrap_or_else(|| self.publication.publication_id.to_string())
.clone()
/>
</p>
</div>
</nav>
Expand Down