feat: use combobox for branch inputs

This commit is contained in:
Arman
2025-05-22 14:09:36 +02:00
parent 0b65abfbbb
commit 814723baf2
5 changed files with 58 additions and 37 deletions
@@ -4,14 +4,14 @@
import { Repositories } from '$lib/components/git';
import { Dependencies } from '$lib/constants';
import { Link } from '$lib/elements';
import { Button, InputCheckbox, InputSelect } from '$lib/elements/forms';
import { Button, InputCheckbox } from '$lib/elements/forms';
import { timeFromNow } from '$lib/helpers/date';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { installation, repository, sortBranches } from '$lib/stores/vcs';
import { Runtime, VCSDeploymentType, type Models } from '@appwrite.io/console';
import { IconGithub } from '@appwrite.io/pink-icons-svelte';
import { Icon, Layout, Skeleton, Typography } from '@appwrite.io/pink-svelte';
import { Icon, Input, Layout, Skeleton, Typography } from '@appwrite.io/pink-svelte';
import { func } from '../store';
import { page } from '$app/state';
@@ -120,6 +120,14 @@
error = e.message;
}
}
$: if (!show) {
error = '';
branch = null;
commit = null;
activate = true;
hasRepository = !!$func?.providerRepositoryId;
}
</script>
<Modal title="Create Git deployment" bind:show onSubmit={createDeployment} bind:error>
@@ -179,13 +187,13 @@
</Typography.Caption>
</Layout.Stack>
</Card>
<InputSelect
required={true}
<Input.ComboBox
required
id="branch"
label="Production branch"
placeholder="Select branch"
bind:value={branch}
isSearchable
bind:value={branch}
on:select={(event) => {
branch = event.detail.value;
}}
@@ -5,7 +5,7 @@
import { Repositories } from '$lib/components/git';
import { Dependencies } from '$lib/constants';
import { Link } from '$lib/elements';
import { Button, InputCheckbox, InputSelect } from '$lib/elements/forms';
import { Button, InputCheckbox } from '$lib/elements/forms';
import { timeFromNow } from '$lib/helpers/date';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
@@ -18,7 +18,7 @@
type Models
} from '@appwrite.io/console';
import { IconGithub } from '@appwrite.io/pink-icons-svelte';
import { Icon, Layout, Skeleton, Typography } from '@appwrite.io/pink-svelte';
import { Icon, Input, Layout, Skeleton, Typography } from '@appwrite.io/pink-svelte';
export let show = false;
export let site: Models.Site;
@@ -125,6 +125,14 @@
error = e.message;
}
}
$: if (!show) {
error = '';
branch = null;
commit = null;
activate = true;
hasRepository = !!site?.providerRepositoryId;
}
</script>
<Modal title="Create Git deployment" bind:show onSubmit={createDeployment} bind:error>
@@ -184,13 +192,13 @@
</Typography.Caption>
</Layout.Stack>
</Card>
<InputSelect
required={true}
<Input.ComboBox
required
id="branch"
label="Production branch"
placeholder="Select branch"
bind:value={branch}
isSearchable
bind:value={branch}
on:select={(event) => {
branch = event.detail.value;
}}
@@ -175,13 +175,17 @@
value: branch.name
}))}
<Layout.Stack gap="s">
<InputSelect
{options}
label="Production branch"
id="branch"
<Input.ComboBox
required
id="branch"
label="Production branch"
placeholder="Select branch"
isSearchable
bind:value={branch}
placeholder="Select branch" />
on:select={(event) => {
branch = event.detail.value;
}}
{options} />
{#if !data.branches?.total}
<Input.Helper state="default">
No branches found in the selected repository. Create a