Merge pull request #1721 from appwrite/revert-1675-feat-budget-nullable

Revert "Console Feat: make budget cap nullable"
This commit is contained in:
Darshan
2025-03-05 12:08:52 +05:30
committed by GitHub
4 changed files with 7 additions and 14 deletions
@@ -170,7 +170,7 @@
trackEvent(Submit.OrganizationCreate, {
plan: tierToPlan(billingPlan)?.name,
budget_cap_enabled: billingBudget !== null,
budget_cap_enabled: !!billingBudget,
members_invited: collaborators?.length
});
@@ -1,6 +1,7 @@
<script lang="ts">
import { Container } from '$lib/layout';
import { organization } from '$lib/stores/organization';
import BudgetAlert from './budgetAlert.svelte';
import BudgetCap from './budgetCap.svelte';
import PlanSummary from './planSummary.svelte';
import BillingAddress from './billingAddress.svelte';
@@ -127,6 +128,7 @@
<BillingAddress billingAddress={data?.billingAddress} />
<TaxId />
<BudgetCap />
<BudgetAlert />
<AvailableCredit />
</Container>
@@ -20,8 +20,6 @@
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
export let alertsEnabled = false;
let search: string;
let selectedAlert: number;
let alerts: number[] = [];
@@ -76,8 +74,7 @@
}
}
$: isButtonDisabled =
symmetricDifference(alerts, $organization.budgetAlerts).length === 0 || !alertsEnabled;
$: isButtonDisabled = symmetricDifference(alerts, $organization.budgetAlerts).length === 0;
</script>
<Form onSubmit={updateBudget}>
@@ -110,7 +107,6 @@
<div class="u-flex u-gap-16">
<InputSelectSearch
disabled={!alertsEnabled}
label="Percentage (%) of budget cap"
placeholder="Select a percentage"
id="alerts"
@@ -122,9 +118,7 @@
<div style="align-self: flex-end">
<Button
secondary
disabled={alerts.length > 3 ||
(!search && !selectedAlert) ||
!alertsEnabled}
disabled={alerts.length > 3 || (!search && !selectedAlert)}
on:click={addAlert}>
Add alert
</Button>
@@ -9,14 +9,13 @@
import { organization, currentPlan } from '$lib/stores/organization';
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import BudgetAlert from './budgetAlert.svelte';
let capActive = false;
let budget: number;
onMount(() => {
budget = $organization?.billingBudget;
capActive = $organization?.billingBudget !== null;
capActive = !!$organization?.billingBudget;
});
async function updateBudget() {
@@ -45,7 +44,7 @@
}
$: if (!capActive) {
budget = null;
budget = 0;
}
</script>
@@ -114,5 +113,3 @@
</svelte:fragment>
</CardGrid>
</Form>
<BudgetAlert alertsEnabled={capActive && budget > 0} />