Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
fixed debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
michele-sciabarra committed Oct 18, 2020
1 parent 45e91d2 commit 4bfcce3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
14 changes: 9 additions & 5 deletions admin/web/src/Debug.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script>
import { reload } from "./store";
import { onMount } from "svelte";
import { url } from "./url.js";
import { onMount, onDestroy } from "svelte";
import Link from './Link.svelte'
import DebugData from './DebugData.svelte';
export let api;
export let key = "";
const cacheUrl = api + "/util/cache?";
const scanUrl = cacheUrl + "scan="
Expand Down Expand Up @@ -46,11 +48,10 @@
}
onMount(start);
reload.subscribe(() => {
start();
});
onDestroy(url.subscribe(() => { start() }))
</script>

{#if key == ""}
<h1>Cache</h1>
<div class="form-group">
<div class="input-group">
Expand Down Expand Up @@ -96,3 +97,6 @@
</button>
{/if}
</div>
{:else}
<DebugData {api} {key}/>
{/if}
21 changes: 14 additions & 7 deletions admin/web/src/DebugData.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script>
export let key = "";
import { navigate, Link } from "svelte-routing";
import { onMount } from "svelte";
import { navigate } from './url.js'
export let key = "";
export let api = "";
let state = {};
const url = api + "/util/cache";
let entry = window.atob(key);
const entry = window.atob(key);
async function cache(action, entry) {
let u = url + "?" + action + "=" + encodeURI(entry);
Expand All @@ -17,20 +19,21 @@
onMount(() => cache("get", entry));
function back() {
navigate("/debug");
navigate("debug", "")
}
function clean() {
if(confirm("Are you sure?")) {
cache("del", entry);
back();
back();
}
}
</script>

<h1>Cache Data</h1>

{#if state.get}
<big>Key:</big>
<big>Key:.</big>
<p>{entry}</p>
<big>Value:</big>
<pre>{JSON.stringify(state.get, null, 2)}</pre>
Expand All @@ -45,4 +48,8 @@
<h1>Error</h1>
<p>{state.error}</p>
{/if}
<button type="button" class="btn btn-primary" on:click={back}>Back</button>
<br>
<button type="button" class="btn btn-primary" on:click={back}>
Back to Debugging
</button>

2 changes: 1 addition & 1 deletion admin/web/src/Link.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export let to = "";
export let target = "";
export let key = "";
function open(event) {
event.preventDefault()
window.open(target, "editor", )
Expand Down
1 change: 0 additions & 1 deletion admin/web/src/ShipData.svelte

This file was deleted.

2 changes: 0 additions & 2 deletions admin/web/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ import {writable} from 'svelte/store'

export const formData = writable({})

export const reload = writable()

0 comments on commit 4bfcce3

Please sign in to comment.