Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Header from './header.svelte';
import { sdk } from '$lib/stores/sdk';
import { Query } from '@appwrite.io/console';
import { Dependencies } from '$lib/constants';
import { isCloud } from '$lib/system';
import type { LayoutLoad } from './$types';

export const load: LayoutLoad = async ({ depends, params }) => {
Expand All @@ -13,7 +14,9 @@ export const load: LayoutLoad = async ({ depends, params }) => {
sdk
.forProject(params.region, params.project)
.vcs.listInstallations({ queries: [Query.limit(100)] }),
sdk.forProject(params.region, params.project).functions.listSpecifications()
isCloud
? sdk.forProject(params.region, params.project).functions.listSpecifications()
: Promise.resolve({ specifications: [], total: 0 })
]);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
return { value, label, leadingHtml };
});

const specificationOptions = data.specificationsList.specifications.map((size) => ({
const specificationOptions = (data.specificationsList?.specifications ?? []).map((size) => ({
label:
`${size.cpus} CPU, ${size.memory} MB RAM` +
(!size.enabled ? ` (Upgrade to use this)` : ''),
Expand All @@ -58,7 +58,7 @@
let roles: string[] = [];
let variables: Partial<Models.Variable>[] = [];
let files: FileList;
let specification = specificationOptions[0].value;
let specification = specificationOptions[0]?.value || '';

async function create() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

export let data;

const specificationOptions = data.specificationsList.specifications.map((size) => ({
const specificationOptions = (data.specificationsList?.specifications ?? []).map((size) => ({
label:
`${size.cpus} CPU, ${size.memory} MB RAM` +
(!size.enabled ? ` (Upgrade to use this)` : ''),
Expand Down Expand Up @@ -55,7 +55,7 @@
let rootDir = './';
let variables: Partial<Models.Variable>[] = [];
let silentMode = false;
let specification = specificationOptions[0].value;
let specification = specificationOptions[0]?.value || '';

let detectingRuntime = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

export let data;

const specificationOptions = data.specificationsList.specifications.map((size) => ({
const specificationOptions = (data.specificationsList?.specifications ?? []).map((size) => ({
label:
`${size.cpus} CPU, ${size.memory} MB RAM` +
(!size.enabled ? ` (Upgrade to use this)` : ''),
Expand Down Expand Up @@ -65,7 +65,7 @@
let selectedScopes: string[] = [];
let execute = true;
let variables: Partial<Models.TemplateVariable>[] = [];
let specification = specificationOptions[0].value;
let specification = specificationOptions[0]?.value || '';

onMount(async () => {
if (!$installation?.$id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
}
}

const options = specs.specifications.map((spec) => ({
const options = (specs?.specifications ?? []).map((spec) => ({
label: `${spec.cpus} CPU, ${spec.memory} MB RAM`,
value: spec.slug,
disabled: !spec.enabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { sdk } from '$lib/stores/sdk';
import { Dependencies } from '$lib/constants';
import { isCloud } from '$lib/system';

export const load = async ({ params, depends, parent }) => {
depends(Dependencies.VARIABLES);
Expand All @@ -14,7 +15,9 @@ export const load = async ({ params, depends, parent }) => {
.sites.listVariables({ siteId: params.site }),
sdk.forProject(params.region, params.project).sites.listFrameworks(),
sdk.forProject(params.region, params.project).vcs.listInstallations(),
sdk.forProject(params.region, params.project).sites.listSpecifications()
isCloud
? sdk.forProject(params.region, params.project).sites.listSpecifications()
: Promise.resolve({ specifications: [], total: 0 })
]);

// Conflicting variables first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
}
}

const options = specs.specifications.map((spec) => ({
const options = (specs?.specifications ?? []).map((spec) => ({
label: `${spec.cpus} CPU, ${spec.memory} MB RAM`,
value: spec.slug,
disabled: !spec.enabled
Expand Down