feat: add activity table footer

This commit is contained in:
Arman
2023-12-15 12:06:20 +01:00
parent 8686628ea2
commit 8dcd7da314
2 changed files with 14 additions and 30 deletions
+14 -11
View File
@@ -18,7 +18,9 @@
import { Container, ContainerHeader } from '$lib/layout';
import { hoursToDays, toLocaleDateTime } from '$lib/helpers/date';
import type { Models } from '@appwrite.io/console';
import type { PlanServices } from '$lib/stores/billing';
import { tierToPlan, type PlanServices } from '$lib/stores/billing';
import { isCloud } from '$lib/system';
import { organization } from '$lib/stores/organization';
export let logs: Models.LogList;
export let offset = 0;
@@ -29,15 +31,7 @@
<Container>
{#if service}
<ContainerHeader title="Activity" alertType="info" serviceId={service}>
<svelte:fragment slot="tooltip" let:limit let:tier let:upgradeMethod>
<p class="text">
Logs are retained in rolling {hoursToDays(limit)} intervals with the {tier} plan.
<button class="link" type="button" on:click|preventDefault={upgradeMethod}
>Upgrade</button> to increase your log retention for a longer period.
</p>
</svelte:fragment>
</ContainerHeader>
<ContainerHeader title="Activity" />
{:else}
<Heading tag="h2" size="5">Activity</Heading>
{/if}
@@ -50,7 +44,16 @@
<TableCellHead width={90}>IP</TableCellHead>
<TableCellHead width={140}>Date</TableCellHead>
</TableHeader>
<TableBody>
<TableBody service="logs" total={isCloud ? Infinity : 0}>
<svelte:fragment slot="limit" let:limit let:upgradeMethod>
<p class="text">
Logs are retained in rolling {hoursToDays(limit)} intervals with the
{tierToPlan($organization.billingPlan).name}
plan.
<button class="link" type="button" on:click|preventDefault={upgradeMethod}
>Upgrade</button> to increase your log retention for a longer period.
</p>
</svelte:fragment>
{#each logs.logs as log}
<TableRow>
<TableCell title="Client">
@@ -20,12 +20,6 @@
import DeploymentCreatedBy from '../deploymentCreatedBy.svelte';
import DeploymentDomains from '../deploymentDomains.svelte';
import { tooltip } from '$lib/actions/tooltip';
// import { wizard } from '$lib/stores/wizard';
// import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
// import { getServiceLimit, tierToPlan } from '$lib/stores/billing';
// import { organization } from '$lib/stores/organization';
// import { isCloud } from '$lib/system';
// import { hoursToDays } from '$lib/helpers/date';
let logs = '';
@@ -47,22 +41,9 @@
}
});
});
// const limit = getServiceLimit('logs');
// const tier = tierToPlan($organization?.billingPlan)?.name;
</script>
<Container>
<!-- {#if isCloud && limit !== 0 && limit < Infinity}
<Alert>
Logs are retained in rolling {hoursToDays(limit)} intervals with the {tier} plan.
<button
class="link"
type="button"
on:click|preventDefault={() => wizard.start(ChangeOrganizationTierCloud)}
>Upgrade</button> to increase your log retention for a longer period.
</Alert>
{/if} -->
<CardGrid>
<div class="grid-1-2-col-1 u-flex u-cross-center u-gap-16">
<div class="avatar is-medium" aria-hidden="true">