.
This commit is contained in:
+47
-10
@@ -499,9 +499,9 @@ impl Publisher {
|
||||
|
||||
let property_label = self
|
||||
.ontology
|
||||
.label(triple.predicate.as_ref())
|
||||
.unwrap_or(self.ontology.abbreviate(triple.predicate.as_ref()).as_str())
|
||||
.to_string();
|
||||
.info(triple.predicate.as_ref())
|
||||
.and_then(|info| info.label.clone())
|
||||
.unwrap_or(self.ontology.abbreviate(triple.predicate.as_ref()));
|
||||
|
||||
let property: Element<Message> = if state.read_only {
|
||||
text(property_label).into()
|
||||
@@ -518,7 +518,8 @@ impl Publisher {
|
||||
|
||||
let value_label = term.value_as_named_node().and_then(|node| {
|
||||
self.ontology
|
||||
.label(node)
|
||||
.info(node)
|
||||
.and_then(|info| info.label.clone())
|
||||
.map(|label| container(text(label)))
|
||||
});
|
||||
|
||||
@@ -639,8 +640,8 @@ impl Publisher {
|
||||
let buttons = entities.map(|entity| {
|
||||
let label = self
|
||||
.ontology
|
||||
.label(entity.as_ref())
|
||||
.map(|label| label.to_string())
|
||||
.info(entity.as_ref())
|
||||
.and_then(|info| info.label.clone())
|
||||
.unwrap_or(entity.as_str().to_string());
|
||||
button(text(label))
|
||||
.on_press(Message::NewDocument(entity))
|
||||
@@ -659,19 +660,55 @@ impl Publisher {
|
||||
let search_input =
|
||||
text_input("Query", &search_state.query).on_input(Message::QueryUpdated);
|
||||
|
||||
let type_column = table::column("Type", |result: &NamedNode| {
|
||||
let label = self.ontology.label(result.as_ref()).unwrap_or("Unknown");
|
||||
let label_column = table::column("Label", |result: &NamedNode| {
|
||||
let header_text = self
|
||||
.ontology
|
||||
.info(result.as_ref())
|
||||
.and_then(|info| info.label.clone())
|
||||
.unwrap_or("".to_string());
|
||||
|
||||
button(text(label))
|
||||
button(text(header_text))
|
||||
.on_press(Message::SearchResultClicked(result.clone()))
|
||||
.style(button::text)
|
||||
});
|
||||
|
||||
let type_column = table::column("Type", |result: &NamedNode| {
|
||||
let header_text = self
|
||||
.ontology
|
||||
.info(result.as_ref())
|
||||
.map(|info| info.type_.to_string())
|
||||
.unwrap_or("Unknown".to_string());
|
||||
|
||||
button(text(header_text))
|
||||
.on_press(Message::SearchResultClicked(result.clone()))
|
||||
.style(button::text)
|
||||
});
|
||||
|
||||
/*let description_column = table::column("Description", |result: &NamedNode| {
|
||||
let header_text = self.ontology.info(result.as_ref())
|
||||
.and_then(|info| info.comment.clone())
|
||||
.unwrap_or("Unknown".to_string());
|
||||
|
||||
button(text(header_text))
|
||||
.on_press(Message::SearchResultClicked(result.clone()))
|
||||
.style(button::text)
|
||||
});*/
|
||||
|
||||
let iri_column = table::column("IRI", |result: &NamedNode| {
|
||||
button(text(result.as_str()))
|
||||
.on_press(Message::SearchResultClicked(result.clone()))
|
||||
.style(button::text)
|
||||
});
|
||||
let results_table = scrollable(table([type_column, iri_column], &search_state.results));
|
||||
|
||||
let results_table = scrollable(table(
|
||||
[
|
||||
label_column,
|
||||
//description_column,
|
||||
type_column,
|
||||
iri_column,
|
||||
],
|
||||
&search_state.results,
|
||||
));
|
||||
|
||||
return column![search_input, results_table].into();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user