.
This commit is contained in:
+32
-9
@@ -19,6 +19,7 @@ use oxigraph::io::RdfFormat;
|
||||
use oxigraph::model::vocab::{rdf, rdfs};
|
||||
use oxigraph::model::{BaseDirection, BlankNode, Dataset, NamedNode, NamedNodeRef, NamedOrBlankNode, Quad, Term, Triple};
|
||||
use tracing::{debug, debug_span, error, info, trace};
|
||||
use crate::app::Message::URLInputSubmitted;
|
||||
use crate::rdf::language;
|
||||
use crate::rdf::vocab::rda;
|
||||
use crate::widget::iri_input::iri_input;
|
||||
@@ -57,6 +58,8 @@ pub(crate) enum Message {
|
||||
HideOverwriteConfirmationModal,
|
||||
ConfirmOverwrite,
|
||||
NewDocument(NamedNode),
|
||||
NavigateToPredicate(QuadKey),
|
||||
NavigateToObject(QuadKey),
|
||||
ResetState,
|
||||
}
|
||||
|
||||
@@ -332,15 +335,19 @@ impl Publisher {
|
||||
SearchResultClickAction::URLInput => None,
|
||||
};
|
||||
|
||||
let (id, window_task) = window::open(Settings::default());
|
||||
self.search_state = Some(SearchState {
|
||||
window_id: id,
|
||||
action,
|
||||
entity_selection: None,
|
||||
query: String::new(),
|
||||
results: Vec::new(),
|
||||
});
|
||||
task = window_task.map(|_| Message::None);
|
||||
if let Some(search_state) = &mut self.search_state {
|
||||
search_state.action = action;
|
||||
} else {
|
||||
let (id, window_task) = window::open(Settings::default());
|
||||
self.search_state = Some(SearchState {
|
||||
window_id: id,
|
||||
action,
|
||||
entity_selection: None,
|
||||
query: String::new(),
|
||||
results: Vec::new(),
|
||||
});
|
||||
task = window_task.map(|_| Message::None);
|
||||
}
|
||||
|
||||
if let Some(selected_entity_class) = selected_entity_class {
|
||||
let selection = self.ontology.info(&selected_entity_class.into_owned(), &*language::ENGLISH_OR_UNTAGGED);
|
||||
@@ -525,6 +532,20 @@ impl Publisher {
|
||||
self.show_new_document_buttons = false;
|
||||
self.show_overwrite_confirmation = false;
|
||||
}
|
||||
Message::NavigateToPredicate(key) => {
|
||||
if let Some(quad) = self.document.dataset_mut().quads.get_mut(key) {
|
||||
self.url_input = quad.predicate.as_str().to_string();
|
||||
task = Task::done(URLInputSubmitted);
|
||||
}
|
||||
}
|
||||
Message::NavigateToObject(key) => {
|
||||
if let Some(quad) = self.document.dataset_mut().quads.get_mut(key) {
|
||||
if let Term::NamedNode(node) = &quad.object {
|
||||
self.url_input = node.as_str().to_string();
|
||||
task = Task::done(URLInputSubmitted);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
task
|
||||
@@ -563,6 +584,7 @@ impl Publisher {
|
||||
} else {
|
||||
predicate_input_base.on_input(move |value| Message::PredicateUpdated(key, value))
|
||||
.on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Predicate(key)))
|
||||
.on_shift_click(Message::NavigateToPredicate(key))
|
||||
};
|
||||
|
||||
let term = TermHelper::new(&triple.object);
|
||||
@@ -592,6 +614,7 @@ impl Publisher {
|
||||
object_input_base.align_x(value_alignment)
|
||||
.on_input(move |value| Message::ObjectUpdated(key, value))
|
||||
.on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Object(key)))
|
||||
.on_shift_click(Message::NavigateToObject(key))
|
||||
};
|
||||
|
||||
let selected_datatype = term.datatype().map(|node| self.ontology.abbreviate(node));
|
||||
|
||||
Reference in New Issue
Block a user