fix: function fist deployment, select validity

This commit is contained in:
Arman
2023-02-10 17:42:37 +01:00
parent 3c84356c76
commit 3edcfb6e57
4 changed files with 26 additions and 10 deletions
@@ -27,6 +27,14 @@
error = element.validationMessage;
};
$: if (element && required && !value) {
element.setCustomValidity('This field is required');
}
$: if (element && required && value) {
element.setCustomValidity('');
}
$: if (value) {
error = null;
}
@@ -7,6 +7,7 @@
export let value: string;
export let attribute: Models.AttributeEnum;
export let optionalText: string | undefined = undefined;
export let required = false;
$: options = attribute.elements.map((element) => {
return {
@@ -22,5 +23,6 @@
{id}
{label}
{optionalText}
required={attribute.required}
placeholder="Select a value"
showLabel={!!label?.length} />
@@ -156,7 +156,7 @@
<div class="common-section">
<Heading tag="h3" size="7">Inactive</Heading>
</div>
{#if data.deployments.total > 1}
{#if data.deployments.total > 1 || (!activeDeployment && data.deployments.total === 1)}
<TableScroll>
<TableHeader>
<TableCellHead width={90}>Deployment ID</TableCellHead>
@@ -3,7 +3,6 @@
import { Modal, Collapsible, CollapsibleItem, Tabs, Tab, Code } from '$lib/components';
import { sdkForProject } from '$lib/stores/sdk';
import { createEventDispatcher, onMount } from 'svelte';
import { addNotification } from '$lib/stores/notifications';
import { page } from '$app/stores';
import GithubLight from '$lib/images/github-illustration-light.svg';
import GithubDark from '$lib/images/github-illustration-dark.svg';
@@ -27,6 +26,7 @@
let lang = 'js';
let codeSnippets = {};
let os = 'unknown';
let error: string = null;
const functionId = $page.params.function;
const dispatch = createEventDispatcher();
@@ -97,16 +97,15 @@
files[0],
active
);
await invalidate(Dependencies.FUNCTION);
files = entrypoint = active = null;
await invalidate(Dependencies.DEPLOYMENTS);
files = undefined;
entrypoint = null;
active = false;
showCreate = false;
dispatch('created');
trackEvent('submit_deployment_create');
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
} catch ({ message }) {
error = message;
}
}
@@ -124,9 +123,16 @@
return index === 0;
}
}
$: if (!showCreate) {
files = undefined;
entrypoint = null;
active = false;
error = null;
}
</script>
<Modal size="big" bind:show={showCreate} on:submit={create}>
<Modal {error} size="big" bind:show={showCreate} on:submit={create}>
<svelte:fragment slot="header">Create Deployment</svelte:fragment>
<Tabs>
<Tab on:click={() => (mode = Mode.CLI)} selected={mode === Mode.CLI} event="deploy_cli">