mirror of
https://github.com/KevinMidboe/infra-map.git
synced 2025-10-29 17:40:28 +00:00
misc linting, error handling and code-splitting
This commit is contained in:
@@ -52,11 +52,11 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div id="dialog-description">
|
|
||||||
{#if description}
|
{#if description}
|
||||||
|
<div id="dialog-description">
|
||||||
{@html description}
|
{@html description}
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<div class="alerts">
|
<div class="alerts">
|
||||||
@@ -83,6 +83,8 @@
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
--offset-top: 4rem;
|
||||||
|
padding-top: var(--offset-top);
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
@@ -96,11 +98,16 @@
|
|||||||
visibility 0.4s ease;
|
visibility 0.4s ease;
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
align-items: center;
|
|
||||||
|
@media screen and (max-width: 480px) {
|
||||||
|
padding: 1rem;
|
||||||
|
width: calc(100vw - 2rem);
|
||||||
|
height: calc(100vh - 2rem);
|
||||||
|
}
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
max-width: 880px;
|
max-width: 880px;
|
||||||
max-width: unset;
|
// max-width: unset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +130,6 @@
|
|||||||
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
||||||
0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
max-height: 90vh;
|
|
||||||
padding: var(--padding);
|
padding: var(--padding);
|
||||||
width: calc(880px - calc(--padding * 2));
|
width: calc(880px - calc(--padding * 2));
|
||||||
z-index: 2008;
|
z-index: 2008;
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
<Input label="" bind:value={filterString} placeholder="attribute" />
|
<Input label="" bind:value={filterString} placeholder="attribute" />
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
{#each filteredchildren as element, index (element?.name)}
|
{#each filteredchildren as element, index (element)}
|
||||||
<li class={index === focusIndex ? 'focus' : ''}>
|
<li class={index === focusIndex ? 'focus' : ''}>
|
||||||
<h3>{element?.name}</h3>
|
<h3>{element?.name}</h3>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let label: string;
|
export let label: string;
|
||||||
export let value: string;
|
|
||||||
export let placeholder: string;
|
export let placeholder: string;
|
||||||
|
export let value: string = '';
|
||||||
export let required = false;
|
export let required = false;
|
||||||
export let icon: unknown;
|
export let icon: unknown = null;
|
||||||
|
|
||||||
let focus = false;
|
let focus = false;
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
imageSource = reader?.result || '';
|
imageSource = reader?.result || '';
|
||||||
if (imageSource === '') {
|
if (imageSource === '') {
|
||||||
console.log("no image data, returning")
|
console.log('no image data, returning');
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set imageSource to image element
|
// set imageSource to image element
|
||||||
@@ -82,12 +82,14 @@
|
|||||||
{#if !fullscreen}
|
{#if !fullscreen}
|
||||||
<img on:click={() => (fullscreen = !fullscreen)} src={String(imageSource)} id="live-image" />
|
<img on:click={() => (fullscreen = !fullscreen)} src={String(imageSource)} id="live-image" />
|
||||||
{:else}
|
{:else}
|
||||||
|
<div class="fullscreen-container">
|
||||||
<Dialog title="Live stream of printer" on:close={() => (fullscreen = false)}>
|
<Dialog title="Live stream of printer" on:close={() => (fullscreen = false)}>
|
||||||
<img style="width: 100%;" src={String(imageSource)} id="live-image" />
|
<img style="width: 100%;" src={String(imageSource)} id="live-image" />
|
||||||
<span>Last update {timestamp}s ago</span>
|
<span>Last update {timestamp}s ago</span>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
<img src={String(grey400x225)} />
|
<img src={String(grey400x225)} />
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<span>Last update {timestamp}s ago</span>
|
<span>Last update {timestamp}s ago</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -101,4 +103,8 @@
|
|||||||
span {
|
span {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(.fullscreen-container .dialog > div) {
|
||||||
|
max-width: unset;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -10,7 +10,9 @@
|
|||||||
<h2>{title}</h2>
|
<h2>{title}</h2>
|
||||||
<slot name="top-left" />
|
<slot name="top-left" />
|
||||||
</div>
|
</div>
|
||||||
|
{#if description && description?.length > 0}
|
||||||
<label>{description}</label>
|
<label>{description}</label>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Dialog from './Dialog.svelte';
|
|
||||||
import { goto } from '$app/navigation';
|
|
||||||
import Certificate from '$lib/icons/certificate.svelte';
|
|
||||||
import { daysUntil } from '$lib/utils/conversion';
|
|
||||||
import JsonViewer from './JsonViewer.svelte';
|
|
||||||
|
|
||||||
export let title = '';
|
export let title = '';
|
||||||
export let description = '';
|
export let description = '';
|
||||||
export let columns: Array<string> | object;
|
export let columns: Array<string> | object;
|
||||||
@@ -12,7 +6,6 @@
|
|||||||
export let links: Array<string> = [];
|
export let links: Array<string> = [];
|
||||||
export let footer = '';
|
export let footer = '';
|
||||||
|
|
||||||
const hasLinks = links?.length > 0;
|
|
||||||
let displayColumns: string[] = [];
|
let displayColumns: string[] = [];
|
||||||
if (typeof columns === 'object' && !Array.isArray(columns)) {
|
if (typeof columns === 'object' && !Array.isArray(columns)) {
|
||||||
displayColumns = Object.values(columns);
|
displayColumns = Object.values(columns);
|
||||||
@@ -21,13 +14,17 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
|
{#if title?.length || description?.length}
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h2>{title}</h2>
|
<h2>{title}</h2>
|
||||||
<div class="description">{description}</div>
|
<div class="description">{description}</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<slot name="actions"></slot>
|
<slot name="actions"></slot>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -115,4 +115,6 @@ export interface Node {
|
|||||||
type: string;
|
type: string;
|
||||||
ip: string;
|
ip: string;
|
||||||
level: string;
|
level: string;
|
||||||
|
vms: Array<VM>;
|
||||||
|
lxcs: Array<LXC>;
|
||||||
}
|
}
|
||||||
|
|||||||
167
src/lib/styles/card.scss
Normal file
167
src/lib/styles/card.scss
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
@keyframes pulse-live {
|
||||||
|
0% {
|
||||||
|
box-shadow: 0 0 0 0 var(--pulse);
|
||||||
|
}
|
||||||
|
70% {
|
||||||
|
box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(0, 212, 57, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin pulse-dot {
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
top: 50%;
|
||||||
|
margin-left: 0.4rem;
|
||||||
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: var(--color);
|
||||||
|
border-radius: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
animation: pulse-live 2s infinite;
|
||||||
|
height: 16px;
|
||||||
|
width: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: #fbf6f4;
|
||||||
|
box-shadow: var(
|
||||||
|
--str-shadow-s,
|
||||||
|
0px 0px 2px #22242714,
|
||||||
|
0px 1px 4px #2224271f,
|
||||||
|
0px 4px 8px #22242729
|
||||||
|
);
|
||||||
|
pointer-events: all;
|
||||||
|
cursor: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
padding: 0.75rem;
|
||||||
|
background-color: white;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
height: 24px;
|
||||||
|
width: 24px;
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtle {
|
||||||
|
margin-left: 0.25rem;
|
||||||
|
color: rgba(0, 0, 0, 0.4);
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status {
|
||||||
|
height: 1rem;
|
||||||
|
width: 1rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-left: auto;
|
||||||
|
position: relative;
|
||||||
|
@include pulse-dot;
|
||||||
|
|
||||||
|
&.ok {
|
||||||
|
--color: var(--positive);
|
||||||
|
--pulse: var(--pulse-positive);
|
||||||
|
}
|
||||||
|
&.warning {
|
||||||
|
--color: var(--warning);
|
||||||
|
--pulse: var(--pulse-warning);
|
||||||
|
}
|
||||||
|
&.error {
|
||||||
|
--color: var(--negative);
|
||||||
|
--pulse: var(--pulse-negative);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
padding: 0.5rem;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resource {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto auto;
|
||||||
|
padding: 0.5rem;
|
||||||
|
background-color: var(--bg);
|
||||||
|
|
||||||
|
row-gap: 6px;
|
||||||
|
max-width: 330px;
|
||||||
|
|
||||||
|
> div,
|
||||||
|
span {
|
||||||
|
display: flex;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.resource .title svg) {
|
||||||
|
height: 1rem;
|
||||||
|
width: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
|
||||||
|
margin-top: auto;
|
||||||
|
background: white;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-bottom-left-radius: 0.25rem;
|
||||||
|
border-bottom-right-radius: 0.25rem;
|
||||||
|
|
||||||
|
button {
|
||||||
|
border: none;
|
||||||
|
position: relative;
|
||||||
|
background: transparent;
|
||||||
|
height: unset;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
display: inline-block;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
span {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 1.5rem;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
margin-left: -0.5rem;
|
||||||
|
border: 1px solid #eaddd5;
|
||||||
|
border-radius: inherit;
|
||||||
|
white-space: nowrap;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
transition: transform 0.1s ease;
|
||||||
|
will-change: box-shadow 0.25s;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.positive {
|
||||||
|
color: #077c35;
|
||||||
|
}
|
||||||
@@ -21,8 +21,6 @@
|
|||||||
let nodes = $derived(rawNodes.filter((n) => n.metadata.name.includes(filterLC)));
|
let nodes = $derived(rawNodes.filter((n) => n.metadata.name.includes(filterLC)));
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
console.log(deployments);
|
|
||||||
|
|
||||||
window.elements = deployments
|
window.elements = deployments
|
||||||
.map((d) => {
|
.map((d) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -37,6 +37,9 @@
|
|||||||
--positive: #00d439;
|
--positive: #00d439;
|
||||||
--negative: #ff5449;
|
--negative: #ff5449;
|
||||||
--warning: #ffa312;
|
--warning: #ffa312;
|
||||||
|
--pulse-positive: rgba(0, 212, 57, 0.7);
|
||||||
|
--pulse-negative: rgba(255, 84, 73, 0.7);
|
||||||
|
--pulse-warning: rgba(255, 163, 18, 0.7);
|
||||||
|
|
||||||
--border: 1px solid #eaddd5;
|
--border: 1px solid #eaddd5;
|
||||||
--border-radius: 0.75rem;
|
--border-radius: 0.75rem;
|
||||||
|
|||||||
Reference in New Issue
Block a user