aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2021-12-31 11:24:25 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2021-12-31 11:24:25 +0100
commit3e902bb56e9626c8296e9836aa9ae19d82d48394 (patch)
tree3b6b11fdf68c8d41f2b2bceebe1c2469ebc00cb6 /web/pw-server
parent0f27ca80fbdb3366e047def628123d3cc8ca051c (diff)
downloadplanetwars.dev-3e902bb56e9626c8296e9836aa9ae19d82d48394.tar.xz
planetwars.dev-3e902bb56e9626c8296e9836aa9ae19d82d48394.zip
list uploaded code bundles on bot page
Diffstat (limited to 'web/pw-server')
-rw-r--r--web/pw-server/package.json11
-rw-r--r--web/pw-server/src/routes/bots/[bot_id].svelte25
2 files changed, 25 insertions, 11 deletions
diff --git a/web/pw-server/package.json b/web/pw-server/package.json
index 29d59f6..b8a9216 100644
--- a/web/pw-server/package.json
+++ b/web/pw-server/package.json
@@ -12,13 +12,12 @@
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
},
"devDependencies": {
+ "@originjs/vite-plugin-commonjs": "^1.0.1",
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "next",
+ "@sveltejs/vite-plugin-svelte": "^1.0.0-next.30",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
- "@originjs/vite-plugin-commonjs": "^1.0.1",
- "@sveltejs/vite-plugin-svelte": "^1.0.0-next.30",
- "vite-plugin-wasm-pack": "^0.1.9",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-svelte3": "^3.2.1",
@@ -28,10 +27,12 @@
"svelte-check": "^2.2.6",
"svelte-preprocess": "^4.9.4",
"tslib": "^2.3.1",
- "typescript": "^4.4.3"
+ "typescript": "^4.4.3",
+ "vite-plugin-wasm-pack": "^0.1.9"
},
"dependencies": {
+ "dayjs": "^1.10.7",
"moment": "^2.29.1"
},
"type": "module"
-} \ No newline at end of file
+}
diff --git a/web/pw-server/src/routes/bots/[bot_id].svelte b/web/pw-server/src/routes/bots/[bot_id].svelte
index 1d7994d..2556d73 100644
--- a/web/pw-server/src/routes/bots/[bot_id].svelte
+++ b/web/pw-server/src/routes/bots/[bot_id].svelte
@@ -1,19 +1,22 @@
<script lang="ts" context="module">
import { get_session_token } from "$lib/auth";
+import { mount_component } from "svelte/internal";
export async function load({ page }) {
const token = get_session_token();
const res = await fetch(`/api/bots/${page.params["bot_id"]}`, {
headers: {
"Content-Type": "application/json",
- "Authorization": `Bearer ${token}`,
+ Authorization: `Bearer ${token}`,
},
});
if (res.ok) {
+ const data = await res.json();
return {
props: {
- bot: await res.json(),
+ bot: data["bot"],
+ bundles: data["bundles"],
},
};
}
@@ -26,7 +29,10 @@
</script>
<script lang="ts">
+ import dayjs from "dayjs";
+
export let bot: object;
+ export let bundles: object[];
let files;
@@ -41,7 +47,7 @@
method: "POST",
headers: {
// the content type header will be set by the browser
- "Authorization": `Bearer ${token}`,
+ Authorization: `Bearer ${token}`,
},
body: formData,
});
@@ -54,9 +60,16 @@
{bot["name"]}
</div>
-
<div>Upload code</div>
<form on:submit|preventDefault={submitCode}>
- <input type="file" bind:files/>
+ <input type="file" bind:files />
<button type="submit">Submit</button>
-</form> \ No newline at end of file
+</form>
+
+<ul>
+ {#each bundles as bundle}
+ <li>
+ bundle created at {dayjs(bundle["created_at"]).format("YYYY-MM-DD HH:mm")}
+ </li>
+ {/each}
+</ul>