mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge pull request #1242 from ItzNotABug/fix-view-outside-card-in-usage
Use Simpler View for Usage Cards
This commit is contained in:
2 files changed
+43
-33
No files matched your search
+32
-20
@@ -3,12 +3,12 @@
|
||||
import { Collapsible, CollapsibleItem } from '$lib/components';
|
||||
import {
|
||||
TableBody,
|
||||
TableCellLink,
|
||||
TableCell,
|
||||
TableCellHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
TableScroll,
|
||||
TableCellText
|
||||
TableRowLink,
|
||||
TableScroll
|
||||
} from '$lib/elements/table';
|
||||
import { abbreviateNumber } from '$lib/helpers/numbers';
|
||||
import { humanFileSize } from '$lib/helpers/sizeConvertion';
|
||||
@@ -53,31 +53,43 @@
|
||||
<Collapsible>
|
||||
<CollapsibleItem>
|
||||
<svelte:fragment slot="title">Project breakdown</svelte:fragment>
|
||||
<TableScroll noMargin>
|
||||
<TableScroll noMargin style="table-layout: auto">
|
||||
<TableHeader>
|
||||
<TableCellHead width={185} style="padding-left: 0;">Project</TableCellHead>
|
||||
<TableCellHead width={100}>Usage</TableCellHead>
|
||||
<TableCellHead>Project</TableCellHead>
|
||||
<TableCellHead>Usage</TableCellHead>
|
||||
{#if $canSeeProjects}
|
||||
<TableCellHead width={140} />
|
||||
<TableCellHead />
|
||||
{/if}
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{#each groupByProject(metric).sort((a, b) => b.usage - a.usage) as project}
|
||||
<TableRow>
|
||||
<TableCellText title="Project" style="padding-left: 0;">
|
||||
{data.projectNames[project.projectId]?.name ?? 'Unknown'}
|
||||
</TableCellText>
|
||||
<TableCellText title="Usage">{format(project.usage)}</TableCellText>
|
||||
{#if $canSeeProjects}
|
||||
<TableCellLink
|
||||
title="Go to project usage"
|
||||
href={getProjectUsageLink(project.projectId)}>
|
||||
View project usage
|
||||
</TableCellLink>
|
||||
{/if}
|
||||
</TableRow>
|
||||
{#if !$canSeeProjects}
|
||||
<TableRow>
|
||||
<TableCell title="Project">
|
||||
{data.projectNames[project.projectId]?.name ?? 'Unknown'}
|
||||
</TableCell>
|
||||
<TableCell title="Usage">{format(project.usage)}</TableCell>
|
||||
</TableRow>
|
||||
{:else}
|
||||
<TableRowLink href={getProjectUsageLink(project.projectId)}>
|
||||
<TableCell title="Project">
|
||||
{data.projectNames[project.projectId]?.name ?? 'Unknown'}
|
||||
</TableCell>
|
||||
<TableCell title="Usage">{format(project.usage)}</TableCell>
|
||||
<TableCell right={true}>
|
||||
<span
|
||||
class="icon-cheveron-right u-cross-child-center ignore-icon-rotate" />
|
||||
</TableCell>
|
||||
</TableRowLink>
|
||||
{/if}
|
||||
{/each}
|
||||
</TableBody>
|
||||
</TableScroll>
|
||||
</CollapsibleItem>
|
||||
</Collapsible>
|
||||
|
||||
<style>
|
||||
.ignore-icon-rotate {
|
||||
rotate: unset !important;
|
||||
}
|
||||
</style>
|
||||
@@ -4,11 +4,10 @@
|
||||
import {
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableCellLink,
|
||||
TableCellHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
Table
|
||||
Table,
|
||||
TableRowLink
|
||||
} from '$lib/elements/table';
|
||||
import { showUsageRatesModal, tierToPlan, upgradeURL } from '$lib/stores/billing';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
@@ -225,27 +224,26 @@
|
||||
}
|
||||
]} />
|
||||
{#if data.usage.executionsBreakdown.length > 0}
|
||||
<Table noMargin noStyles>
|
||||
<Table noMargin noStyles style="table-layout: auto">
|
||||
<TableHeader>
|
||||
<TableCellHead width={285}>Function</TableCellHead>
|
||||
<TableCellHead>Function</TableCellHead>
|
||||
<TableCellHead>Usage</TableCellHead>
|
||||
<TableCellHead width={140} />
|
||||
<TableCellHead />
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{#each data.usage.executionsBreakdown as func}
|
||||
<TableRow>
|
||||
<TableRowLink
|
||||
href={`${baseRoute}/functions/function-${func.resourceId}`}>
|
||||
<TableCell title="Function">
|
||||
{func.name ?? func.resourceId}
|
||||
</TableCell>
|
||||
<TableCell title="Usage">
|
||||
{formatNum(func.value)} executions
|
||||
</TableCell>
|
||||
<TableCellLink
|
||||
href={`${baseRoute}/functions/function-${func.resourceId}`}
|
||||
title="View function">
|
||||
View function
|
||||
</TableCellLink>
|
||||
</TableRow>
|
||||
<TableCell right={true}>
|
||||
<span class="icon-cheveron-right u-cross-child-center" />
|
||||
</TableCell>
|
||||
</TableRowLink>
|
||||
{/each}
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
Reference in new issue
Block a user