-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add list of loaded plugins to
/plugins
page
- Loading branch information
Showing
7 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<script lang="ts"> | ||
/* TODO: Implement this */ | ||
export let error: string; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script lang="ts"> | ||
import type { PluginStatus } from "../shared/api/plugins.type"; | ||
export let data: PluginStatus; | ||
</script> | ||
|
||
{#if data.status} | ||
<pre class="online">[<span style="color: rgb(0, 255, 0);">ONLINE</span | ||
>] {data.name}</pre> | ||
{:else} | ||
<pre class="offline"><span style="color: red;">OFFLINE</span | ||
>] {data.name}</pre> | ||
{/if} | ||
|
||
<style> | ||
pre { | ||
white-space: pre; | ||
font-family: monaco, Consolas, "Lucida Console", monospace; | ||
color: whitesmoke; | ||
font-size: 16px; | ||
margin: 0px; | ||
} | ||
span { | ||
font-family: monaco, Consolas, "Lucida Console", monospace; | ||
} | ||
</style> |
35 changes: 35 additions & 0 deletions
35
src/frontend/src/lib/components/plugins/PluginsContainer.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script lang="ts"> | ||
import { onMount } from "svelte"; | ||
import type { PluginStatus } from "../shared/api/plugins.type"; | ||
import Error from "./Error.svelte"; | ||
import Plugin from "./Plugin.svelte"; | ||
import Separator from "../shared/Separator.svelte"; | ||
let plugins: Array<PluginStatus> = []; | ||
let error: string; | ||
onMount(() => { | ||
fetch("/plugins/status") | ||
.then((response) => response.json()) | ||
.then((responseJson) => { | ||
if (responseJson.ok == true) { | ||
plugins = responseJson.plugins; | ||
} else { | ||
plugins = []; | ||
error = responseJson.error; | ||
} | ||
}); | ||
}); | ||
</script> | ||
|
||
|
||
<Separator /> | ||
{#if plugins.length == 0} | ||
<Error {error} /> | ||
{/if} | ||
{#each plugins as plugin} | ||
<Plugin data={plugin} /> | ||
{/each} | ||
|
||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type PluginStatus = { | ||
name: string; | ||
status: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters