New Badges components: destination, public, status, teams + container/status

This commit is contained in:
Gabriel Engel
2022-11-23 07:52:59 -03:00
parent c2d72ad309
commit 9d45ab3246
6 changed files with 152 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
<script lang="ts">
import {getStatus} from '$lib/container/status'
import { onDestroy, onMount } from 'svelte';
export let thing:any;
let getting = getStatus(thing)
let refreshing:any;
let status:any;
// AutoUpdates Status every 5 seconds
onMount( ()=>{
refreshing = setInterval( () =>{
getStatus(thing).then( (r) => status = r )
}, 5000)
})
onDestroy( () =>{
clearInterval(refreshing);
})
</script>
{#await getting}
<span class="badge badge-lg rounded uppercase">...</span>
{:then status}
<span class="badge badge-lg rounded uppercase badge-status-{status}">
{status}
</span>
{/await}