mirror of
https://github.com/appwrite/console.git
synced 2026-04-07 19:17:46 +00:00
fix: settings
This commit is contained in:
+10
-11
@@ -12,7 +12,7 @@
|
||||
|
||||
export let site: Models.Site;
|
||||
export let frameworks: Models.Framework[];
|
||||
let selectedFramework = null;
|
||||
let selectedFramework: Models.Framework = null;
|
||||
let installCommand = undefined;
|
||||
let buildCommand = undefined;
|
||||
let outputDirectory = undefined;
|
||||
@@ -22,10 +22,9 @@
|
||||
onMount(async () => {
|
||||
selectedFramework ??= frameworks.find((framework) => framework.key === site.framework);
|
||||
|
||||
// TODO: ask backend to add missing defaults
|
||||
installCommand = site?.installCommand ?? selectedFramework.installCommand;
|
||||
buildCommand = site?.buildCommand ?? selectedFramework.buildCommand;
|
||||
outputDirectory = site?.outputDirectory ?? selectedFramework.outputDirectory;
|
||||
installCommand = site?.installCommand ?? selectedFramework.defaultInstallCommand;
|
||||
buildCommand = site?.buildCommand ?? selectedFramework.defaultBuildCommand;
|
||||
outputDirectory = site?.outputDirectory ?? selectedFramework.defaultOutputDirectory;
|
||||
});
|
||||
|
||||
async function updateName() {
|
||||
@@ -33,14 +32,14 @@
|
||||
await sdk.forProject.sites.update(
|
||||
site.$id,
|
||||
site.name,
|
||||
Framework[selectedFramework.key],
|
||||
selectedFramework.key as Framework,
|
||||
site.enabled || undefined,
|
||||
site.timeout || undefined,
|
||||
installCommand || undefined,
|
||||
buildCommand || undefined,
|
||||
outputDirectory || undefined,
|
||||
BuildRuntime[site?.buildRuntime] || undefined,
|
||||
ServeRuntime[site?.serveRuntime] || undefined,
|
||||
(site?.buildRuntime as BuildRuntime) || undefined,
|
||||
(site?.serveRuntime as ServeRuntime) || undefined,
|
||||
site.fallbackFile || undefined,
|
||||
site.installationId || undefined,
|
||||
site.providerRepositoryId || undefined,
|
||||
@@ -104,7 +103,7 @@
|
||||
id="installCommand"
|
||||
label="Install command"
|
||||
bind:value={installCommand}
|
||||
placeholder={frameworkData?.installCommand} />
|
||||
placeholder={frameworkData.defaultInstallCommand} />
|
||||
<Button secondary size="s" on:click={() => (installCommand = '')}>Reset</Button>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
|
||||
@@ -112,7 +111,7 @@
|
||||
id="buildCommand"
|
||||
label="Build command"
|
||||
bind:value={buildCommand}
|
||||
placeholder={frameworkData?.buildCommand} />
|
||||
placeholder={frameworkData.defaultBuildCommand} />
|
||||
<Button secondary size="s" on:click={() => (buildCommand = '')}>Reset</Button>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
|
||||
@@ -120,7 +119,7 @@
|
||||
id="outputDirectory"
|
||||
label="Output directory"
|
||||
bind:value={outputDirectory}
|
||||
placeholder={frameworkData?.outputDirectory} />
|
||||
placeholder={frameworkData.defaultOutputDirectory} />
|
||||
<Button secondary size="s" on:click={() => (outputDirectory = '')}>Reset</Button>
|
||||
</Layout.Stack>
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
await sdk.forProject.sites.update(
|
||||
site.$id,
|
||||
siteName,
|
||||
Framework[site?.framework],
|
||||
site?.framework as Framework,
|
||||
site.enabled || undefined,
|
||||
site.timeout || undefined,
|
||||
site.installCommand || undefined,
|
||||
site.buildCommand || undefined,
|
||||
site.outputDirectory || undefined,
|
||||
BuildRuntime[site?.buildRuntime] || undefined,
|
||||
ServeRuntime[site?.serveRuntime] || undefined,
|
||||
(site?.buildRuntime as BuildRuntime) || undefined,
|
||||
(site?.serveRuntime as ServeRuntime) || undefined,
|
||||
site.fallbackFile || undefined,
|
||||
site.installationId || undefined,
|
||||
site.providerRepositoryId || undefined,
|
||||
|
||||
+3
-3
@@ -67,14 +67,14 @@
|
||||
await sdk.forProject.sites.update(
|
||||
site.$id,
|
||||
site.name,
|
||||
Framework[site?.framework],
|
||||
site?.framework as Framework,
|
||||
site.enabled || undefined,
|
||||
site.timeout || undefined,
|
||||
site.installCommand || undefined,
|
||||
site.buildCommand || undefined,
|
||||
site.outputDirectory || undefined,
|
||||
BuildRuntime[site?.buildRuntime] || undefined,
|
||||
ServeRuntime[site?.serveRuntime] || undefined,
|
||||
(site?.buildRuntime as BuildRuntime) || undefined,
|
||||
(site?.serveRuntime as ServeRuntime) || undefined,
|
||||
site.fallbackFile || undefined,
|
||||
site.installationId || undefined,
|
||||
site.providerRepositoryId || undefined,
|
||||
|
||||
+18
-20
@@ -11,40 +11,36 @@
|
||||
|
||||
export let site: Models.Site;
|
||||
export let frameworks: Models.Framework[];
|
||||
let buildRuntime: string = null;
|
||||
let serveRuntime: string = null;
|
||||
const framework = frameworks.find((framework) => framework.key === site.framework);
|
||||
let buildRuntime = site?.buildRuntime;
|
||||
let serveRuntime = site?.serveRuntime;
|
||||
|
||||
let buildRuntimeOptions = [];
|
||||
let serveRuntimeOptions = [];
|
||||
let buildRuntimeOptions = framework.buildRuntimes.map((runtime) => ({
|
||||
label: runtime,
|
||||
value: runtime
|
||||
}));
|
||||
let serveRuntimeOptions = framework.serveRuntimes.map((runtime) => ({
|
||||
label: runtime,
|
||||
value: runtime
|
||||
}));
|
||||
|
||||
onMount(async () => {
|
||||
buildRuntime ??= site.buildRuntime;
|
||||
serveRuntime ??= site.serveRuntime;
|
||||
|
||||
const framework = frameworks.find((framework) => framework.key === site.framework);
|
||||
|
||||
buildRuntimeOptions = framework.buildRuntimes.map((runtime) => ({
|
||||
label: runtime,
|
||||
value: runtime
|
||||
}));
|
||||
serveRuntimeOptions = framework.serveRuntimes.map((runtime) => ({
|
||||
label: runtime,
|
||||
value: runtime
|
||||
}));
|
||||
buildRuntime ??= framework.defaultBuildRuntime;
|
||||
serveRuntime ??= framework.defaultBuildCommand;
|
||||
});
|
||||
async function updateRuntime() {
|
||||
try {
|
||||
await sdk.forProject.sites.update(
|
||||
site.$id,
|
||||
site.name,
|
||||
Framework[site?.framework] || undefined,
|
||||
site?.framework as Framework,
|
||||
site.enabled || undefined,
|
||||
site.timeout || undefined,
|
||||
site.installCommand || undefined,
|
||||
site.buildCommand || undefined,
|
||||
site.outputDirectory || undefined,
|
||||
BuildRuntime[site?.buildRuntime] || undefined,
|
||||
ServeRuntime[site?.serveRuntime] || undefined,
|
||||
(buildRuntime as BuildRuntime) || undefined,
|
||||
(serveRuntime as ServeRuntime) || undefined,
|
||||
site.fallbackFile || undefined,
|
||||
site.installationId || undefined,
|
||||
site.providerRepositoryId || undefined,
|
||||
@@ -66,6 +62,8 @@
|
||||
trackError(error, Submit.SiteUpdateTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
$: console.log('test');
|
||||
</script>
|
||||
|
||||
<Form onSubmit={updateRuntime}>
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
await sdk.forProject.sites.update(
|
||||
site.$id,
|
||||
site.name,
|
||||
Framework[site?.framework],
|
||||
site?.framework as Framework,
|
||||
site.enabled || undefined,
|
||||
site.timeout || undefined,
|
||||
site.installCommand || undefined,
|
||||
site.buildCommand || undefined,
|
||||
site.outputDirectory || undefined,
|
||||
BuildRuntime[site?.buildRuntime] || undefined,
|
||||
ServeRuntime[site?.serveRuntime] || undefined,
|
||||
(site?.buildRuntime as BuildRuntime) || undefined,
|
||||
(site?.serveRuntime as ServeRuntime) || undefined,
|
||||
fallback,
|
||||
site.installationId || undefined,
|
||||
site.providerRepositoryId || undefined,
|
||||
|
||||
+6
-6
@@ -10,11 +10,10 @@
|
||||
import { BuildRuntime, Framework, ServeRuntime, type Models } from '@appwrite.io/console';
|
||||
|
||||
export let site: Models.Site;
|
||||
let timeout = site.timeout;
|
||||
|
||||
let timeout = 0;
|
||||
onMount(async () => {
|
||||
timeout = site.timeout;
|
||||
console.log(timeout);
|
||||
timeout ??= site.timeout;
|
||||
});
|
||||
|
||||
async function updateTimeout() {
|
||||
@@ -22,14 +21,14 @@
|
||||
await sdk.forProject.sites.update(
|
||||
site.$id,
|
||||
site.name,
|
||||
Framework[site?.framework] || undefined,
|
||||
site?.framework as Framework,
|
||||
site.enabled || undefined,
|
||||
timeout || undefined,
|
||||
site.installCommand || undefined,
|
||||
site.buildCommand || undefined,
|
||||
site.outputDirectory || undefined,
|
||||
BuildRuntime[site?.buildRuntime] || undefined,
|
||||
ServeRuntime[site?.serveRuntime] || undefined,
|
||||
(site?.buildRuntime as BuildRuntime) || undefined,
|
||||
(site?.serveRuntime as ServeRuntime) || undefined,
|
||||
site.fallbackFile || undefined,
|
||||
site.installationId || undefined,
|
||||
site.providerRepositoryId || undefined,
|
||||
@@ -64,6 +63,7 @@
|
||||
id="time"
|
||||
label="Time (in seconds)"
|
||||
placeholder="Enter timeout"
|
||||
required
|
||||
bind:value={timeout} />
|
||||
</svelte:fragment>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user