Skip to content

Commit 380d743

Browse files
authored
Merge pull request #2147 from HarshMN2345/fix-SER-149-Fix-site-settings-saving
2 parents 4538dbb + 55fcc9b commit 380d743

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/+page.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@
6060
{#key data.site.providerRepositoryId}
6161
<UpdateRepository site={data.site} installations={data.installations} />
6262
{/key}
63-
<UpdateBuildSettings site={data.site} frameworks={data.frameworks.frameworks} />
63+
<UpdateBuildSettings
64+
site={data.site}
65+
frameworks={data.frameworks.frameworks}
66+
specs={data.specificationsList} />
6467
<UpdateRuntimeSettings site={data.site} frameworks={data.frameworks.frameworks} />
6568
<UpdateVariables
6669
{sdkCreateVariable}

src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/+page.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ export const load = async ({ params, depends, parent }) => {
3333
}
3434
});
3535

36+
const enabledSpecs = specificationsList?.specifications?.filter((s) => s.enabled) ?? [];
37+
if (!enabledSpecs.some((s) => s.slug === site.specification)) {
38+
site.specification = enabledSpecs[0]?.slug;
39+
}
40+
3641
return {
3742
site,
3843
frameworks,

src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
1818
let {
1919
site,
20-
frameworks
20+
frameworks,
21+
specs
2122
}: {
2223
site: Models.Site;
2324
frameworks: Models.Framework[];
25+
specs: Models.SpecificationList;
2426
} = $props();
2527
2628
let frameworkKey = $state(site.framework);
@@ -88,12 +90,33 @@
8890
}
8991
});
9092
93+
$effect(() => {
94+
if (selectedFramework) {
95+
if (!selectedFramework.adapters.some((a) => a.key === adapter)) {
96+
adapter = selectedFramework.adapters[0].key as Adapter;
97+
site.adapter = adapter;
98+
}
99+
if (specs && specs.specifications?.length) {
100+
if (!specs.specifications.some((s) => s.slug === site.specification)) {
101+
site.specification = specs.specifications[0].slug;
102+
}
103+
}
104+
}
105+
});
106+
91107
async function update() {
92108
let adptr = selectedFramework.adapters.find((a) => a.key === adapter);
93109
if (!adptr?.key && selectedFramework.adapters?.length) {
94110
adapter = selectedFramework.adapters[0].key as Adapter;
95111
adptr = selectedFramework.adapters[0];
112+
site.adapter = adapter;
96113
}
114+
// only allow enabled specsification for it
115+
const enabledSpecs = specs?.specifications?.filter((s) => s.enabled) ?? [];
116+
let specToSend = enabledSpecs.some((s) => s.slug === site.specification)
117+
? site.specification
118+
: enabledSpecs[0]?.slug;
119+
site.specification = specToSend;
97120
try {
98121
await sdk
99122
.forProject(page.params.region, page.params.project)
@@ -115,7 +138,7 @@
115138
site.providerBranch || undefined,
116139
site.providerSilentMode || undefined,
117140
site.providerRootDirectory || undefined,
118-
site?.specification || undefined
141+
specToSend || undefined
119142
);
120143
await invalidate(Dependencies.SITE);
121144
addNotification({

src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateResourceLimits.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
let specification = site.specification;
2020
let originalSpecification = site.specification;
2121
22-
$: originalSpecification = site.specification;
23-
2422
async function updateLogging() {
2523
try {
2624
await sdk

0 commit comments

Comments
 (0)