.
This commit is contained in:
+22
-4
@@ -70,6 +70,7 @@ pub(crate) enum Message {
|
||||
NavigateBack,
|
||||
NavigateForward,
|
||||
ResetState,
|
||||
SetReadOnly(bool),
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
@@ -103,6 +104,7 @@ pub(crate) struct Publisher {
|
||||
url_input_valid: bool,
|
||||
navigator: Navigator<Url>,
|
||||
document: RdfSource<KeyedDataset<RowState>>,
|
||||
show_read_only: bool,
|
||||
hovered_row: Option<QuadKey>,
|
||||
search_state: Option<SearchState>,
|
||||
index: SearchIndex,
|
||||
@@ -161,6 +163,7 @@ impl Publisher {
|
||||
url_input_valid: true,
|
||||
navigator,
|
||||
document,
|
||||
show_read_only: false,
|
||||
hovered_row: None,
|
||||
search_state: None,
|
||||
index,
|
||||
@@ -278,11 +281,12 @@ impl Publisher {
|
||||
self.url_input = value;
|
||||
}
|
||||
Message::URLInputSubmitted => {
|
||||
let url = Url::parse(&self.url_input).expect("Invalid URL");
|
||||
if &url != self.navigator.current() {
|
||||
self.navigator.goto(url.clone());
|
||||
if let Ok(url) = Url::parse(&self.url_input) {
|
||||
if &url != self.navigator.current() {
|
||||
self.navigator.goto(url.clone());
|
||||
}
|
||||
task = Task::done(Message::NavigateTo(url));
|
||||
}
|
||||
task = Task::done(Message::NavigateTo(url));
|
||||
}
|
||||
Message::NavigateTo(url) => {
|
||||
task = Task::done(Message::DeleteAllRows)
|
||||
@@ -609,6 +613,9 @@ impl Publisher {
|
||||
task = Task::done(Message::URLInputChanged(url.to_string()))
|
||||
.chain(Task::done(Message::NavigateTo(url)));
|
||||
}
|
||||
Message::SetReadOnly(value) => {
|
||||
self.show_read_only = value;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
task
|
||||
@@ -883,6 +890,7 @@ impl Publisher {
|
||||
.document
|
||||
.dataset()
|
||||
.iter_both()
|
||||
.filter(|(_, _, state)| self.show_read_only || !state.read_only)
|
||||
.map(|(key, quad, state)| self.view_row(key, quad, state))
|
||||
.collect();
|
||||
|
||||
@@ -901,6 +909,15 @@ impl Publisher {
|
||||
save_button_base
|
||||
};
|
||||
|
||||
let read_only_toggle = toggler(self.show_read_only)
|
||||
.on_toggle(Message::SetReadOnly);
|
||||
|
||||
let footer = row![
|
||||
space::horizontal(),
|
||||
text("Show Read Only Triples"),
|
||||
read_only_toggle
|
||||
];
|
||||
|
||||
let content = navigation_area(column![
|
||||
row![
|
||||
reindex_ontology_button,
|
||||
@@ -912,6 +929,7 @@ impl Publisher {
|
||||
],
|
||||
scrollable(body),
|
||||
space::vertical(),
|
||||
footer,
|
||||
])
|
||||
.on_back_click(Message::NavigateBack)
|
||||
.on_forward_click(Message::NavigateForward);
|
||||
|
||||
Reference in New Issue
Block a user