chore: fix errors

This commit is contained in:
Arman
2025-05-02 15:13:09 +02:00
parent 9a58edd2c9
commit 57c82bb202
11 changed files with 28 additions and 30 deletions
@@ -3,12 +3,12 @@ import { sdk } from '$lib/stores/sdk';
import { RuleTrigger, RuleType } from '$lib/stores/sdk';
import { Dependencies } from '$lib/constants.js';
export const load = async ({ depends }) => {
export const load = async ({ depends, params }) => {
depends(Dependencies.DOMAINS);
const [rules] = await Promise.all([
sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.proxy.listRules([
Query.equal('type', RuleType.API),
Query.equal('trigger', RuleTrigger.MANUAL)
@@ -3,7 +3,7 @@ import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, getSearch, getView, pageToOffset, View } from '$lib/helpers/load';
import { CARD_LIMIT, Dependencies } from '$lib/constants';
export const load = async ({ url, depends, route }) => {
export const load = async ({ url, depends, route, params }) => {
depends(Dependencies.SITES);
const page = getPage(url);
@@ -13,7 +13,7 @@ export const load = async ({ url, depends, route }) => {
const view = getView(url, route, View.Grid, View.Grid);
const siteList = await sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.sites.list(
[Query.limit(limit), Query.offset(offset), Query.orderDesc('')],
search || undefined
@@ -4,13 +4,13 @@ import { Query } from '@appwrite.io/console';
import { Dependencies } from '$lib/constants';
import { DeploymentResourceType } from '$lib/stores/sdk';
export const load = async ({ url, depends }) => {
export const load = async ({ url, depends, params }) => {
depends(Dependencies.SITE);
if (!url.searchParams.has('site')) error(404, 'Deployment is not optional');
const siteId = url.searchParams.get('site');
const site = await sdk.forProject(page.params.region, page.params.project).sites.get(siteId);
const site = await sdk.forProject(params.region, params.project).sites.get(siteId);
const proxyRuleList = await sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.proxy.listRules([
Query.equal('type', RuleType.DEPLOYMENT),
Query.equal('deploymentResourceType', DeploymentResourceType.SITE),
@@ -20,7 +20,7 @@ export const load = async ({ url, depends }) => {
return {
site,
deployment: await sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.sites.getDeployment(siteId, site.deploymentId),
proxyRuleList
};
@@ -1,12 +1,12 @@
import { sdk } from '$lib/stores/sdk';
export const load = async ({ parent }) => {
export const load = async ({ parent, params }) => {
const { frameworks } = await parent();
return {
frameworks,
template: await sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.sites.getTemplate('starter-for-js')
};
};
@@ -6,7 +6,7 @@ export const load = async ({ parent, params, url }) => {
const { installations, frameworks, project, organization, consoleVariables } = await parent();
const [repository] = await Promise.all([
sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.vcs.getRepository(url.searchParams.get('installation'), params.repository)
]);
@@ -1,7 +1,7 @@
import { sdk } from '$lib/stores/sdk';
import { getSearch, getView, View } from '$lib/helpers/load';
import { getSearch } from '$lib/helpers/load';
export const load = async ({ url, route }) => {
export const load = async ({ url, params }) => {
const search = getSearch(url);
const filter = {
useCases: url.searchParams.getAll('useCase'),
@@ -9,7 +9,7 @@ export const load = async ({ url, route }) => {
};
const siteTemplatesList = await sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.sites.listTemplates(undefined, undefined, 100);
const [frameworksSet, useCasesSet] = siteTemplatesList.templates.reduce(
@@ -5,7 +5,7 @@ import { ID } from '@appwrite.io/console';
export const load = async ({ parent, params }) => {
const { installations, frameworks, project, organization, consoleVariables } = await parent();
const template = await sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.sites.getTemplate(params.template);
const domain = await buildVerboseDomain(
consoleVariables._APP_DOMAIN_SITES,
@@ -11,17 +11,17 @@ export const load = async ({ params, depends, parent }) => {
const [deploymentList, prodReadyDeployments, proxyRuleList] = await Promise.all([
sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.sites.listDeployments(params.site, [Query.limit(4), Query.orderDesc('')]),
sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.sites.listDeployments(params.site, [
Query.equal('status', 'ready'),
Query.equal('activate', true),
Query.orderDesc('')
]),
sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.proxy.listRules([
Query.equal('type', RuleType.DEPLOYMENT),
Query.equal('deploymentResourceType', DeploymentResourceType.SITE),
@@ -33,7 +33,7 @@ export const load = async ({ params, depends, parent }) => {
const deployment = deploymentList?.total
? await sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.sites.getDeployment(params.site, site.deploymentId)
: null;
return {
@@ -17,14 +17,14 @@ export const load = async ({ params, depends, url, route, parent }) => {
const [deploymentList, installations] = await Promise.all([
sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.sites.listDeployments(params.site, [
Query.limit(limit),
Query.offset(offset),
Query.orderDesc(''),
...parsedQueries.values()
]),
sdk.forProject(page.params.region, page.params.project).vcs.listInstallations()
sdk.forProject(params.region, params.project).vcs.listInstallations()
]);
return {
@@ -35,7 +35,7 @@ export const load = async ({ params, depends, url, route, parent }) => {
activeDeployment:
site.deploymentId && deploymentList?.total
? await sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.sites.getDeployment(params.site, site.deploymentId)
: null,
installations
@@ -23,7 +23,7 @@ export const load = async ({ params, depends, url, route }) => {
query,
search,
domains: await sdk
.forProject(page.params.region, page.params.project)
.forProject(params.region, params.project)
.proxy.listRules(
[
Query.or([
@@ -9,13 +9,11 @@ export const load = async ({ params, depends, parent }) => {
const [globalVariables, variables, frameworks, installations, specificationsList] =
await Promise.all([
sdk.forProject(page.params.region, page.params.project).projectApi.listVariables(),
sdk
.forProject(page.params.region, page.params.project)
.sites.listVariables(params.site),
sdk.forProject(page.params.region, page.params.project).sites.listFrameworks(),
sdk.forProject(page.params.region, page.params.project).vcs.listInstallations(),
sdk.forProject(page.params.region, page.params.project).sites.listSpecifications()
sdk.forProject(params.region, params.project).projectApi.listVariables(),
sdk.forProject(params.region, params.project).sites.listVariables(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()
]);
// Conflicting variables first