mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: pass specification type to SDK
This commit is contained in:
1 parent
3911369d8f
commit
b5c68e8f26
10 files changed
+106
-62
No files matched your search
@@ -6,7 +6,7 @@
|
||||
"name": "@appwrite/console",
|
||||
"dependencies": {
|
||||
"@ai-sdk/svelte": "^1.1.24",
|
||||
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@2e31ae6",
|
||||
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@16caf4e",
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3",
|
||||
"@appwrite.io/pink-legacy": "^1.0.3",
|
||||
@@ -126,7 +126,7 @@
|
||||
|
||||
"@analytics/type-utils": ["@analytics/type-utils@0.6.4", "", {}, "sha512-Ou1gQxFakOWLcPnbFVsrPb8g1wLLUZYYJXDPjHkG07+5mustGs5yqACx42UAu4A6NszNN6Z5gGxhyH45zPWRxw=="],
|
||||
|
||||
"@appwrite.io/console": ["@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@2e31ae6", { "dependencies": { "json-bigint": "1.0.0" } }, "sha512-DtlsXzS8hzz1R0FCC9FXPrabmZUs9qbkC4ogNU0POeKvcplviPe5Pcn0tzZotjYrPfAEdbpS2sJc62ZOdkAp5Q=="],
|
||||
"@appwrite.io/console": ["@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@16caf4e", { "dependencies": { "json-bigint": "1.0.0" } }, "sha512-JqzVnaRKHCEZzmcKze8Lal8X2NsZ9UUZcYH8Dqk8kXM2+3CQ/7edShjJCzsClIfP82PPA7jnN61lye/E/RAPww=="],
|
||||
|
||||
"@appwrite.io/pink-icons": ["@appwrite.io/pink-icons@0.25.0", "", {}, "sha512-0O3i2oEuh5mWvjO80i+X6rbzrWLJ1m5wmv2/M3a1p2PyBJsFxN8xQMTEmTn3Wl/D26SsM7SpzbdW6gmfgoVU9Q=="],
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/svelte": "^1.1.24",
|
||||
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@2e31ae6",
|
||||
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@16caf4e",
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3",
|
||||
"@appwrite.io/pink-legacy": "^1.0.3",
|
||||
|
||||
@@ -9,21 +9,30 @@ import type { LayoutLoad } from './$types';
|
||||
export const load: LayoutLoad = async ({ depends, params }) => {
|
||||
depends(Dependencies.FUNCTION_INSTALLATIONS);
|
||||
|
||||
const [runtimesList, installations, specificationsList] = await Promise.all([
|
||||
sdk.forProject(params.region, params.project).functions.listRuntimes(),
|
||||
sdk
|
||||
.forProject(params.region, params.project)
|
||||
.vcs.listInstallations({ queries: [Query.limit(100)] }),
|
||||
isCloud
|
||||
? sdk.forProject(params.region, params.project).functions.listSpecifications()
|
||||
: Promise.resolve({ specifications: [], total: 0 })
|
||||
]);
|
||||
const [runtimesList, installations, buildSpecificationsList, runtimeSpecificationsList] =
|
||||
await Promise.all([
|
||||
sdk.forProject(params.region, params.project).functions.listRuntimes(),
|
||||
sdk
|
||||
.forProject(params.region, params.project)
|
||||
.vcs.listInstallations({ queries: [Query.limit(100)] }),
|
||||
isCloud
|
||||
? sdk
|
||||
.forProject(params.region, params.project)
|
||||
.functions.listSpecifications({ type: 'builds' })
|
||||
: Promise.resolve({ specifications: [], total: 0 }),
|
||||
isCloud
|
||||
? sdk
|
||||
.forProject(params.region, params.project)
|
||||
.functions.listSpecifications({ type: 'runtimes' })
|
||||
: Promise.resolve({ specifications: [], total: 0 })
|
||||
]);
|
||||
|
||||
return {
|
||||
header: Header,
|
||||
breadcrumbs: Breadcrumbs,
|
||||
runtimesList,
|
||||
installations,
|
||||
specificationsList
|
||||
specificationsList: buildSpecificationsList,
|
||||
runtimeSpecificationsList
|
||||
};
|
||||
};
|
||||
+4
-1
@@ -128,7 +128,10 @@
|
||||
|
||||
<UpdatePermissions />
|
||||
{#if isCloud}
|
||||
<UpdateResourceLimits func={data.function} specs={data.specificationsList} />
|
||||
<UpdateResourceLimits
|
||||
func={data.function}
|
||||
buildSpecs={data.specificationsList}
|
||||
runtimeSpecs={data.runtimeSpecificationsList} />
|
||||
{/if}
|
||||
<UpdateEvents />
|
||||
<UpdateSchedule />
|
||||
|
||||
+14
-6
@@ -11,14 +11,21 @@ export const load = async ({ params, depends, parent }) => {
|
||||
const limit = PAGE_LIMIT;
|
||||
const variablesOffset = 0;
|
||||
|
||||
const { runtimesList, specificationsList, function: fn } = await parent();
|
||||
const {
|
||||
runtimesList,
|
||||
specificationsList,
|
||||
runtimeSpecificationsList,
|
||||
function: fn
|
||||
} = await parent();
|
||||
|
||||
const enabledSpecs = specificationsList?.specifications?.filter((s) => s.enabled) ?? [];
|
||||
if (!enabledSpecs.some((s) => s.slug === fn.buildSpecification)) {
|
||||
fn.buildSpecification = enabledSpecs[0]?.slug;
|
||||
const buildEnabledSpecs = specificationsList?.specifications?.filter((s) => s.enabled) ?? [];
|
||||
const runtimeEnabledSpecs =
|
||||
runtimeSpecificationsList?.specifications?.filter((s) => s.enabled) ?? [];
|
||||
if (!buildEnabledSpecs.some((s) => s.slug === fn.buildSpecification)) {
|
||||
fn.buildSpecification = buildEnabledSpecs[0]?.slug;
|
||||
}
|
||||
if (!enabledSpecs.some((s) => s.slug === fn.runtimeSpecification)) {
|
||||
fn.runtimeSpecification = enabledSpecs[0]?.slug;
|
||||
if (!runtimeEnabledSpecs.some((s) => s.slug === fn.runtimeSpecification)) {
|
||||
fn.runtimeSpecification = runtimeEnabledSpecs[0]?.slug;
|
||||
}
|
||||
|
||||
const [globalVariables, variables] = await Promise.all([
|
||||
@@ -56,6 +63,7 @@ export const load = async ({ params, depends, parent }) => {
|
||||
variablesOffset,
|
||||
runtimesList,
|
||||
specificationsList,
|
||||
runtimeSpecificationsList,
|
||||
function: fn
|
||||
};
|
||||
};
|
||||
+12
-6
@@ -17,7 +17,8 @@
|
||||
import { page } from '$app/state';
|
||||
|
||||
export let func: Models.Function;
|
||||
export let specs: Models.SpecificationList;
|
||||
export let buildSpecs: Models.SpecificationList;
|
||||
export let runtimeSpecs: Models.SpecificationList;
|
||||
|
||||
let buildSpecification = func.buildSpecification;
|
||||
let runtimeSpecification = func.runtimeSpecification;
|
||||
@@ -79,7 +80,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
const options = (specs?.specifications ?? []).map((spec) => ({
|
||||
const buildOptions = buildSpecs.specifications.map((spec) => ({
|
||||
label: `${spec.cpus} CPU, ${spec.memory} MB RAM`,
|
||||
value: spec.slug,
|
||||
disabled: !spec.enabled
|
||||
}));
|
||||
const runtimeOptions = runtimeSpecs.specifications.map((spec) => ({
|
||||
label: `${spec.cpus} CPU, ${spec.memory} MB RAM`,
|
||||
value: spec.slug,
|
||||
disabled: !spec.enabled
|
||||
@@ -100,9 +106,9 @@
|
||||
label="Build specification"
|
||||
id="build-specification"
|
||||
required
|
||||
disabled={options.length < 1}
|
||||
disabled={buildOptions.length < 1}
|
||||
bind:value={buildSpecification}
|
||||
{options}>
|
||||
options={buildOptions}>
|
||||
<Tooltip slot="info">
|
||||
<Icon icon={IconInfo} size="s" />
|
||||
<span slot="tooltip">
|
||||
@@ -114,9 +120,9 @@
|
||||
label="Runtime specification"
|
||||
id="runtime-specification"
|
||||
required
|
||||
disabled={options.length < 1}
|
||||
disabled={runtimeOptions.length < 1}
|
||||
bind:value={runtimeSpecification}
|
||||
{options}>
|
||||
options={runtimeOptions}>
|
||||
<Tooltip slot="info">
|
||||
<Icon icon={IconInfo} size="s" />
|
||||
<span slot="tooltip">
|
||||
|
||||
+6
-2
@@ -77,7 +77,8 @@
|
||||
<UpdateBuildSettings
|
||||
site={data.site}
|
||||
frameworks={data.frameworks.frameworks}
|
||||
specs={data.specificationsList} />
|
||||
buildSpecs={data.buildSpecificationsList}
|
||||
runtimeSpecs={data.runtimeSpecificationsList} />
|
||||
<UpdateRuntimeSettings site={data.site} frameworks={data.frameworks.frameworks} />
|
||||
<UpdateVariables
|
||||
{sdkCreateVariable}
|
||||
@@ -95,7 +96,10 @@
|
||||
product="site"
|
||||
analyticsSource="site_settings" />
|
||||
{#if isCloud}
|
||||
<UpdateResourceLimits site={data.site} specs={data.specificationsList} />
|
||||
<UpdateResourceLimits
|
||||
site={data.site}
|
||||
buildSpecs={data.buildSpecificationsList}
|
||||
runtimeSpecs={data.runtimeSpecificationsList} />
|
||||
{/if}
|
||||
<UpdateDeploymentRetention site={data.site} />
|
||||
<UpdateTimeout site={data.site} />
|
||||
|
||||
+32
-19
@@ -12,21 +12,34 @@ export const load = async ({ params, depends, parent }) => {
|
||||
const variablesOffset = 0;
|
||||
const { site } = await parent();
|
||||
|
||||
const [globalVariables, variables, frameworks, installations, specificationsList] =
|
||||
await Promise.all([
|
||||
sdk.forProject(params.region, params.project).projectApi.listVariables({
|
||||
queries: [Query.limit(VARIABLES_LIMIT)]
|
||||
}),
|
||||
sdk.forProject(params.region, params.project).sites.listVariables({
|
||||
siteId: params.site,
|
||||
queries: [Query.limit(limit), Query.offset(variablesOffset)]
|
||||
}),
|
||||
sdk.forProject(params.region, params.project).sites.listFrameworks(),
|
||||
sdk.forProject(params.region, params.project).vcs.listInstallations(),
|
||||
isCloud
|
||||
? sdk.forProject(params.region, params.project).sites.listSpecifications()
|
||||
: Promise.resolve({ specifications: [], total: 0 })
|
||||
]);
|
||||
const [
|
||||
globalVariables,
|
||||
variables,
|
||||
frameworks,
|
||||
installations,
|
||||
buildSpecificationsList,
|
||||
runtimeSpecificationsList
|
||||
] = await Promise.all([
|
||||
sdk.forProject(params.region, params.project).projectApi.listVariables({
|
||||
queries: [Query.limit(VARIABLES_LIMIT)]
|
||||
}),
|
||||
sdk.forProject(params.region, params.project).sites.listVariables({
|
||||
siteId: params.site,
|
||||
queries: [Query.limit(limit), Query.offset(variablesOffset)]
|
||||
}),
|
||||
sdk.forProject(params.region, params.project).sites.listFrameworks(),
|
||||
sdk.forProject(params.region, params.project).vcs.listInstallations(),
|
||||
isCloud
|
||||
? sdk
|
||||
.forProject(params.region, params.project)
|
||||
.sites.listSpecifications({ type: 'builds' })
|
||||
: Promise.resolve({ specifications: [], total: 0 }),
|
||||
isCloud
|
||||
? sdk
|
||||
.forProject(params.region, params.project)
|
||||
.sites.listSpecifications({ type: 'runtimes' })
|
||||
: Promise.resolve({ specifications: [], total: 0 })
|
||||
]);
|
||||
|
||||
// Conflicting variables first
|
||||
variables.variables = variables.variables.sort((var1, var2) => {
|
||||
@@ -46,9 +59,8 @@ export const load = async ({ params, depends, parent }) => {
|
||||
}
|
||||
});
|
||||
|
||||
const specifications = specificationsList?.specifications ?? [];
|
||||
const buildEnabledSpecs = specifications.filter((s) => s.enabledForBuilds);
|
||||
const runtimeEnabledSpecs = specifications.filter((s) => s.enabled);
|
||||
const buildEnabledSpecs = buildSpecificationsList.specifications.filter((s) => s.enabled);
|
||||
const runtimeEnabledSpecs = runtimeSpecificationsList.specifications.filter((s) => s.enabled);
|
||||
if (
|
||||
buildEnabledSpecs.length &&
|
||||
!buildEnabledSpecs.some((s) => s.slug === site.buildSpecification)
|
||||
@@ -70,6 +82,7 @@ export const load = async ({ params, depends, parent }) => {
|
||||
limit,
|
||||
variablesOffset,
|
||||
installations,
|
||||
specificationsList
|
||||
buildSpecificationsList,
|
||||
runtimeSpecificationsList
|
||||
};
|
||||
};
|
||||
+9
-8
@@ -18,11 +18,13 @@
|
||||
let {
|
||||
site,
|
||||
frameworks,
|
||||
specs
|
||||
buildSpecs,
|
||||
runtimeSpecs
|
||||
}: {
|
||||
site: Models.Site;
|
||||
frameworks: Models.Framework[];
|
||||
specs: Models.SpecificationList;
|
||||
buildSpecs: Models.SpecificationList;
|
||||
runtimeSpecs: Models.SpecificationList;
|
||||
} = $props();
|
||||
|
||||
let frameworkKey = $state(site.framework);
|
||||
@@ -124,9 +126,9 @@
|
||||
adapter = selectedFramework.adapters[0].key as Adapter;
|
||||
site.adapter = adapter;
|
||||
}
|
||||
if (specs && specs.specifications?.length) {
|
||||
const buildEnabledSpecs = specs.specifications.filter((s) => s.enabledForBuilds);
|
||||
const runtimeEnabledSpecs = specs.specifications.filter((s) => s.enabled);
|
||||
if (buildSpecs.specifications.length || runtimeSpecs.specifications.length) {
|
||||
const buildEnabledSpecs = buildSpecs.specifications.filter((s) => s.enabled);
|
||||
const runtimeEnabledSpecs = runtimeSpecs.specifications.filter((s) => s.enabled);
|
||||
if (
|
||||
buildEnabledSpecs.length &&
|
||||
!buildEnabledSpecs.some((s) => s.slug === site.buildSpecification)
|
||||
@@ -150,9 +152,8 @@
|
||||
adptr = selectedFramework.adapters[0];
|
||||
site.adapter = adapter;
|
||||
}
|
||||
const specifications = specs?.specifications ?? [];
|
||||
const buildEnabledSpecs = specifications.filter((s) => s.enabledForBuilds);
|
||||
const runtimeEnabledSpecs = specifications.filter((s) => s.enabled);
|
||||
const buildEnabledSpecs = buildSpecs.specifications.filter((s) => s.enabled);
|
||||
const runtimeEnabledSpecs = runtimeSpecs.specifications.filter((s) => s.enabled);
|
||||
const specToSend = buildEnabledSpecs.some((s) => s.slug === site.buildSpecification)
|
||||
? site.buildSpecification
|
||||
: (buildEnabledSpecs[0]?.slug ?? site.buildSpecification);
|
||||
|
||||
+7
-7
@@ -16,7 +16,8 @@
|
||||
import { page } from '$app/state';
|
||||
|
||||
export let site: Models.Site;
|
||||
export let specs: Models.SpecificationList;
|
||||
export let buildSpecs: Models.SpecificationList;
|
||||
export let runtimeSpecs: Models.SpecificationList;
|
||||
|
||||
let buildSpecification = site.buildSpecification;
|
||||
let runtimeSpecification = site.runtimeSpecification;
|
||||
@@ -75,15 +76,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
const specifications = specs?.specifications ?? [];
|
||||
const buildEnabledSpecs = specifications.filter((spec) => spec.enabledForBuilds);
|
||||
const runtimeEnabledSpecs = specifications.filter((spec) => spec.enabled);
|
||||
const buildOptions = specifications.map((spec) => ({
|
||||
const buildEnabledSpecs = buildSpecs.specifications.filter((spec) => spec.enabled);
|
||||
const runtimeEnabledSpecs = runtimeSpecs.specifications.filter((spec) => spec.enabled);
|
||||
const buildOptions = buildSpecs.specifications.map((spec) => ({
|
||||
label: `${spec.cpus} CPU, ${spec.memory} MB RAM`,
|
||||
value: spec.slug,
|
||||
disabled: !spec.enabledForBuilds
|
||||
disabled: !spec.enabled
|
||||
}));
|
||||
const runtimeOptions = specifications.map((spec) => ({
|
||||
const runtimeOptions = runtimeSpecs.specifications.map((spec) => ({
|
||||
label: `${spec.cpus} CPU, ${spec.memory} MB RAM`,
|
||||
value: spec.slug,
|
||||
disabled: !spec.enabled
|
||||
|
||||
Reference in new issue
Block a user