Skip to content

Commit 859a904

Browse files
committed
fix: rendering of image transformations component
1 parent 2b5d6ea commit 859a904

File tree

3 files changed

+56
-45
lines changed

3 files changed

+56
-45
lines changed

src/lib/sdk/usage.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,13 @@ export type UsageProject = {
323323
*/
324324
authPhoneCountriesBreakdown: Models.MetricBreakdown[];
325325

326+
/**
327+
* Array of image transformations per period.
328+
*/
329+
imageTransformations: Metric[];
330+
326331
/**
327332
* Aggregated statistics of total number of image transformations.
328333
*/
329-
imageTransformations: number;
334+
imageTransformationsTotal: number;
330335
};

src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte

+26-27
Original file line numberDiff line numberDiff line change
@@ -272,34 +272,33 @@
272272
{#if data.organizationUsage.imageTransformationsTotal}
273273
{@const current = data.organizationUsage.imageTransformationsTotal}
274274
{@const max = getServiceLimit('imageTransformations', tier, plan)}
275-
<div style:margin-top="-1.5em" style:margin-bottom="-1em">
276-
<ProgressBarBig
277-
currentUnit="Transformations"
278-
currentValue={formatNum(current)}
279-
maxUnit="transformations"
280-
maxValue={`out of ${formatNum(max)}`}
281-
progressValue={current}
282-
progressMax={max}
283-
showBar={false} />
284-
<BarChart
285-
options={{
286-
yAxis: {
287-
axisLabel: {
288-
formatter: formatNum
289-
}
290-
}
291-
}}
292-
series={[
293-
{
294-
name: 'Image Transformations',
295-
data: [
296-
...(data.organizationUsage.imageTransformations ?? []).map(
297-
(e) => [e.date, e.value]
298-
)
299-
]
275+
<ProgressBarBig
276+
currentUnit="Transformations"
277+
currentValue={formatNum(current)}
278+
maxUnit="transformations"
279+
maxValue={`out of ${formatNum(max)}`}
280+
progressValue={current}
281+
progressMax={max}
282+
showBar={false} />
283+
<BarChart
284+
options={{
285+
yAxis: {
286+
axisLabel: {
287+
formatter: formatNum
300288
}
301-
]} />
302-
</div>
289+
}
290+
}}
291+
series={[
292+
{
293+
name: 'Image Transformations',
294+
data: [
295+
...(data.organizationUsage.imageTransformations ?? []).map((e) => [
296+
e.date,
297+
e.value
298+
])
299+
]
300+
}
301+
]} />
303302
{#if projects?.length > 0}
304303
<ProjectBreakdown {projects} metric="imageTransformations" {data} />
305304
{/if}

src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte

+24-17
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
data.usage.filesStorageTotal +
3737
data.usage.deploymentsStorageTotal +
3838
data.usage.buildsStorageTotal;
39-
39+
$: imageTransformations = data.usage.imageTransformations;
40+
$: imageTransformationsTotal = data.usage.imageTransformationsTotal;
4041
$: dbReads = data.usage.databasesReads;
4142
$: dbWrites = data.usage.databasesWrites;
42-
$: imageTransformations = data.usage.imageTransformations;
4343
4444
$: legendData = [
4545
{ name: 'Reads', value: data.usage.databasesReadsTotal },
@@ -254,22 +254,29 @@
254254

255255
<svelte:fragment slot="aside">
256256
{#if imageTransformations}
257-
<div style:margin-top="-1.5em" style:margin-bottom="-1em">
258-
<BarChart
259-
options={{
260-
yAxis: {
261-
axisLabel: {
262-
formatter: formatNum
263-
}
264-
}
265-
}}
266-
series={[
267-
{
268-
name: 'Image transformations',
269-
data: [...imageTransformations.map((e) => [e.date, e.value])]
270-
}
271-
]} />
257+
{@const current = formatNum(imageTransformationsTotal)}
258+
<div class="u-flex u-flex-vertical">
259+
<div class="u-flex u-main-space-between">
260+
<p>
261+
<span class="heading-level-4">{current}</span>
262+
<span class="body-text-1 u-bold">Transformations</span>
263+
</p>
264+
</div>
272265
</div>
266+
<BarChart
267+
options={{
268+
yAxis: {
269+
axisLabel: {
270+
formatter: formatNum
271+
}
272+
}
273+
}}
274+
series={[
275+
{
276+
name: 'Image transformations',
277+
data: [...imageTransformations.map((e) => [e.date, e.value])]
278+
}
279+
]} />
273280
{:else}
274281
<Card isDashed>
275282
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">

0 commit comments

Comments
 (0)