fix: limit dropdown, update log retention messages

This commit is contained in:
Arman committed 2023-11-15 18:20:40 +01:00
1 parent b3b9e63651
commit c0ae6d16db
6 files changed
+34 -53

No files matched your search

+2 -2
View File
@@ -32,9 +32,9 @@
<ContainerHeader title="Activity" alertType="info" serviceId={service}>
<svelte:fragment slot="tooltip" let:limit let:tier let:upgradeMethod>
<p class="text">
You are limited to {hoursToDays(limit)} of logs on the {tier} plan.
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 log retention for a longer period.
>Upgrade</button> to increase your log retention for a longer period.
</p>
</svelte:fragment>
</ContainerHeader>
+23 -33
View File
@@ -1,11 +1,11 @@
<script lang="ts">
import { tierToPlan, getServiceLimit, type PlanServices } from '$lib/stores/billing';
import { tooltip } from '$lib/actions/tooltip';
import { Alert, Heading } from '$lib/components';
import { Alert, DropList, Heading } from '$lib/components';
import { Pill } from '$lib/elements';
import { organization } from '$lib/stores/organization';
import { isCloud } from '$lib/system';
import { createEventDispatcher, onMount, tick } from 'svelte';
import { createEventDispatcher, onMount } from 'svelte';
import { wizard } from '$lib/stores/wizard';
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
import { Button } from '$lib/elements/forms';
@@ -24,10 +24,13 @@
export let buttonEvent: string = buttonText?.toLocaleLowerCase();
export let buttonDisabled = false;
let tooltipContent: HTMLDivElement;
let showDropdown = false;
const limit = getServiceLimit(serviceId) || Infinity;
const upgradeMethod = () => wizard.start(ChangeOrganizationTierCloud);
const upgradeMethod = () => {
showDropdown = false;
wizard.start(ChangeOrganizationTierCloud);
};
const dispatch = createEventDispatcher();
$: tier = tierToPlan($organization?.billingPlan)?.name;
@@ -56,21 +59,24 @@
<div class="u-flex u-cross-child-center u-gap-16 u-flex-wrap">
<Heading tag={titleTag} size={titleSize}>{title}</Heading>
{#if isCloud && isLimited}
<div
use:tooltip={{
interactive: true,
allowHTML: true,
trigger: 'click',
onShow(instance) {
tick().then(() => {
instance.setContent(tooltipContent);
});
}
}}>
<Pill button>
<DropList bind:show={showDropdown} width="16">
<Pill button on:click={() => (showDropdown = !showDropdown)}>
<span class="icon-info" />{title} limited
</Pill>
</div>
<svelte:fragment slot="list">
<slot name="tooltip" {limit} {tier} {title} {upgradeMethod}>
<p class="text">
Your are limited to {limit}
{title.toLocaleLowerCase()} per project on the {tier} plan.
<button
class="link"
type="button"
on:click|preventDefault={upgradeMethod}>Upgrade</button>
for addtional {title.toLocaleLowerCase()}.
</p>
</slot>
</svelte:fragment>
</DropList>
{/if}
</div>
@@ -89,19 +95,3 @@
{/if}
</slot>
</header>
{#if isCloud}
<div class="u-hide">
<div bind:this={tooltipContent}>
<slot name="tooltip" {limit} {tier} {title} {upgradeMethod}>
<p class="text">
Your are limited to {limit}
{title.toLocaleLowerCase()} per project on the {tier} plan.
<button class="link" type="button" on:click|preventDefault={upgradeMethod}
>Upgrade</button>
for addtional {title.toLocaleLowerCase()}.
</p>
</slot>
</div>
</div>
{/if}
+4 -4
View File
@@ -303,15 +303,15 @@
{#if execution?.logs}
{#if isCloud && limit !== 0 && limit < Infinity}
<Alert>
You are limited to {hoursToDays(limit)} of logs on the {tier}
plan.
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 log retention for a longer
period.
>Upgrade</button> to increase your log retention for
a longer period.
</Alert>
{/if}
<Code withCopy noMargin code={execution.logs} language="sh" />
@@ -11,7 +11,6 @@
TableHeader,
TableRow
} from '$lib/elements/table';
import { hoursToDays } from '$lib/helpers/date';
import { Container, ContainerHeader } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
import DeleteAllSessions from '../deleteAllSessions.svelte';
@@ -29,20 +28,12 @@
</script>
<Container>
<ContainerHeader title="Sessions" serviceId="logs" alertType="info">
<ContainerHeader title="Sessions">
{#if data.sessions.total}
<Button secondary on:click={() => (showDeleteAll = true)}>
<span class="text">Delete All</span>
</Button>
{/if}
<svelte:fragment slot="tooltip" let:limit let:tier let:upgradeMethod>
<p class="text">
You are limited to {hoursToDays(limit)} of logs on the {tier} plan.
<button class="link" type="button" on:click|preventDefault={upgradeMethod}
>Upgrade</button> to increase log retention for a longer period.
</p>
</svelte:fragment>
</ContainerHeader>
{#if data.sessions.total}
<Table>
@@ -60,9 +60,9 @@
<ContainerHeader title="Deployments" serviceId="logs">
<svelte:fragment slot="tooltip" let:limit let:tier let:upgradeMethod>
<p class="text">
You are limited to {hoursToDays(limit)} of logs on the {tier} plan.
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 log retention for a longer period.
>Upgrade</button> to increase your log retention for a longer period.
</p>
</svelte:fragment>
<Create main />
@@ -55,12 +55,12 @@
<Container>
{#if isCloud && limit !== 0 && limit < Infinity}
<Alert>
You are limited to {hoursToDays(limit)} of logs on the {tier} plan.
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 log retention for a longer period.
>Upgrade</button> to increase your log retention for a longer period.
</Alert>
{/if}
<CardGrid>