diff --git a/src/lib/components/SummaryCard.svelte b/src/lib/components/SummaryCard.svelte new file mode 100644 index 00000000..db585e13 --- /dev/null +++ b/src/lib/components/SummaryCard.svelte @@ -0,0 +1,81 @@ + + +
+
+ {@render icon({ color })} +
+
+

+ {title} + {#if helpText} + {helpText} + {/if} +

+

+ {@render children()} +

+
+
+ + diff --git a/src/routes/team/[team]/(teamPages)/postgres/+page.svelte b/src/routes/team/[team]/(teamPages)/postgres/+page.svelte index ff8aa7ce..0a6c71e2 100644 --- a/src/routes/team/[team]/(teamPages)/postgres/+page.svelte +++ b/src/routes/team/[team]/(teamPages)/postgres/+page.svelte @@ -2,7 +2,6 @@ import { page } from '$app/stores'; import { PendingValue, SqlInstanceOrderField } from '$houdini'; import Card from '$lib/Card.svelte'; - import CostIcon from '$lib/icons/CostIcon.svelte'; import { Button, HelpText, @@ -25,7 +24,9 @@ import CircleProgressBar from '$lib/components/CircleProgressBar.svelte'; import Cost from '$lib/components/Cost.svelte'; + import SummaryCard from '$lib/components/SummaryCard.svelte'; import GraphErrors from '$lib/GraphErrors.svelte'; + import CostIcon from '$lib/icons/CostIcon.svelte'; import { changeParams } from '$lib/utils/searchparams'; import prettyBytes from 'pretty-bytes'; import type { PageData } from './$houdini'; @@ -69,57 +70,52 @@
-
-
- -
-
-

- Cost - Total SQL instance cost for the last 30 days. -

-

- {#if cost !== PendingValue} - - {:else} - - {/if} -

-
-
+ + + {#snippet icon({ color })} + + {/snippet} + {#if cost !== PendingValue} + + {:else} + + {/if} +
-
-
+ + {#snippet icon()} {#if utilization.sqlInstances !== PendingValue} {:else} {/if} -
-
-

- CPU utilization - - CPU utilization for the last elapsed hour. - -

+ {/snippet} + + {#if utilization.sqlInstances !== PendingValue}

- {#if utilization.sqlInstances !== PendingValue} - {(utilization.sqlInstances.cpu.utilization * 100).toFixed(1)}% of - {utilization.sqlInstances.cpu.requested.toFixed(0)} core{utilization.sqlInstances.cpu - .requested > 1 - ? 's' - : ''} - {:else} - - {/if} + {(utilization.sqlInstances.cpu.utilization * 100).toFixed(1)}% of + {utilization.sqlInstances.cpu.requested.toFixed(0)} core{utilization.sqlInstances.cpu + .requested > 1 + ? 's' + : ''}

-
-
+ {:else} + + {/if} +
-
+ + + {#snippet icon()} + {#if utilization.sqlInstances !== PendingValue} + + {:else} + + {/if} + {/snippet} + + {#if utilization.sqlInstances !== PendingValue} +

+ {(utilization.sqlInstances.memory.utilization * 100).toFixed(1)}% of + {prettyBytes(utilization.sqlInstances.memory.requested)} +

+ {:else} + + {/if} +
@@ -363,16 +382,6 @@ margin-bottom: 1rem; } - .summaryIcon { - display: flex; - justify-content: center; - align-items: center; - width: 50px; - height: 50px; - border: 1px solid var(--bg-color); - border-radius: 5px; - } - .summary { width: 100%; }