Skip to content

Commit 0531bd8

Browse files
authored
Merge pull request #2040 from appwrite/fix-manual-deployments
Fix manual deployment flows
2 parents b1df97a + f3e69a6 commit 0531bd8

File tree

9 files changed

+39
-24
lines changed

9 files changed

+39
-24
lines changed

src/routes/(console)/organization-[organization]/domains/domain-[domain]/importRecordModal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
}
3838
3939
function handleInvalid(e: CustomEvent) {
40-
const reason = e.detail.reason;
40+
const reason = e.detail?.reason ?? '';
4141
if (reason === InvalidFileType.EXTENSION) {
4242
error = 'Only .txt files allowed';
4343
} else if (reason === InvalidFileType.SIZE) {

src/routes/(console)/project-[region]-[project]/functions/create-function/manual/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
}
131131
132132
function handleInvalid(e: CustomEvent) {
133-
const reason = e.detail.reason;
133+
const reason = e.detail?.reason ?? '';
134134
if (reason === InvalidFileType.EXTENSION) {
135135
addNotification({
136136
type: 'error',

src/routes/(console)/project-[region]-[project]/functions/function-[function]/(modals)/createManual.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
}
4949
5050
function handleInvalid(e: CustomEvent) {
51-
const reason = e.detail.reason;
51+
const reason = e.detail?.reason ?? '';
5252
if (reason === InvalidFileType.EXTENSION) {
5353
error = 'Only .tar.gz files allowed';
5454
} else if (reason === InvalidFileType.SIZE) {

src/routes/(console)/project-[region]-[project]/messaging/providers/settingsFormInput.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
}
5959
6060
function handleInvalid(e: CustomEvent) {
61-
const reason = e.detail.reason;
61+
const reason = e.detail?.reason ?? '';
6262
6363
if (reason === InvalidFileType.EXTENSION) {
6464
addNotification({

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,13 @@
1414
import { BuildRuntime, Framework, ID } from '@appwrite.io/console';
1515
import type { Models } from '@appwrite.io/console';
1616
import Configuration from '../configuration.svelte';
17-
import { buildVerboseDomain } from '../store';
18-
import {
19-
project,
20-
regionalConsoleVariables
21-
} from '$routes/(console)/project-[region]-[project]/store';
22-
import { organization } from '$lib/stores/organization';
17+
import { regionalConsoleVariables } from '../../../store';
2318
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
2419
import { InvalidFileType, removeFile } from '$lib/helpers/files';
2520
import { humanFileSize } from '$lib/helpers/sizeConvertion';
2621
import { isCloud } from '$lib/system';
2722
import { currentPlan } from '$lib/stores/organization';
23+
import Domain from '../domain.svelte';
2824
2925
export let data;
3026
let showExitModal = false;
@@ -34,7 +30,8 @@
3430
3531
let name = 'My website';
3632
let id = ID.unique();
37-
let domain = `${id}.${$regionalConsoleVariables._APP_DOMAIN_SITES}`;
33+
let domain = data.domain;
34+
let domainIsValid = true;
3835
let framework: Models.Framework =
3936
data.frameworks.frameworks?.find((f) => f.key === 'other') ??
4037
data.frameworks.frameworks?.[0];
@@ -54,13 +51,13 @@
5451
5552
async function create() {
5653
try {
57-
domain = await buildVerboseDomain(
58-
$regionalConsoleVariables._APP_DOMAIN_SITES,
59-
name,
60-
$organization.name,
61-
$project.name,
62-
id
63-
);
54+
if (!domainIsValid) {
55+
addNotification({
56+
type: 'error',
57+
message: 'Domain is not valid'
58+
});
59+
return;
60+
}
6461
6562
const fr = Object.values(Framework).find((f) => f === framework.key);
6663
const buildRuntime = Object.values(BuildRuntime).find(
@@ -138,7 +135,7 @@
138135
}
139136
140137
function handleInvalid(e: CustomEvent) {
141-
const reason = e.detail.reason;
138+
const reason = e.detail?.reason ?? '';
142139
if (reason === InvalidFileType.EXTENSION) {
143140
addNotification({
144141
type: 'error',
@@ -233,6 +230,8 @@
233230
bind:selectedFramework={framework}
234231
bind:variables
235232
frameworks={data.frameworks.frameworks} />
233+
234+
<Domain bind:domain bind:domainIsValid />
236235
</Layout.Stack>
237236
</Form>
238237
<svelte:fragment slot="aside">

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
import { sdk } from '$lib/stores/sdk';
2+
import { ID } from '@appwrite.io/console';
3+
import { buildVerboseDomain } from '../store';
24

35
export const load = async ({ parent, params }) => {
4-
const { frameworks } = await parent();
6+
const { frameworks, project, organization, regionalConsoleVariables } = await parent();
7+
8+
const domain = await buildVerboseDomain(
9+
regionalConsoleVariables._APP_DOMAIN_SITES,
10+
'', // name
11+
organization.name,
12+
project.name,
13+
ID.unique()
14+
);
515

616
return {
17+
domain,
718
frameworks,
819
template: await sdk
920
.forProject(params.region, params.project)

src/routes/(console)/project-[region]-[project]/sites/create-site/store.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ export async function buildVerboseDomain(
2828
: '';
2929
const safeUnique = unique ? toURLSafe(unique).toLowerCase() : ID.unique();
3030
let domain = `${safeName}`;
31-
if (await checkDomain(domain, apex)) {
31+
if (domain && (await checkDomain(domain, apex))) {
3232
return domain;
3333
}
34-
domain += '-' + safeSpecifier;
34+
35+
if (domain) {
36+
domain += '-';
37+
}
38+
39+
domain += safeSpecifier;
3540
if (await checkDomain(domain, apex)) {
3641
return domain;
3742
}

src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/createManualDeploymentModal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
}
4343
4444
function handleInvalid(e: CustomEvent) {
45-
const reason = e.detail.reason;
45+
const reason = e.detail?.reason ?? '';
4646
if (reason === InvalidFileType.EXTENSION) {
4747
error = 'Only .tar.gz files allowed';
4848
} else if (reason === InvalidFileType.SIZE) {

src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/create/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
}
7777
7878
function handleInvalid(e: CustomEvent) {
79-
const reason = e.detail.reason;
79+
const reason = e.detail?.reason ?? '';
8080
if (reason === InvalidFileType.EXTENSION) {
8181
addNotification({
8282
type: 'error',

0 commit comments

Comments
 (0)