|
3 | 3 | import { fragment, graphql } from '$houdini';
|
4 | 4 | import AppInstanceListItem from '$lib/components/list/AppInstanceListItem.svelte';
|
5 | 5 | import List from '$lib/components/list/List.svelte';
|
6 |
| - import { BodyShort } from '@nais/ds-svelte-community'; |
| 6 | + import { BodyShort, Heading } from '@nais/ds-svelte-community'; |
| 7 | + import prettyBytes from 'pretty-bytes'; |
7 | 8 |
|
8 | 9 | interface Props {
|
9 | 10 | app: AppInstances;
|
|
40 | 41 | }
|
41 | 42 | }
|
42 | 43 | }
|
| 44 | + requests { |
| 45 | + cpu |
| 46 | + memory |
| 47 | + } |
| 48 | + limits { |
| 49 | + cpu |
| 50 | + memory |
| 51 | + } |
43 | 52 | }
|
44 | 53 | instances {
|
45 | 54 | edges {
|
|
79 | 88 | const instances = $derived($data.instances.edges.map((edge) => edge.node));
|
80 | 89 | </script>
|
81 | 90 |
|
| 91 | +<div> |
| 92 | + <Heading level="4" size="small">Resources:</Heading> |
| 93 | + <ul class="resource-list"> |
| 94 | + <li> |
| 95 | + Requests: |
| 96 | + <ul> |
| 97 | + <li> |
| 98 | + <div class="resource-list-item"> |
| 99 | + <div>CPU:</div> |
| 100 | + <div class="data"> |
| 101 | + {#if $data.resources.requests.cpu} |
| 102 | + {$data.resources.requests.cpu?.toFixed(2)} cores |
| 103 | + {:else} |
| 104 | + Not set |
| 105 | + {/if} |
| 106 | + </div> |
| 107 | + </div> |
| 108 | + </li> |
| 109 | + |
| 110 | + <li> |
| 111 | + <div class="resource-list-item"> |
| 112 | + <div>Memory:</div> |
| 113 | + <div class="data"> |
| 114 | + {#if $data.resources.requests.memory} |
| 115 | + {prettyBytes($data.resources.requests.memory, { |
| 116 | + locale: 'en', |
| 117 | + minimumFractionDigits: 2, |
| 118 | + maximumFractionDigits: 2, |
| 119 | + binary: true |
| 120 | + })} |
| 121 | + {:else} |
| 122 | + Not set |
| 123 | + {/if} |
| 124 | + </div> |
| 125 | + </div> |
| 126 | + </li> |
| 127 | + </ul> |
| 128 | + </li> |
| 129 | + <li> |
| 130 | + Limits: |
| 131 | + <ul> |
| 132 | + <li> |
| 133 | + <div class="resource-list-item"> |
| 134 | + <div>CPU:</div> |
| 135 | + <div class="data"> |
| 136 | + {#if $data.resources.limits.cpu}{$data.resources.limits.cpu?.toFixed(2)} cores |
| 137 | + {:else} |
| 138 | + Not set |
| 139 | + {/if} |
| 140 | + </div> |
| 141 | + </div> |
| 142 | + </li> |
| 143 | + |
| 144 | + <li> |
| 145 | + <div class="resource-list-item"> |
| 146 | + <div>Memory:</div> |
| 147 | + <div class="data"> |
| 148 | + {#if $data.resources.limits.memory} |
| 149 | + {prettyBytes($data.resources.limits.memory, { |
| 150 | + locale: 'en', |
| 151 | + minimumFractionDigits: 2, |
| 152 | + maximumFractionDigits: 2, |
| 153 | + binary: true |
| 154 | + })} |
| 155 | + {:else} |
| 156 | + Not set |
| 157 | + {/if} |
| 158 | + </div> |
| 159 | + </div> |
| 160 | + </li> |
| 161 | + </ul> |
| 162 | + </li> |
| 163 | + </ul> |
| 164 | +</div> |
| 165 | + |
82 | 166 | {#if $data.resources.scaling}
|
83 | 167 | {@const scaling = $data.resources.scaling}
|
84 | 168 | {#if scaling.minInstances !== scaling.maxInstances}
|
85 | 169 | <div>
|
86 |
| - <strong>Scaling configuration:</strong> |
| 170 | + <Heading level="4" size="small">Scaling configuration</Heading> |
87 | 171 | {scaling.minInstances} - {scaling.maxInstances} instances based on
|
88 | 172 | {#if scaling.strategies && scaling.strategies.length > 0}
|
89 | 173 | {#each scaling.strategies as strategy, i (strategy)}
|
|
115 | 199 | {/each}
|
116 | 200 | </List>
|
117 | 201 | {/if}
|
| 202 | + |
| 203 | +<style> |
| 204 | + ul { |
| 205 | + list-style-type: none; |
| 206 | + padding: 0; |
| 207 | + margin: 0 0 0 1rem; |
| 208 | + } |
| 209 | +
|
| 210 | + li ul { |
| 211 | + margin-left: 1rem; |
| 212 | + } |
| 213 | +
|
| 214 | + .resource-list { |
| 215 | + display: grid; |
| 216 | + grid-template-columns: 1fr 1fr; |
| 217 | + gap: 1rem; |
| 218 | + } |
| 219 | + .resource-list-item { |
| 220 | + display: grid; |
| 221 | + grid-template-columns: 80px 100px; |
| 222 | + } |
| 223 | + .data { |
| 224 | + text-align: right; |
| 225 | + } |
| 226 | +</style> |
0 commit comments