mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Add specification selector into wizard
This commit is contained in:
1 parent
1d050aacd7
commit
bfa142dc55
4 files changed
+47
-3
No files matched your search
@@ -19,7 +19,8 @@
|
||||
repositoryBehaviour: 'new',
|
||||
repositoryName: template.id,
|
||||
repositoryPrivate: true,
|
||||
repositoryId: null
|
||||
repositoryId: null,
|
||||
specification: null
|
||||
});
|
||||
wizard.start(CreateTemplate);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,8 @@
|
||||
$template.providerRepositoryId || undefined,
|
||||
$template.providerOwner || undefined,
|
||||
runtimeDetail.providerRootDirectory || undefined,
|
||||
$template.providerVersion || undefined
|
||||
$template.providerVersion || undefined,
|
||||
$templateConfig.specification || undefined
|
||||
);
|
||||
|
||||
if ($templateConfig.variables) {
|
||||
@@ -78,7 +79,8 @@
|
||||
customId: !!response.$id,
|
||||
runtime: response.runtime,
|
||||
deployment_type: $templateConfig.repositoryBehaviour,
|
||||
scopes: $templateConfig.scopes
|
||||
scopes: $templateConfig.scopes,
|
||||
specification: $templateConfig.specification
|
||||
});
|
||||
resetState();
|
||||
} catch (error) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { FormList, InputSelect, InputText } from '$lib/elements/forms';
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { runtimesList } from '$lib/stores/runtimes';
|
||||
import { specificationsList } from '$lib/stores/specifications';
|
||||
import { template, templateConfig } from '../store';
|
||||
|
||||
let showCustomId = false;
|
||||
@@ -12,6 +13,10 @@
|
||||
if (!$templateConfig.runtime) {
|
||||
throw new Error('Please select a runtime.');
|
||||
}
|
||||
|
||||
if (!$templateConfig.specification) {
|
||||
throw new Error('Please select a specification.');
|
||||
}
|
||||
}
|
||||
|
||||
async function loadRuntimes() {
|
||||
@@ -27,6 +32,22 @@
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
async function loadSpecifications() {
|
||||
const specificationOptions = (await $specificationsList).specifications.map((size) => ({
|
||||
label:
|
||||
`${size.cpus} CPU, ${size.memory} MB RAM` +
|
||||
(!size.enabled ? ` (Upgrade to use this)` : ''),
|
||||
value: size.slug,
|
||||
disabled: !size.enabled
|
||||
}));
|
||||
|
||||
if (!$templateConfig.specification && specificationOptions.length > 0) {
|
||||
$templateConfig.specification = specificationOptions[0].value;
|
||||
}
|
||||
|
||||
return specificationOptions;
|
||||
}
|
||||
</script>
|
||||
|
||||
<WizardStep {beforeSubmit}>
|
||||
@@ -61,6 +82,25 @@
|
||||
{options}
|
||||
bind:value={$templateConfig.runtime} />
|
||||
{/await}
|
||||
{#await loadSpecifications()}
|
||||
<InputSelect
|
||||
label="CPU and memory"
|
||||
id="specification"
|
||||
placeholder="Loading specifications..."
|
||||
required
|
||||
disabled
|
||||
options={[]}
|
||||
value={null} />
|
||||
{:then specificationOptions}
|
||||
<InputSelect
|
||||
label="CPU and memory"
|
||||
id="specification"
|
||||
placeholder="Select specification"
|
||||
required
|
||||
disabled={specificationOptions.length < 1}
|
||||
options={specificationOptions}
|
||||
bind:value={$templateConfig.specification} />
|
||||
{/await}
|
||||
</FormList>
|
||||
|
||||
<FormList class="u-margin-block-start-24">
|
||||
|
||||
@@ -15,6 +15,7 @@ export const templateConfig = writable<{
|
||||
repositoryId: string;
|
||||
execute?: boolean;
|
||||
scopes?: string[];
|
||||
specification?: string;
|
||||
}>();
|
||||
export const repository = writable<Models.ProviderRepository>();
|
||||
export const installation = writable<Models.Installation>();
|
||||
|
||||
Reference in new issue
Block a user