diff --git a/webpage/src/lib/FileUpload.svelte b/webpage/src/lib/FileUpload.svelte index dd479b1..25e2b0a 100644 --- a/webpage/src/lib/FileUpload.svelte +++ b/webpage/src/lib/FileUpload.svelte @@ -1,44 +1,53 @@
- - + +
diff --git a/webpage/src/lib/MessageSimple.svelte b/webpage/src/lib/MessageSimple.svelte index 8da5f0d..16602db 100644 --- a/webpage/src/lib/MessageSimple.svelte +++ b/webpage/src/lib/MessageSimple.svelte @@ -14,10 +14,10 @@ let timeout: number | undefined = undefined; - export function clear() { - if (timeout) clearTimeout(timeout); - message = undefined; - } + export function clear() { + if (timeout) clearTimeout(timeout); + message = undefined; + } export function display( msg: string, diff --git a/webpage/src/lib/Tabs.svelte b/webpage/src/lib/Tabs.svelte index 825065a..f77d406 100644 --- a/webpage/src/lib/Tabs.svelte +++ b/webpage/src/lib/Tabs.svelte @@ -1,73 +1,71 @@
-
- -
- +
+ +
+
diff --git a/webpage/src/routes/+error.svelte b/webpage/src/routes/+error.svelte index b08aa0e..b618279 100644 --- a/webpage/src/routes/+error.svelte +++ b/webpage/src/routes/+error.svelte @@ -1,17 +1,17 @@ {#if $page.error} - {#if $page.status == 404} - - {:else} -

- {$page.status} -

-

- {$page.error.message} -

- {/if} + {#if $page.status == 404} + + {:else} +

+ {$page.status} +

+

+ {$page.error.message} +

+ {/if} {/if} diff --git a/webpage/src/routes/+layout.svelte b/webpage/src/routes/+layout.svelte index 9d2737a..ef2f77a 100644 --- a/webpage/src/routes/+layout.svelte +++ b/webpage/src/routes/+layout.svelte @@ -1,7 +1,7 @@ diff --git a/webpage/src/routes/Page404.svelte b/webpage/src/routes/Page404.svelte index e45f516..f6bd7a7 100644 --- a/webpage/src/routes/Page404.svelte +++ b/webpage/src/routes/Page404.svelte @@ -1,54 +1,46 @@
-
-

- 404 -

- {#if message} -

- {message} -

- {#if goBackLink} - - {/if} - {:else} -

- Page Not found -

-
- The page you were looking for does not exist -
- {/if} -
+
+

404

+ {#if message} +

+ {message} +

+ {#if goBackLink} + + {/if} + {:else} +

Page Not found

+
The page you were looking for does not exist
+ {/if} +
diff --git a/webpage/src/routes/UserStore.svelte.ts b/webpage/src/routes/UserStore.svelte.ts index e882482..5f082f2 100644 --- a/webpage/src/routes/UserStore.svelte.ts +++ b/webpage/src/routes/UserStore.svelte.ts @@ -1,55 +1,55 @@ -import { goto } from "$app/navigation"; +import { goto } from '$app/navigation'; type User = { - token: string, - id: string, - user_type: number, - username: string, - email: string, + token: string; + id: string; + user_type: number; + username: string; + email: string; }; export function createUserStore() { - let user = $state(undefined); + let user = $state(undefined); - function getValue() { - if (user == undefined) { - let storage = localStorage.getItem('user'); - if (storage) { - try { - user = JSON.parse(storage); - } catch { - user = undefined; - } - } - } - return user; - } + function getValue() { + if (user == undefined) { + let storage = localStorage.getItem('user'); + if (storage) { + try { + user = JSON.parse(storage); + } catch { + user = undefined; + } + } + } + return user; + } - return { - get user() { - return getValue(); - }, - set user(value: User | undefined) { - if (value) { - localStorage.setItem('user', JSON.stringify(value)); - } else { - localStorage.removeItem('user'); - } - user = value; - }, - checkUser(pathOnFail: string, level?: number) { - if (user && user.level > (level ?? 2) ) { - goto(pathOnFail); - return true; - } + return { + get user() { + return getValue(); + }, + set user(value: User | undefined) { + if (value) { + localStorage.setItem('user', JSON.stringify(value)); + } else { + localStorage.removeItem('user'); + } + user = value; + }, + checkUser(pathOnFail: string, level?: number) { + if (user && user.level > (level ?? 2)) { + goto(pathOnFail); + return true; + } - return false; - }, - isLogin() { - if (getValue()) return true; - return false; - } - } + return false; + }, + isLogin() { + if (getValue()) return true; + return false; + } + }; } export const userStore = createUserStore(); diff --git a/webpage/src/routes/login/+page.svelte b/webpage/src/routes/login/+page.svelte index 242e0ea..fff357b 100644 --- a/webpage/src/routes/login/+page.svelte +++ b/webpage/src/routes/login/+page.svelte @@ -1,83 +1,77 @@ - Login + Login diff --git a/webpage/src/routes/logout/+page.svelte b/webpage/src/routes/logout/+page.svelte index 35bb995..314688b 100644 --- a/webpage/src/routes/logout/+page.svelte +++ b/webpage/src/routes/logout/+page.svelte @@ -1,10 +1,10 @@ diff --git a/webpage/src/routes/models/+page.svelte b/webpage/src/routes/models/+page.svelte index 2d018eb..f802c4d 100644 --- a/webpage/src/routes/models/+page.svelte +++ b/webpage/src/routes/models/+page.svelte @@ -1,105 +1,94 @@ - - Models - + Models
- - {#if list.length > 0} -
-

My Models

-
- - New - -
- - - - - - - - - {#each list as item} - - - - - {/each} - -
- Name - - -
- {item.name} - - - Edit - -
- {:else} -

- You don't have any models -

- - {/if} + + {#if list.length > 0} +
+

My Models

+
+ New +
+ + + + + + + + + {#each list as item} + + + + + {/each} + +
Name + +
+ {item.name} + + Edit +
+ {:else} +

You don't have any models

+ + {/if}
diff --git a/webpage/src/routes/models/add/+page.svelte b/webpage/src/routes/models/add/+page.svelte index 914e87e..488b88a 100644 --- a/webpage/src/routes/models/add/+page.svelte +++ b/webpage/src/routes/models/add/+page.svelte @@ -1,101 +1,91 @@ - Create new Model + Create new Model
-

- Create new Model -

-
-
- - - -
-
- -
- Please provide a base image.
- This image is a sample of the images that you are going to classfiy. -
- - - - Upload image - -
- - Image selected - -
-
-
- - {#await buttonClicked} -
- File Uploading -
- {:then} - - {/await} - + +
+ +
+ Please provide a base image.
+ This image is a sample of the images that you are going to classfiy. +
+ + + Upload image +
+ Image selected +
+
+
+ + {#await buttonClicked} +
File Uploading
+ {:then} + + {/await} +
diff --git a/webpage/src/routes/models/edit/+page.svelte b/webpage/src/routes/models/edit/+page.svelte index c9f0e6f..19cf0a0 100644 --- a/webpage/src/routes/models/edit/+page.svelte +++ b/webpage/src/routes/models/edit/+page.svelte @@ -44,7 +44,7 @@ import 'src/styles/forms.css'; let model: Promise = $state(new Promise(() => {})); - let _model: Model | undefined = $state(undefined); + let _model: Model | undefined = $state(undefined); let definitions: Promise = $state(new Promise(() => {})); let id: string | undefined = $state(); @@ -64,7 +64,7 @@ } model = Promise.resolve(temp_model); - _model = temp_model; + _model = temp_model; } catch (e) { if (e instanceof Response) { model = Promise.reject(await e.json()); @@ -160,10 +160,10 @@ {/if} - {#if _model} - - - {/if} + {#if _model} + + + {/if}
{#await model} Loading diff --git a/webpage/src/routes/models/edit/BaseModelInfo.svelte b/webpage/src/routes/models/edit/BaseModelInfo.svelte index 6961cb2..583cee3 100644 --- a/webpage/src/routes/models/edit/BaseModelInfo.svelte +++ b/webpage/src/routes/models/edit/BaseModelInfo.svelte @@ -23,21 +23,21 @@
diff --git a/webpage/src/routes/models/edit/DeleteModel.svelte b/webpage/src/routes/models/edit/DeleteModel.svelte index 261d98c..333e3cf 100644 --- a/webpage/src/routes/models/edit/DeleteModel.svelte +++ b/webpage/src/routes/models/edit/DeleteModel.svelte @@ -1,41 +1,39 @@
-
- - -
- - +
+ + +
+ + diff --git a/webpage/src/routes/models/edit/DeleteZip.svelte b/webpage/src/routes/models/edit/DeleteZip.svelte index 957c509..119d62f 100644 --- a/webpage/src/routes/models/edit/DeleteZip.svelte +++ b/webpage/src/routes/models/edit/DeleteZip.svelte @@ -1,45 +1,42 @@ -
- {#if expand} - Failed to proccess the zip file.
- Delete file and upload a correct version do add more classes.
-
- {:else} - Failed to proccess the zip file.
- Delete file and proccess again.
-
- {/if} -
- - + {#if expand} + Failed to proccess the zip file.
+ Delete file and upload a correct version do add more classes.
+
+ {:else} + Failed to proccess the zip file.
+ Delete file and proccess again.
+
+ {/if} +
+ + diff --git a/webpage/src/routes/models/edit/ModelDataPage.svelte b/webpage/src/routes/models/edit/ModelDataPage.svelte index 93c23d0..6490be9 100644 --- a/webpage/src/routes/models/edit/ModelDataPage.svelte +++ b/webpage/src/routes/models/edit/ModelDataPage.svelte @@ -1,48 +1,46 @@
- - {#if stats} - - {/if} + {#if stats} + + {/if} + {#if [-6, -2].includes(model.status)} + dispatch('reload')} expand /> + {/if} - {#if [-6, -2].includes(model.status)} - dispatch('reload')} expand /> - {/if} - - { - getData(); - dispatch('reload'); - }} /> + { + getData(); + dispatch('reload'); + }} + />
- diff --git a/webpage/src/routes/models/edit/ModelDataPageStatsGraph.svelte b/webpage/src/routes/models/edit/ModelDataPageStatsGraph.svelte index 05bd56a..63e1e26 100644 --- a/webpage/src/routes/models/edit/ModelDataPageStatsGraph.svelte +++ b/webpage/src/routes/models/edit/ModelDataPageStatsGraph.svelte @@ -32,7 +32,7 @@ $effect(() => { if (data && ctx) { if (chart) { - console.log("update") + console.log('update'); chart.data = { labels: data.map((a) => a.name), datasets: [ @@ -48,7 +48,7 @@ }; chart.update('resize'); } else { - console.log("create") + console.log('create'); chart = new Chart(ctx, { type: 'bar', data: { diff --git a/webpage/src/routes/models/edit/TrainModel.svelte b/webpage/src/routes/models/edit/TrainModel.svelte index cfdbc2f..793bda4 100644 --- a/webpage/src/routes/models/edit/TrainModel.svelte +++ b/webpage/src/routes/models/edit/TrainModel.svelte @@ -113,9 +113,7 @@ {:else}
{#if has_data} -

- This model has new classes and can be expanded -

+

This model has new classes and can be expanded

{#if number_of_invalid_images > 0}

There are images {number_of_invalid_images} that were loaded that do not have the correct format.DeleteZip diff --git a/webpage/src/routes/models/edit/types.ts b/webpage/src/routes/models/edit/types.ts index 92bee0e..9dd192d 100644 --- a/webpage/src/routes/models/edit/types.ts +++ b/webpage/src/routes/models/edit/types.ts @@ -1,5 +1,5 @@ export type ModelStats = Array<{ - name: string, - training: number, - testing: number, -}> + name: string; + training: number; + testing: number; +}>;