mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
feat: import from org settings
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
};
|
||||
|
||||
export const toggleCommandCenter = () => {
|
||||
console.log('toggleCommandCenter');
|
||||
if (get(subPanels).length > 0) {
|
||||
clearSubPanels();
|
||||
} else {
|
||||
|
||||
@@ -288,7 +288,6 @@ export const registerSearchers = {
|
||||
|
||||
runner((...searchers: Searcher[]) => {
|
||||
searchersMap.update((curr) => {
|
||||
console.log(curr);
|
||||
curr.set(uuid, [...searchers]);
|
||||
return curr;
|
||||
});
|
||||
@@ -296,7 +295,6 @@ export const registerSearchers = {
|
||||
|
||||
return () => {
|
||||
searchersMap.update((curr) => {
|
||||
console.log('deleting', curr, uuid);
|
||||
curr.delete(uuid);
|
||||
return curr;
|
||||
});
|
||||
|
||||
@@ -81,18 +81,15 @@
|
||||
|
||||
if (selectedIdx === 0) {
|
||||
contentEl.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth'
|
||||
top: 0
|
||||
});
|
||||
} else if (selectedIdx === resultEls.length - 1) {
|
||||
contentEl.scrollTo({
|
||||
top: contentEl.scrollHeight,
|
||||
behavior: 'smooth'
|
||||
top: contentEl.scrollHeight
|
||||
});
|
||||
} else if (selectedEl) {
|
||||
selectedEl.scrollIntoView({
|
||||
block: 'nearest',
|
||||
behavior: 'smooth'
|
||||
block: 'nearest'
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -272,10 +269,7 @@
|
||||
class:first-nested={isFirstNested(i)}
|
||||
class:last-nested={isLastNested(i)}>
|
||||
{#if isSelected}
|
||||
<div
|
||||
class="bg"
|
||||
in:send|local={{ key: 'bg' }}
|
||||
out:receive|local={{ key: 'bg' }} />
|
||||
<div class="bg" />
|
||||
{/if}
|
||||
<button
|
||||
class="option"
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
});
|
||||
|
||||
const handleInvalid = (event: Event) => {
|
||||
console.log('Invalid');
|
||||
event.preventDefault();
|
||||
|
||||
if (element.validity.valueMissing) {
|
||||
|
||||
@@ -18,17 +18,10 @@
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import { CommandCenter, registerCommands, registerSearchers } from '$lib/commandCenter';
|
||||
import {
|
||||
AIPanel,
|
||||
DatabasesPanel,
|
||||
OrganizationsPanel,
|
||||
TeamsPanel,
|
||||
UsersPanel
|
||||
} from '$lib/commandCenter/panels';
|
||||
import { AIPanel, OrganizationsPanel, ProjectsPanel } from '$lib/commandCenter/panels';
|
||||
import { orgSearcher, projectsSearcher } from '$lib/commandCenter/searchers';
|
||||
import { addSubPanel } from '$lib/commandCenter/subPanels';
|
||||
import { openMigrationWizard } from './(migration-wizard)';
|
||||
import { orgSearcher, projectsSearcher } from '$lib/commandCenter/searchers';
|
||||
import Databases from '$lib/commandCenter/panels/databases.svelte';
|
||||
|
||||
$: $registerCommands([
|
||||
{
|
||||
@@ -57,31 +50,13 @@
|
||||
keys: ['f', 'o']
|
||||
},
|
||||
{
|
||||
label: 'Find Users',
|
||||
label: 'Find a project',
|
||||
callback: () => {
|
||||
addSubPanel(UsersPanel);
|
||||
addSubPanel(ProjectsPanel);
|
||||
},
|
||||
group: 'users',
|
||||
icon: 'search',
|
||||
keys: ['f', 'u']
|
||||
},
|
||||
{
|
||||
label: 'Find Teams',
|
||||
callback: () => {
|
||||
addSubPanel(TeamsPanel);
|
||||
},
|
||||
group: 'teams',
|
||||
icon: 'search',
|
||||
keys: ['f', 't']
|
||||
},
|
||||
{
|
||||
label: 'Find Databases',
|
||||
callback: () => {
|
||||
addSubPanel(DatabasesPanel);
|
||||
},
|
||||
group: 'databases',
|
||||
icon: 'search',
|
||||
keys: ['f', 'd']
|
||||
keys: ['f', 'p'],
|
||||
group: 'projects',
|
||||
icon: 'search'
|
||||
},
|
||||
{
|
||||
label: 'Create new Organization',
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { addSubPanel, registerCommands } from '$lib/commandCenter';
|
||||
import { ProjectsPanel } from '$lib/commandCenter/panels';
|
||||
import { CardContainer, Empty, GridItem1, Heading, PaginationWithLimit } from '$lib/components';
|
||||
import { registerCommands } from '$lib/commandCenter';
|
||||
import {
|
||||
CardContainer,
|
||||
DropList,
|
||||
DropListItem,
|
||||
Empty,
|
||||
GridItem1,
|
||||
Heading,
|
||||
PaginationWithLimit
|
||||
} from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
|
||||
import { Container } from '$lib/layout';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { ID } from '@appwrite.io/console';
|
||||
import CreateOrganization from '../createOrganization.svelte';
|
||||
import type { PageData } from './$types';
|
||||
import CreateProject from './createProject.svelte';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { goto } from '$app/navigation';
|
||||
import { openImportWizard } from '../project-[project]/settings/migrations/(import)';
|
||||
import { loading } from '$routes/store';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -48,15 +61,6 @@
|
||||
}
|
||||
|
||||
$: $registerCommands([
|
||||
{
|
||||
label: 'Find a project',
|
||||
callback: () => {
|
||||
addSubPanel(ProjectsPanel);
|
||||
},
|
||||
keys: ['f'],
|
||||
group: 'projects',
|
||||
icon: 'search'
|
||||
},
|
||||
{
|
||||
label: 'Create project',
|
||||
callback: () => {
|
||||
@@ -68,14 +72,47 @@
|
||||
icon: 'plus'
|
||||
}
|
||||
]);
|
||||
|
||||
let showDropdown = false;
|
||||
|
||||
const importProject = async () => {
|
||||
try {
|
||||
loading.set(true);
|
||||
const project = await sdk.forConsole.projects.create(
|
||||
ID.unique(),
|
||||
`Imported project ${new Date().toISOString()}`,
|
||||
$page.params.organization,
|
||||
'default'
|
||||
);
|
||||
trackEvent(Submit.ProjectCreate, {
|
||||
teamId: $page.params.organization
|
||||
});
|
||||
await goto(`/console/project-${project.$id}/settings/migrations`);
|
||||
openImportWizard();
|
||||
loading.set(false);
|
||||
} catch (e) {
|
||||
trackError(e, Submit.ProjectCreate);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<div class="u-flex u-gap-12 common-section u-main-space-between">
|
||||
<Heading tag="h2" size="5">Projects</Heading>
|
||||
<Button on:click={() => (showCreate = true)} event="create_project">
|
||||
<span class="icon-plus" aria-hidden="true" /> <span class="text">Create project</span>
|
||||
</Button>
|
||||
<DropList bind:show={showDropdown} placement="bottom-end">
|
||||
<Button on:click={() => (showDropdown = true)} event="create_project">
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Create project</span>
|
||||
</Button>
|
||||
<svelte:fragment slot="list">
|
||||
<DropListItem on:click={() => (showCreate = true)}>Empty project</DropListItem>
|
||||
<DropListItem on:click={importProject}>
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
Import project <span class="tag eyebrow-heading-3">Experimental</span>
|
||||
</div>
|
||||
</DropListItem>
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
</div>
|
||||
|
||||
{#if data.projects.total}
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
import { project, stats } from './store';
|
||||
|
||||
import { goto } from '$app/navigation';
|
||||
import { registerCommands, registerSearchers } from '$lib/commandCenter';
|
||||
import { addSubPanel, registerCommands, registerSearchers } from '$lib/commandCenter';
|
||||
|
||||
import { dbSearcher, userSearcher } from '$lib/commandCenter/searchers';
|
||||
import { MigrationBox } from '$lib/components';
|
||||
import { UsersPanel, TeamsPanel, DatabasesPanel } from '$lib/commandCenter/panels';
|
||||
|
||||
onMount(async () => {
|
||||
return sdk.forConsole.client.subscribe(['project', 'console'], (response) => {
|
||||
@@ -69,6 +70,33 @@
|
||||
},
|
||||
keys: ['p'],
|
||||
group: 'navigation'
|
||||
},
|
||||
{
|
||||
label: 'Find Users',
|
||||
callback: () => {
|
||||
addSubPanel(UsersPanel);
|
||||
},
|
||||
group: 'users',
|
||||
icon: 'search',
|
||||
keys: ['f', 'u']
|
||||
},
|
||||
{
|
||||
label: 'Find Teams',
|
||||
callback: () => {
|
||||
addSubPanel(TeamsPanel);
|
||||
},
|
||||
group: 'teams',
|
||||
icon: 'search',
|
||||
keys: ['f', 't']
|
||||
},
|
||||
{
|
||||
label: 'Find Databases',
|
||||
callback: () => {
|
||||
addSubPanel(DatabasesPanel);
|
||||
},
|
||||
group: 'databases',
|
||||
icon: 'search',
|
||||
keys: ['f', 'd']
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
const onFinish = async () => {
|
||||
const resources = migrationFormToResources($formData);
|
||||
console.log('resources', resources);
|
||||
return;
|
||||
|
||||
switch ($provider.provider) {
|
||||
case 'appwrite': {
|
||||
const res = await sdk.forProject.migrations.migrateAppwrite(
|
||||
|
||||
Reference in New Issue
Block a user