mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
feat: more methods!
This commit is contained in:
+1
-1
@@ -19,7 +19,7 @@
|
||||
"e2e:ui": "playwright test tests/e2e --ui"
|
||||
},
|
||||
"dependencies": {
|
||||
"@appwrite.io/console": "npm:khushboo-console@^0.0.5",
|
||||
"@appwrite.io/console": "npm:khushboo-console@^0.0.6",
|
||||
"@appwrite.io/pink": "0.25.0",
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "1.0.0-next.7",
|
||||
|
||||
Generated
+5
-5
@@ -9,8 +9,8 @@ importers:
|
||||
.:
|
||||
dependencies:
|
||||
'@appwrite.io/console':
|
||||
specifier: npm:khushboo-console@^0.0.5
|
||||
version: khushboo-console@0.0.5
|
||||
specifier: npm:khushboo-console@^0.0.6
|
||||
version: khushboo-console@0.0.6
|
||||
'@appwrite.io/pink':
|
||||
specifier: 0.25.0
|
||||
version: 0.25.0
|
||||
@@ -2527,8 +2527,8 @@ packages:
|
||||
keyv@4.5.4:
|
||||
resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
|
||||
|
||||
khushboo-console@0.0.5:
|
||||
resolution: {integrity: sha512-d5lSA5KiEG/bd7VJELVrCO1BKMn5oikxTxRPCM5LJlj9LU13iiQZ/GSjlVVE1cv7DVXHWGw4TZIraqd5BsCKMg==}
|
||||
khushboo-console@0.0.6:
|
||||
resolution: {integrity: sha512-fu2lcV19LeXiPxnOIE/Carxtaf8m0nEZAxJpmT56KtuOsDoRlmn+BLMkNqEk5Ijr9/oq8E7cXFoOQFmJLG0OJg==}
|
||||
|
||||
kleur@3.0.3:
|
||||
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
|
||||
@@ -6764,7 +6764,7 @@ snapshots:
|
||||
dependencies:
|
||||
json-buffer: 3.0.1
|
||||
|
||||
khushboo-console@0.0.5: {}
|
||||
khushboo-console@0.0.6: {}
|
||||
|
||||
kleur@3.0.3: {}
|
||||
|
||||
|
||||
@@ -323,5 +323,16 @@ export enum Submit {
|
||||
MessagingTopicSubscriberDelete = 'submit_messaging_topic_subscriber_delete',
|
||||
ApplyQuickFilter = 'submit_apply_quick_filter',
|
||||
RequestBAA = 'submit_request_baa',
|
||||
RequestSoc2 = 'submit_request_soc2'
|
||||
RequestSoc2 = 'submit_request_soc2',
|
||||
SiteCreate = 'submit_site_create',
|
||||
SiteDelete = 'submit_site_delete',
|
||||
SiteUpdateName = 'submit_site_update_name',
|
||||
SiteUpdatePermissions = 'submit_site_update_permissions',
|
||||
SiteUpdateSchedule = 'submit_site_update_schedule',
|
||||
SiteUpdateConfiguration = 'submit_site_update_configuration',
|
||||
SiteUpdateLogging = 'submit_site_update_logging',
|
||||
SiteUpdateTimeout = 'submit_site_update_timeout',
|
||||
SiteUpdateEvents = 'submit_site_update_events',
|
||||
SiteUpdateScopes = 'submit_site_key_update_scopes',
|
||||
SiteConnectRepo = 'submit_site_connect_repo'
|
||||
}
|
||||
|
||||
+34
-11
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { afterNavigate, goto, invalidate, preloadData } from '$app/navigation';
|
||||
import { goto, invalidate, preloadData } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
@@ -32,14 +32,10 @@
|
||||
import ProductionBranch from './productionBranch.svelte';
|
||||
import Configuration from './configuration.svelte';
|
||||
import Aside from './aside.svelte';
|
||||
import { ID } from '@appwrite.io/console';
|
||||
|
||||
export let data;
|
||||
|
||||
let previousPage: string = base;
|
||||
|
||||
afterNavigate(({ from }) => {
|
||||
previousPage = from?.url?.pathname || previousPage;
|
||||
});
|
||||
let showExitModal = false;
|
||||
let isTemplate = !!data?.template;
|
||||
let hasInstallations = !!data?.installations?.total;
|
||||
@@ -48,7 +44,7 @@
|
||||
let isSubmitting = writable(false);
|
||||
|
||||
let name = data?.template?.name ?? '';
|
||||
let id = data?.template?.$id ?? '';
|
||||
let id = '';
|
||||
let framework = data?.template?.frameworks[0] ?? '';
|
||||
let branch: string;
|
||||
let rootDir = '';
|
||||
@@ -60,6 +56,9 @@
|
||||
let selectedRepository = '';
|
||||
let showSiteConfig = false;
|
||||
let variables = [];
|
||||
let installCommand = '';
|
||||
let buildCommand = '';
|
||||
let outputDirectory = '';
|
||||
|
||||
onMount(() => {
|
||||
if (isTemplate) {
|
||||
@@ -103,9 +102,24 @@
|
||||
|
||||
async function create() {
|
||||
try {
|
||||
let site;
|
||||
let site = await sdk.forProject.sites.create(
|
||||
id || ID.unique(),
|
||||
name,
|
||||
framework,
|
||||
true,
|
||||
installCommand,
|
||||
buildCommand,
|
||||
outputDirectory,
|
||||
undefined,
|
||||
undefined,
|
||||
selectedInstallationId,
|
||||
selectedRepository,
|
||||
branch,
|
||||
undefined,
|
||||
rootDir
|
||||
);
|
||||
|
||||
trackEvent(Submit.OrganizationCreate, {});
|
||||
trackEvent(Submit.SiteCreate, {});
|
||||
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
await preloadData(`${base}/project-${$page.params.project}/sites/site-${site.$id}`);
|
||||
@@ -119,7 +133,7 @@
|
||||
type: 'error',
|
||||
message: e.message
|
||||
});
|
||||
trackError(e, Submit.OrganizationCreate);
|
||||
trackError(e, Submit.SiteCreate);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -128,7 +142,10 @@
|
||||
<title>Create site - Appwrite</title>
|
||||
</svelte:head>
|
||||
|
||||
<WizardSecondaryContainer bind:showExitModal href={previousPage} confirmExit>
|
||||
<WizardSecondaryContainer
|
||||
bind:showExitModal
|
||||
href={`${base}/project-${$page.params.project}/sites/`}
|
||||
confirmExit>
|
||||
<svelte:fragment slot="title">Create site</svelte:fragment>
|
||||
<WizardSecondaryContent>
|
||||
<Form bind:this={formComponent} onSubmit={create} bind:isSubmitting>
|
||||
@@ -158,6 +175,9 @@
|
||||
</Card>
|
||||
<ProductionBranch bind:branch bind:rootDir />
|
||||
<Configuration
|
||||
bind:installCommand
|
||||
bind:buildCommand
|
||||
bind:outputDirectory
|
||||
{framework}
|
||||
source="template"
|
||||
bind:variables
|
||||
@@ -268,6 +288,9 @@
|
||||
{/if}
|
||||
{:else}
|
||||
<Configuration
|
||||
bind:installCommand
|
||||
bind:buildCommand
|
||||
bind:outputDirectory
|
||||
{framework}
|
||||
source="template"
|
||||
bind:variables
|
||||
|
||||
@@ -23,7 +23,7 @@ const mockTeplate: {
|
||||
} = {
|
||||
preview: 'https://unsplash.it/300/200',
|
||||
name: 'Template 1',
|
||||
frameworks: ['react', 'vue', 'angular'],
|
||||
frameworks: ['sveltekit', 'nextje'],
|
||||
$id: '1',
|
||||
variables: [
|
||||
{
|
||||
|
||||
+3
-4
@@ -57,6 +57,9 @@
|
||||
export let framework = FRAMEWORKS_AVAILABLE[0].id;
|
||||
export let variables = [];
|
||||
export let templateVariables: Models.TemplateVariable[];
|
||||
export let installCommand = '';
|
||||
export let buildCommand = '';
|
||||
export let outputDirectory = '';
|
||||
|
||||
let { requiredVariables, optionalVariables } = templateVariables.reduce(
|
||||
(acc, variable) => {
|
||||
@@ -70,10 +73,6 @@
|
||||
{ requiredVariables: [], optionalVariables: [] }
|
||||
);
|
||||
|
||||
let installCommand = '';
|
||||
let buildCommand = '';
|
||||
let outputDirectory = '';
|
||||
|
||||
function selectComponent(variableType: string): typeof SvelteComponent<unknown> {
|
||||
switch (variableType) {
|
||||
case 'password':
|
||||
|
||||
@@ -14,11 +14,7 @@ export const load = async ({ url, route }) => {
|
||||
frameworks: url.searchParams.getAll('framework')
|
||||
};
|
||||
|
||||
const siteTemplatesList = await sdk.forProject.sites.listSiteTemplates(
|
||||
undefined,
|
||||
undefined,
|
||||
100
|
||||
);
|
||||
const siteTemplatesList = await sdk.forProject.sites.listTemplates(undefined, undefined, 100);
|
||||
|
||||
console.log(siteTemplatesList);
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
|
||||
export const load = async ({ params }) => {
|
||||
depends(Dependencies.SITE);
|
||||
|
||||
|
||||
const site =
|
||||
|
||||
return {
|
||||
site : await sdk.forProject.sites.get([
|
||||
|
||||
]);
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user