error mng improvement

pull/37/head
Niko PLP 5 months ago
parent 00398272bd
commit 148838aada
  1. 2
      ng-app/index-web.html
  2. 15
      ng-app/src/apps/SparqlQueryEditor.svelte
  3. 3
      ng-app/src/apps/SparqlUpdateEditor.svelte
  4. 11
      ng-app/src/apps/TurtleViewer.svelte
  5. 91
      ng-app/src/lib/panes/Files.svelte
  6. 3
      ng-app/src/locales/en.json
  7. 2
      ng-app/src/store.ts
  8. 6
      ng-oxigraph/src/oxigraph/sparql/dataset.rs
  9. 12
      ng-sdk-js/src/lib.rs
  10. 2
      ng-verifier/src/request_processor.rs

@ -87,7 +87,7 @@
</svg>
<br/>
<div id="error-no-wasm" class="error-no-wasm-hidden" style="text-align: center;">
Your browser is too old and does not support NextGraph. <br/>Please upgrade to a newer version of this browser,<br/> try with another browser, <br/>or <a href="https://nextgraph.org/install">install our native app</a>.
Your browser is too old and does not support NextGraph. <br/>Please upgrade to a newer version of this browser,<br/> try with another browser, <br/>or <a href="https://nextgraph.org/download">install our native app</a>.
</div>
<noscript style="text-align: center;">
NextGraph cannot load as Javascript is deactivated

@ -15,7 +15,8 @@
sparql_query,
toast_error,
toast_success,
reset_toasts
reset_toasts,
display_error,
} from "../store";
import {
in_memory_discrete, open_viewer, set_viewer, reset_in_memory
@ -54,7 +55,7 @@
reset_toasts();
results = await sparql_query($in_memory_discrete, union);
} catch(e) {
toast_error(e);
toast_error(display_error(e));
}
}
const openTurtle = () => {
@ -92,9 +93,13 @@
<div>
<span class="ml-2 font-bold">Results: <br/></span>
{#if Array.isArray(results)}
<Highlight {language} code={results.join(" .\r\n") + " ."} class="mb-10" let:highlighted >
<LineNumbers {highlighted} wrapLines hideBorder />
</Highlight>
{#if results.length}
<Highlight {language} code={results.join(" .\r\n") + (results.length ? " .":"")} class="mb-10" let:highlighted >
<LineNumbers {highlighted} wrapLines hideBorder />
</Highlight>
{:else}
Empty
{/if}
{:else if results?.head}
<Table>
<TableHead>

@ -16,6 +16,7 @@
toast_error,
toast_success,
reset_toasts,
display_error,
} from "../store";
import {
in_memory_discrete, open_viewer, reset_in_memory
@ -41,7 +42,7 @@
await sparql_update($in_memory_discrete);
toast_success($t("app.sparql_update_editor.success"));
} catch(e) {
toast_error(e);
toast_error(display_error(e));
}
}
const openViewer = () => {

@ -36,7 +36,7 @@
export let commits = {graph:[]};
let source = "";
$: source = commits.graph.join(" .\r\n") + " .";
$: source = commits.graph.join(" .\r\n") + (commits.graph.length ? " .":"");
const openQuery = () => {
set_viewer("n:g:z:sparql_query");
@ -72,10 +72,11 @@
</button>
{/if}
<Highlight {language} code={source} class="mb-10" let:highlighted >
<LineNumbers {highlighted} wrapLines hideBorder />
</Highlight>
{#if source}
<Highlight {language} code={source} class="mb-10" let:highlighted >
<LineNumbers {highlighted} wrapLines hideBorder />
</Highlight>
{/if}
</div>

@ -156,7 +156,6 @@
object: reference.V0.FileUploaded,
},
};
await ng.app_request_with_nuri_command(nuri, "FilePut", $active_session.session_id, file_put_payload);
}
});
@ -167,6 +166,7 @@
<div class="w-full">
{#if $cur_tab.doc.can_edit}
<div class="row pt-2 w-full">
<Button
@ -187,51 +187,52 @@
bind:this={fileinput}
/>
</div>
{#if upload_progress !== null}
<div class="mx-6 mt-2">
<Progressbar
progress={(
(100 * upload_progress.current) /
upload_progress.total
).toFixed(0)}
labelOutside={$t("doc.file.upload_progress")}
/>
</div>
{/if}
{#if commits}
{#await commits.load()}
<p>{$t("connectivity.loading")}...</p>
{:then}
{#each $commits.files as file}
<p class="mb-5">
{#await get_blob(file, true)}
<div class="ml-2">
<Spinner />
</div>
{:then url}
{#await isImage(url) then is}
{#if is}
<img src={url} title={file.nuri} alt={file.name} />
{/if}
{/await}
<span class="ml-2 text-gray-600">{file.name}<br/></span>
{#if url === false}
<span><ExclamationTriangle tabindex="-1" class="ml-2 w-6 h-8 focus:outline-none" style="display:inline"/>{$t("errors.cannot_load_this_file")}</span>
{:else if prepare_url(file.nuri)}
<a bind:this={file_urls[file.nuri].click}
href={file_urls[file.nuri].url || ""}
target="_blank"
download={file.name}
></a>
<button class="ml-2 select-none p-1 pb-0 text-gray-600" style="box-shadow:none;" on:click={()=>download(file)}>
<span><ArrowDownTray tabindex="-1" class="w-6 h-8 mr-3 focus:outline-none" style="display:inline"/>{$t("doc.file.download")}</span>
</button>
{/if}
{#if upload_progress !== null}
<div class="mx-6 mt-2">
<Progressbar
progress={(
(100 * upload_progress.current) /
upload_progress.total
).toFixed(0)}
labelOutside={$t("doc.file.upload_progress")}
/>
</div>
{/if}
{#if commits}
{#await commits.load()}
<p>{$t("connectivity.loading")}...</p>
{:then}
{#each $commits.files as file}
<p class="mb-5">
{#await get_blob(file, true)}
<div class="ml-2">
<Spinner />
</div>
{:then url}
{#await isImage(url) then is}
{#if is}
<img src={url} title={file.nuri} alt={file.name} />
{/if}
{/await}
</p>
{/each}
{/await}
{/if}
<span class="ml-2 text-gray-600">{file.name}<br/></span>
{#if url === false}
<span><ExclamationTriangle tabindex="-1" class="ml-2 w-6 h-8 focus:outline-none" style="display:inline"/>{$t("errors.cannot_load_this_file")}</span>
{:else if prepare_url(file.nuri)}
<a bind:this={file_urls[file.nuri].click}
href={file_urls[file.nuri].url || ""}
target="_blank"
download={file.name}
></a>
<button class="ml-2 select-none p-1 pb-0 pt-0 text-gray-600" style="box-shadow:none;" on:click={()=>download(file)}>
<span><ArrowDownTray tabindex="-1" class="w-6 h-8 mr-3 focus:outline-none" style="display:inline"/>{$t("doc.file.download")}</span>
</button>
{/if}
{/await}
</p>
{/each}
{/await}
{/if}
</div>

@ -551,7 +551,8 @@
"NotARendezVous": "You scanned an invalid QR-Code.",
"camera_unavailable": "Camera is unavailable.",
"ServerAlreadyRunningInOtherProcess": "App is already running on this device. Check it and close it.",
"cannot_load_this_file": "Cannot load this file"
"cannot_load_this_file": "Cannot load this file",
"graph_not_found": "Graph not found"
},
"connectivity": {
"stopped": "Stopped",

@ -45,7 +45,7 @@ init({
});
export const display_error = (error: string) => {
console.log(error);
//console.log(error);
// TODO: Check, if error tranlsation does not exist
const parts = error.split(":");
let res = get(format)("errors." + parts[0]);

@ -72,9 +72,9 @@ impl DatasetView {
fn parse_graph_name(&self, graph_name: &EncodedTerm) -> Result<MatchBy, StorageError> {
match graph_name {
EncodedTerm::NamedNode { iri_id } => {
let graph_name_string = self.get_str(iri_id)?.ok_or::<StorageError>(
CorruptionError::msg("graph_name not found in parse_graph_name").into(),
)?;
let graph_name_string = self
.get_str(iri_id)?
.ok_or::<StorageError>(CorruptionError::msg("graph_not_found").into())?;
self.reader
.parse_graph_name(&graph_name_string, Some(*iri_id))
}

@ -938,9 +938,9 @@ async fn app_request_stream_(
Ok(promise) => match JsFuture::from(promise).await {
Ok(js_value) => {
if js_value == JsValue::TRUE {
log_debug!("cancel because true");
//log_debug!("cancel because true");
reader.close();
canceller_tx.send(()).await;
let _ = canceller_tx.send(()).await;
canceller_tx.close_channel();
break;
}
@ -949,9 +949,9 @@ async fn app_request_stream_(
},
Err(returned_val) => {
if returned_val == JsValue::TRUE {
log_debug!("cancel because true");
//log_debug!("cancel because true");
reader.close();
canceller_tx.send(()).await;
let _ = canceller_tx.send(()).await;
canceller_tx.close_channel();
break;
}
@ -968,7 +968,7 @@ async fn app_request_stream_(
async fn inner_canceller(mut canceller_rx: Receiver<()>, cancel: CancelFn) -> ResultSend<()> {
if let Some(_) = canceller_rx.next().await {
log_info!("cancelling");
//log_info!("cancelling");
cancel();
}
Ok(())
@ -981,7 +981,7 @@ async fn app_request_stream_(
let cb = Closure::once(move || {
log_info!("trying to cancel");
//sender.close_channel()
canceller_tx.unbounded_send(());
let _ = canceller_tx.unbounded_send(());
canceller_tx.close_channel();
});
//Closure::wrap(Box::new(move |sender| sender.close_channel()) as Box<FnMut(Sender<Commit>)>);

@ -109,7 +109,7 @@ impl Verifier {
spawn_and_log_error(sending_loop(Arc::new(file), tx.clone()));
let fnonce = Box::new(move || {
log_debug!("FileGet cancelled");
//log_debug!("FileGet cancelled");
tx.close_channel();
});
Ok((rx, fnonce))

Loading…
Cancel
Save