mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
54 files changed
+8137
-1880
No files matched your search
Generated
+7249
-1361
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,20 @@
|
||||
import type { Action } from 'svelte/action';
|
||||
|
||||
export type MultiActionArray = Array<(node: HTMLElement) => ReturnType<Action>>;
|
||||
|
||||
export function multiAction(node: HTMLElement, arr: MultiActionArray) {
|
||||
const destroyFns = arr.map((fn) => {
|
||||
const actionReturn = fn(node);
|
||||
|
||||
return actionReturn
|
||||
? actionReturn.destroy
|
||||
: () => {
|
||||
/* noop */
|
||||
};
|
||||
});
|
||||
return {
|
||||
destroy() {
|
||||
destroyFns.forEach((fn) => fn());
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -33,6 +33,9 @@
|
||||
import { commandCenterKeyDownHandler, disableCommands, registerCommands } from './commands';
|
||||
import { RootPanel } from './panels';
|
||||
import { addSubPanel, clearSubPanels, subPanels } from './subPanels';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
|
||||
let debugOverlayEnabled = false;
|
||||
|
||||
$: $registerCommands([
|
||||
{
|
||||
@@ -40,6 +43,20 @@
|
||||
keys: ['k'],
|
||||
ctrl: true,
|
||||
forceEnable: true
|
||||
},
|
||||
{
|
||||
label: 'Toggle debug overlay',
|
||||
callback: () => {
|
||||
debugOverlayEnabled = !debugOverlayEnabled;
|
||||
addNotification({
|
||||
title: 'Debug overlay',
|
||||
message: debugOverlayEnabled ? 'Enabled' : 'Disabled',
|
||||
type: 'info'
|
||||
});
|
||||
},
|
||||
keys: ['d', 'o'],
|
||||
group: 'misc',
|
||||
disabled: !dev
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -100,7 +117,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if dev}
|
||||
{#if dev && debugOverlayEnabled}
|
||||
<div class="debug-keys" use:portal>
|
||||
{#each keys as key, i (i)}
|
||||
<kbd class="kbd" transition:fade|local={{ duration: 150 }}>
|
||||
@@ -126,7 +143,6 @@
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
padding: 0.5rem;
|
||||
// background-color: hsl(var(--color-neutral-500) / 0.5);
|
||||
z-index: 9999;
|
||||
|
||||
display: flex;
|
||||
|
||||
@@ -57,8 +57,8 @@ type KeyedCommand = BaseCommand & {
|
||||
alt?: boolean;
|
||||
};
|
||||
|
||||
function isKeyedCommand(command: Command): command is KeyedCommand {
|
||||
return 'keys' in command;
|
||||
export function isKeyedCommand(command: Command): command is KeyedCommand {
|
||||
return 'keys' in command && Array.isArray((command as KeyedCommand).keys);
|
||||
}
|
||||
|
||||
export type Command = KeyedCommand | BaseCommand;
|
||||
@@ -83,7 +83,7 @@ function isInputEvent(event: KeyboardEvent) {
|
||||
function getCommandRank(command: KeyedCommand) {
|
||||
const { keys, ctrl: meta, shift, alt } = command;
|
||||
const modifiers = [meta, shift, alt].filter(Boolean).length;
|
||||
return keys.length + modifiers * 10;
|
||||
return (keys?.length || 0) + modifiers * 10;
|
||||
}
|
||||
|
||||
function hasDisputing(command: KeyedCommand, allCommands: Command[]) {
|
||||
@@ -95,7 +95,7 @@ function hasDisputing(command: KeyedCommand, allCommands: Command[]) {
|
||||
return false;
|
||||
}
|
||||
const keysString = command.keys.join('+');
|
||||
const otherKeysString = otherCommand.keys.join('+');
|
||||
const otherKeysString = otherCommand?.keys?.join('+');
|
||||
|
||||
const cmdRank = getCommandRank(command);
|
||||
const otherCmdRank = getCommandRank(otherCommand);
|
||||
@@ -195,8 +195,10 @@ export const commandCenterKeyDownHandler = derived(
|
||||
const isShiftPressed = shift ? event.shiftKey : !event.shiftKey;
|
||||
const isAltPressed = alt ? event.altKey : !event.altKey;
|
||||
|
||||
const commandKeyCodes = keys.map((key) => key.toUpperCase().charCodeAt(0));
|
||||
const allKeysPressed = recentKeyCodes.join('').includes(commandKeyCodes.join(''));
|
||||
const commandKeyCodes = keys?.map((key) => key.toUpperCase().charCodeAt(0));
|
||||
const allKeysPressed = commandKeyCodes
|
||||
? recentKeyCodes.join('').includes(commandKeyCodes.join(''))
|
||||
: false;
|
||||
|
||||
if (allKeysPressed && isMetaPressed && isShiftPressed && isAltPressed) {
|
||||
event.preventDefault();
|
||||
@@ -288,10 +290,12 @@ export const commandGroupRanks = derived(groupRanksMap, ($groupRankTransformatio
|
||||
const initialRanks = {
|
||||
...Object.fromEntries(groups.map((group) => [group, 0])),
|
||||
ungrouped: 9999,
|
||||
databases: 3,
|
||||
users: 2,
|
||||
teams: 1,
|
||||
navigation: -10,
|
||||
databases: 50,
|
||||
users: 40,
|
||||
teams: 30,
|
||||
projects: 20,
|
||||
organizations: 10,
|
||||
navigation: 0,
|
||||
help: -20,
|
||||
misc: -30
|
||||
} as CommandGroupRanks;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<script lang="ts">
|
||||
import Template from './template.svelte';
|
||||
|
||||
import { AvatarInitials, Code } from '$lib/components';
|
||||
import { AvatarInitials, Code, LoadingDots, SvgIcon } from '$lib/components';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { useCompletion } from 'ai/svelte';
|
||||
import { subPanels } from '../subPanels';
|
||||
|
||||
import { isLanguage, type Language } from '$lib/components/code.svelte';
|
||||
import CoolerAppwrite from '$lib/images/appwrite-cooler.svg';
|
||||
import { VARS } from '$lib/system';
|
||||
|
||||
const endpoint = VARS.APPWRITE_ENDPOINT ?? `${globalThis?.location?.origin}/v1`;
|
||||
@@ -62,7 +61,9 @@
|
||||
|
||||
answer.push({
|
||||
type: 'code',
|
||||
value: nextCodeMatch[2],
|
||||
value: nextCodeMatch[2].startsWith('\n')
|
||||
? nextCodeMatch[2].slice(1)
|
||||
: nextCodeMatch[2],
|
||||
language: isLanguage(language) ? language : 'js'
|
||||
});
|
||||
|
||||
@@ -82,6 +83,11 @@
|
||||
}
|
||||
|
||||
$: answer = parseCompletion($completion);
|
||||
|
||||
function getInitials(name: string) {
|
||||
const [first, last] = name.split(' ');
|
||||
return `${first?.[0] ?? ''}${last?.[0] ?? ''}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<Template
|
||||
@@ -98,9 +104,14 @@
|
||||
};
|
||||
})}
|
||||
clearOnCallback={false}
|
||||
fullheight
|
||||
--command-panel-max-height="40rem">
|
||||
<div slot="search" />
|
||||
on:keydown={(e) => {
|
||||
e.detail.cancel();
|
||||
}}
|
||||
--min-height="40rem"
|
||||
--max-height="52.5rem">
|
||||
<div slot="search">
|
||||
<span class="experimental border-gradient">EXPERIMENTAL</span>
|
||||
</div>
|
||||
|
||||
<div slot="option" let:option class="u-flex u-cross-center u-gap-8">
|
||||
<i class="icon-question-mark-circle" />
|
||||
@@ -109,20 +120,28 @@
|
||||
|
||||
{#if $isLoading || answer}
|
||||
<div class="content">
|
||||
<div class="u-flex u-gap-8">
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<div class="avatar is-size-x-small">{getInitials($user.name)}</div>
|
||||
<p class="u-opacity-75">{$input}</p>
|
||||
</div>
|
||||
<div class="u-flex u-gap-8 u-margin-block-start-24">
|
||||
<div class="logo">
|
||||
<img src={CoolerAppwrite} alt="Appwrite logo" />
|
||||
<SvgIcon name="sparkles" type="color" />
|
||||
</div>
|
||||
<div class="answer">
|
||||
{#if $isLoading && !$completion}
|
||||
<p>...</p>
|
||||
<LoadingDots />
|
||||
{:else}
|
||||
{#each answer as part}
|
||||
{#if part.type === 'text'}
|
||||
<p>{part.value}</p>
|
||||
<p>{part.value.trimStart()}</p>
|
||||
{:else if part.type === 'code'}
|
||||
{#key part.value}
|
||||
<Code language={part.language} code={part.value} />
|
||||
<div
|
||||
class="u-margin-block-start-8"
|
||||
style="margin-block-end: 1rem;">
|
||||
<Code language={part.language} code={part.value} noMargin />
|
||||
</div>
|
||||
{/key}
|
||||
{/if}
|
||||
{/each}
|
||||
@@ -174,8 +193,16 @@
|
||||
</Template>
|
||||
|
||||
<style lang="scss">
|
||||
:global(.theme-dark) .content {
|
||||
--logo-bg: #282a3b;
|
||||
}
|
||||
|
||||
:global(.theme-light) .content {
|
||||
--logo-bg: #f2f2f8;
|
||||
}
|
||||
|
||||
.content {
|
||||
overflow-y: auto;
|
||||
overflow: auto;
|
||||
padding: 1rem;
|
||||
|
||||
.logo {
|
||||
@@ -187,7 +214,7 @@
|
||||
flex-shrink: 0;
|
||||
|
||||
border-radius: 0.25rem;
|
||||
background: #282a3b;
|
||||
background: var(--logo-bg);
|
||||
}
|
||||
|
||||
.answer {
|
||||
@@ -197,29 +224,6 @@
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: hsl(var(--color-neutral-70));
|
||||
}
|
||||
|
||||
.examples {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
li {
|
||||
padding: 0.59375rem 0.5rem;
|
||||
|
||||
button {
|
||||
&:hover {
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
i {
|
||||
color: hsl(var(--color-neutral-70));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
@@ -229,4 +233,35 @@
|
||||
background-color: hsl(var(--color-neutral-150));
|
||||
}
|
||||
}
|
||||
|
||||
.experimental {
|
||||
display: flex;
|
||||
padding: 0.09375rem 0.25rem;
|
||||
align-items: center;
|
||||
|
||||
color: var(--light-neutrals-30, #e8e9f0);
|
||||
text-align: center;
|
||||
font-family: Inter;
|
||||
font-size: 0.625rem;
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
line-height: 150%; /* 0.9375rem */
|
||||
letter-spacing: 0.075rem;
|
||||
text-transform: uppercase;
|
||||
|
||||
background: rgba(240, 46, 101, 0.24);
|
||||
--border-gradient: linear-gradient(
|
||||
to bottom,
|
||||
rgba(240, 46, 101, 0.48) 0%,
|
||||
rgba(240, 46, 101, 0) 150%
|
||||
)
|
||||
border-box;
|
||||
--border-size: 0.03rem;
|
||||
--border-radius: 0.25rem;
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
|
||||
:global(.theme-light) .experimental {
|
||||
color: rgba(240, 46, 101, 1);
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@
|
||||
<script lang="ts">
|
||||
import { debounce } from '$lib/helpers/debounce';
|
||||
import { isMac } from '$lib/helpers/platform';
|
||||
import { commands, searchers, type Command } from '../commands';
|
||||
import { commands, searchers, type Command, isKeyedCommand } from '../commands';
|
||||
import Template from './template.svelte';
|
||||
|
||||
let search = '';
|
||||
@@ -69,7 +69,7 @@
|
||||
{#if hasAlt(command)}
|
||||
<kbd class="kbd"> {isMac() ? '⌥' : 'Alt'} </kbd>
|
||||
{/if}
|
||||
{#if 'keys' in command}
|
||||
{#if isKeyedCommand(command)}
|
||||
{#each command.keys as key, i}
|
||||
{@const hasNext = command.keys.length - 1 !== i}
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
// This is the template for all panels used in the command center.
|
||||
// Use this component when you want to create a new panel.
|
||||
|
||||
import { tick } from 'svelte';
|
||||
import { createEventDispatcher, tick } from 'svelte';
|
||||
|
||||
import { getCommandCenterCtx } from '../commandCenter.svelte';
|
||||
|
||||
import { clearSubPanels, popSubPanel, subPanels } from '../subPanels';
|
||||
|
||||
type Option = $$Generic<Command>;
|
||||
type Option = $$Generic<Omit<Command, 'group'> & { group?: string }>;
|
||||
export let options: Option[] | null = null;
|
||||
export let search = '';
|
||||
export let searchPlaceholder = 'Search...';
|
||||
@@ -18,6 +18,7 @@
|
||||
export let clearOnCallback = true;
|
||||
|
||||
let selected = 0;
|
||||
let usingKeyboard = false;
|
||||
let contentEl: HTMLElement;
|
||||
|
||||
async function triggerOption(option: Option) {
|
||||
@@ -28,8 +29,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
const dispatch = createEventDispatcher<{
|
||||
keydown: {
|
||||
originalEvent: KeyboardEvent;
|
||||
cancel: () => void;
|
||||
key: string;
|
||||
};
|
||||
}>();
|
||||
|
||||
function handleKeyDown(event: KeyboardEvent) {
|
||||
if (!open) return;
|
||||
usingKeyboard = true;
|
||||
|
||||
let canceled = false;
|
||||
dispatch('keydown', {
|
||||
originalEvent: event,
|
||||
cancel: () => (canceled = true),
|
||||
key: event.key
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
if (options) {
|
||||
if (event.key === 'ArrowDown') {
|
||||
@@ -90,8 +108,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
$: {
|
||||
options;
|
||||
$: if (selected > options?.length - 1) {
|
||||
selected = options?.length - 1;
|
||||
} else if (usingKeyboard && selected < 0 && options?.length) {
|
||||
selected = 0;
|
||||
}
|
||||
|
||||
@@ -173,13 +192,30 @@
|
||||
triggerOption(option);
|
||||
};
|
||||
|
||||
const getOptionFocusHandler = (option: IndexedOption) => () => {
|
||||
selected = option.index;
|
||||
const getOptionFocusHandler =
|
||||
(option: IndexedOption, hover = false) =>
|
||||
() => {
|
||||
selected = option.index;
|
||||
usingKeyboard = hover ? false : usingKeyboard;
|
||||
};
|
||||
|
||||
const getOptionBlurHandler = () => () => {
|
||||
selected = -1;
|
||||
usingKeyboard = false;
|
||||
};
|
||||
|
||||
const castOption = (option: IndexedOption) => option as Option;
|
||||
|
||||
$: breadcrumbs = $subPanels.filter((panel) => panel.name !== 'root').map((panel) => panel.name);
|
||||
function getBreadcrumbs(subPanels: typeof $subPanels) {
|
||||
return subPanels.filter((panel) => panel.name !== 'root').map((panel) => panel.name);
|
||||
}
|
||||
|
||||
let breadcrumbs = getBreadcrumbs($subPanels);
|
||||
|
||||
// Avoid clearing subpanels before the closing transition is finished
|
||||
$: if ($subPanels.length) {
|
||||
breadcrumbs = getBreadcrumbs($subPanels);
|
||||
}
|
||||
|
||||
const handleCrumbClick = (index: number) => {
|
||||
if (index === breadcrumbs.length - 1) {
|
||||
@@ -262,7 +298,8 @@
|
||||
<button
|
||||
class="option"
|
||||
on:click={getOptionClickHandler(item)}
|
||||
on:mouseover={getOptionFocusHandler(item)}
|
||||
on:mouseover={getOptionFocusHandler(item, true)}
|
||||
on:mouseleave={getOptionBlurHandler()}
|
||||
on:focus={getOptionFocusHandler(item)}>
|
||||
<slot name="option" option={castOption(item)}>
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
@@ -350,6 +387,9 @@
|
||||
|
||||
--result-bg: hsl(var(--color-neutral-10));
|
||||
--footer-bg: linear-gradient(180deg, #fff 0%, #e8e9f0 100%);
|
||||
|
||||
--icon-color: hsl(var(--color-neutral-50));
|
||||
--label-color: hsl(var(--color-neutral-100));
|
||||
}
|
||||
|
||||
:global(.theme-dark) .card {
|
||||
@@ -364,15 +404,19 @@
|
||||
|
||||
--result-bg: hsl(var(--color-neutral-200));
|
||||
--footer-bg: linear-gradient(180deg, #1b1b28 0%, #282a3b 100%);
|
||||
|
||||
--icon-color: hsl(var(--color-neutral-70));
|
||||
--label-color: hsl(var(--color-neutral-30));
|
||||
}
|
||||
|
||||
// Elements
|
||||
.card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: var(--command-panel-width, 42.5rem);
|
||||
width: var(--width, 42.5rem);
|
||||
max-width: 100%;
|
||||
max-height: var(--command-panel-max-height, 32rem);
|
||||
min-height: var(--min-height);
|
||||
max-height: var(--max-height, 32rem);
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
|
||||
@@ -388,7 +432,7 @@
|
||||
backdrop-filter: blur(6px);
|
||||
|
||||
&.fullheight {
|
||||
height: var(--command-panel-max-height, 32rem);
|
||||
height: var(--max-height, 32rem);
|
||||
}
|
||||
|
||||
:global(.kbd) {
|
||||
@@ -458,6 +502,8 @@
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
|
||||
font-size: 10px !important;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-block-start: 1rem;
|
||||
}
|
||||
@@ -470,17 +516,35 @@
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-color: var(--result-bg);
|
||||
border-radius: 0.75rem;
|
||||
border-radius: 0.5rem;
|
||||
translate: 0 -1px;
|
||||
}
|
||||
|
||||
.option {
|
||||
padding: 0.5rem 0.75rem;
|
||||
padding: 0.5rem 9.5px;
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
width: 100%;
|
||||
|
||||
box-shadow: none !important;
|
||||
|
||||
color: var(--label-color);
|
||||
|
||||
:global(i[class^='icon-']) {
|
||||
font-size: 1rem !important;
|
||||
width: 1rem !important;
|
||||
height: 1rem !important;
|
||||
color: var(--icon-color);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
:global(i[class^='icon-']::before) {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
translate: -50% -50%;
|
||||
}
|
||||
}
|
||||
|
||||
&.nested {
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
export let name: string;
|
||||
export let size: number;
|
||||
export let background: string | undefined = undefined;
|
||||
|
||||
$: src = sdk.forConsole.avatars.getInitials(name, size * 2, size * 2).toString();
|
||||
$: src = sdk.forConsole.avatars.getInitials(name, size * 2, size * 2, background).toString();
|
||||
</script>
|
||||
|
||||
<Avatar {name} {size} {src} />
|
||||
@@ -29,6 +29,7 @@
|
||||
export let withLineNumbers = false;
|
||||
export let withCopy = false;
|
||||
export let noMargin = false;
|
||||
export let allowScroll = false;
|
||||
|
||||
Prism.plugins.customClass.prefix('prism-');
|
||||
|
||||
@@ -56,8 +57,10 @@
|
||||
</Copy>
|
||||
{/if}
|
||||
</div>
|
||||
<pre class={`language-${language}`} class:line-numbers={withLineNumbers}><code
|
||||
>{code}</code></pre>
|
||||
<pre
|
||||
class:with-scroll={allowScroll}
|
||||
class={`language-${language}`}
|
||||
class:line-numbers={withLineNumbers}><code>{code}</code></pre>
|
||||
</section>
|
||||
|
||||
<style lang="scss" global>
|
||||
@@ -76,6 +79,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
.with-scroll {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
code,
|
||||
pre {
|
||||
&[class*='language-'] {
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
border-radius: 0.5rem;
|
||||
padding: 0.75rem 1rem;
|
||||
|
||||
width: clamp(0px, calc(100vw - 4rem), 32.5rem);
|
||||
}
|
||||
|
||||
:global(.theme-dark) .floating-action-bar {
|
||||
|
||||
@@ -59,3 +59,4 @@ export { default as EyebrowHeading } from './eyebrowHeading.svelte';
|
||||
export { default as SvgIcon } from './svgIcon.svelte';
|
||||
export { default as MigrationBox } from './migrationBox.svelte';
|
||||
export { default as FloatingActionBar } from './floatingActionBar.svelte';
|
||||
export { default as LoadingDots } from './loadingDots.svelte';
|
||||
@@ -0,0 +1,56 @@
|
||||
<!-- Loading dots -->
|
||||
<script>
|
||||
let className = '';
|
||||
export { className as class };
|
||||
</script>
|
||||
|
||||
<div class="loading-dots {className}">
|
||||
<div class="dot" />
|
||||
<div class="dot" />
|
||||
<div class="dot" />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.loading-dots {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
gap: 0.25rem;
|
||||
padding-inline: 0.5rem;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 0.25rem;
|
||||
height: 0.25rem;
|
||||
border-radius: 50%;
|
||||
background-color: hsl(var(--p-body-text-color));
|
||||
animation: loading-dots 1s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.dot:nth-child(1) {
|
||||
animation-delay: 0.1s;
|
||||
}
|
||||
|
||||
.dot:nth-child(2) {
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
|
||||
.dot:nth-child(3) {
|
||||
animation-delay: 0.3s;
|
||||
}
|
||||
|
||||
@keyframes loading-dots {
|
||||
0% {
|
||||
transform: translateY(0.25rem);
|
||||
}
|
||||
25% {
|
||||
transform: translateY(0rem);
|
||||
}
|
||||
50%,
|
||||
100% {
|
||||
transform: translateY(0.25rem);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -3,6 +3,7 @@
|
||||
import { getContext, hasContext } from 'svelte';
|
||||
import { readable } from 'svelte/store';
|
||||
import type { FormContext } from './form.svelte';
|
||||
import { multiAction, type MultiActionArray } from '$lib/actions/multi-actions';
|
||||
|
||||
export let submit = false;
|
||||
export let secondary = false;
|
||||
@@ -19,6 +20,7 @@
|
||||
export let event: string = null;
|
||||
let classes: string = undefined;
|
||||
export { classes as class };
|
||||
export let actions: MultiActionArray = [];
|
||||
|
||||
const isSubmitting = hasContext('form')
|
||||
? getContext<FormContext>('form').isSubmitting
|
||||
@@ -59,7 +61,8 @@
|
||||
target={external ? '_blank' : ''}
|
||||
rel={external ? 'noopener noreferrer' : ''}
|
||||
class={resolvedClasses}
|
||||
aria-label={ariaLabel}>
|
||||
aria-label={ariaLabel}
|
||||
use:multiAction={actions}>
|
||||
<slot />
|
||||
</a>
|
||||
{:else}
|
||||
@@ -69,7 +72,8 @@
|
||||
disabled={internalDisabled}
|
||||
class={resolvedClasses}
|
||||
aria-label={ariaLabel}
|
||||
type={submit === false ? 'button' : undefined}>
|
||||
type={submit === false ? 'button' : undefined}
|
||||
use:multiAction={actions}>
|
||||
<slot />
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
export let required = false;
|
||||
export let disabled = false;
|
||||
|
||||
let element: HTMLInputElement;
|
||||
export let element: HTMLInputElement | undefined = undefined;
|
||||
let error: string;
|
||||
|
||||
const handleInvalid = (event: Event) => {
|
||||
|
||||
@@ -40,25 +40,24 @@
|
||||
on:invalid={handleInvalid} />
|
||||
|
||||
<div class="choice-item-content">
|
||||
<div class="u-flex u-cross-center u-gap-4">
|
||||
<h6 class:u-hide={!showLabel} class="choice-item-title">
|
||||
{label}
|
||||
</h6>
|
||||
{#if tooltip}
|
||||
<button class="tooltip" aria-label="variables info">
|
||||
<span
|
||||
class="icon-info"
|
||||
aria-hidden="true"
|
||||
style="font-size: var(--icon-size-small)" />
|
||||
<span class="tooltip-popup" role="tooltip">
|
||||
<p class="text">
|
||||
{tooltip}
|
||||
</p>
|
||||
</span>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
{#if $$slots}
|
||||
<h6 class:u-hide={!showLabel} class="choice-item-title">
|
||||
{label}
|
||||
</h6>
|
||||
{#if tooltip}
|
||||
<button class="tooltip" aria-label="variables info">
|
||||
<span
|
||||
class="icon-info"
|
||||
aria-hidden="true"
|
||||
style="font-size: var(--icon-size-small)" />
|
||||
<span class="tooltip-popup" role="tooltip">
|
||||
<p class="text">
|
||||
{tooltip}
|
||||
</p>
|
||||
</span>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $$slots.default}
|
||||
<p class="choice-item-paragraph"><slot /></p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<div
|
||||
style={width ? `--p-col-width:${width?.toString()}` : ''}
|
||||
class="table-col"
|
||||
class="table-col u-position-relative"
|
||||
class:u-overflow-visible={showOverflow}
|
||||
class:is-only-desktop={onlyDesktop}
|
||||
data-title={title}
|
||||
|
||||
@@ -6,24 +6,35 @@
|
||||
|
||||
export let id: string;
|
||||
export let selectedIds: string[] = [];
|
||||
let el: HTMLInputElement;
|
||||
|
||||
const handleClick = (e: Event) => {
|
||||
// Prevent the link from being followed
|
||||
e.preventDefault();
|
||||
if (!isHTMLInputElement(el)) return;
|
||||
|
||||
selectedIds = toggle(selectedIds, id);
|
||||
|
||||
// Hack to make sure the checkbox is checked, independent of the
|
||||
// preventDefault() call above
|
||||
window.setTimeout(() => {
|
||||
el.checked = selectedIds.includes(id);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<TableCell>
|
||||
<div class="touch-area" on:click={handleClick} on:keypress={handleClick} />
|
||||
<InputCheckbox
|
||||
bind:element={el}
|
||||
id="select-{id}"
|
||||
value={selectedIds.includes(id)}
|
||||
on:click={(e) => {
|
||||
// Prevent the link from being followed
|
||||
e.preventDefault();
|
||||
const el = e.currentTarget;
|
||||
if (!isHTMLInputElement(el)) return;
|
||||
|
||||
selectedIds = toggle(selectedIds, id);
|
||||
|
||||
// Hack to make sure the checkbox is checked, independent of the
|
||||
// preventDefault() call above
|
||||
window.setTimeout(() => {
|
||||
el.checked = selectedIds.includes(id);
|
||||
});
|
||||
}} />
|
||||
on:click={handleClick} />
|
||||
</TableCell>
|
||||
|
||||
<style lang="scss">
|
||||
.touch-area {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -55,7 +55,7 @@ export function empty(arr: unknown[]): boolean {
|
||||
export function at(array: readonly [], index: number): undefined;
|
||||
export function at<T>(array: readonly T[], index: number): T;
|
||||
export function at<T>(array: readonly T[] | [], index: number): T | undefined {
|
||||
const len = array.length;
|
||||
const len = array?.length;
|
||||
if (!len) return undefined;
|
||||
|
||||
if (index < 0) index += len;
|
||||
@@ -96,3 +96,9 @@ export function toggle<T>(arr: T[], elem: T): T[] {
|
||||
arr.push(elem);
|
||||
return arr;
|
||||
}
|
||||
|
||||
// TODO: metric type is wrong
|
||||
export function total(set: Array<number>): number {
|
||||
if (!set) return 0;
|
||||
return set.reduce((prev, curr) => prev + curr, 0);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// Easier wrapper over mutation observer, which takes an element, a callback, and returns an unsubscribe fn
|
||||
export function observeElement(el: HTMLElement, callback: MutationCallback): () => void {
|
||||
const observer = new MutationObserver(callback);
|
||||
observer.observe(el, { childList: true, subtree: true });
|
||||
return () => observer.disconnect();
|
||||
}
|
||||
@@ -40,3 +40,11 @@ export function camelize(str: string): string {
|
||||
return firstChar.toLowerCase();
|
||||
});
|
||||
}
|
||||
|
||||
const formatter = Intl.NumberFormat('en', {
|
||||
notation: 'compact'
|
||||
});
|
||||
|
||||
export function formatNum(number: number): string {
|
||||
return formatter.format(number);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
export let overlapCover = false;
|
||||
export let size: 'small' | 'medium' | 'large' | 'xl' = null;
|
||||
export let size: 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' = null;
|
||||
|
||||
$: style = size
|
||||
? `--p-container-max-size: var(--container-max-size, var(--container-size-${size}))`
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { toggleCommandCenter } from '$lib/commandCenter/commandCenter.svelte';
|
||||
import { AvatarInitials, DropList, DropListItem, DropListLink } from '$lib/components';
|
||||
import { Feedback } from '$lib/components/feedback';
|
||||
import Button from '$lib/elements/forms/button.svelte';
|
||||
import { isMac } from '$lib/helpers/platform';
|
||||
import AppwriteLogo from '$lib/images/appwrite-gray-light.svg';
|
||||
import DarkMode from '$lib/images/mode/dark-mode.svg';
|
||||
import LightMode from '$lib/images/mode/light-mode.svg';
|
||||
@@ -95,7 +97,18 @@
|
||||
class="button is-small is-text">
|
||||
<span class="text">Support</span>
|
||||
</a>
|
||||
<Button text class="is-small" on:click={toggleCommandCenter}>
|
||||
<Button
|
||||
actions={[
|
||||
(node) => {
|
||||
return tooltip(node, {
|
||||
content: isMac() ? '⌘ + K' : 'Ctrl + K',
|
||||
placement: 'bottom'
|
||||
});
|
||||
}
|
||||
]}
|
||||
text
|
||||
class="is-small"
|
||||
on:click={toggleCommandCenter}>
|
||||
<i class="icon-search" />
|
||||
</Button>
|
||||
</nav>
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let currentStep = 1;
|
||||
let showExitModal = false;
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
@@ -55,8 +54,8 @@
|
||||
|
||||
function handleStepClick(e: CustomEvent<number>) {
|
||||
const step = e.detail;
|
||||
if (step < currentStep) {
|
||||
currentStep = step;
|
||||
if (step < $wizard.step) {
|
||||
$wizard.step = step;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,12 +78,14 @@
|
||||
dispatch('finish');
|
||||
} else {
|
||||
trackEvent('wizard_next');
|
||||
currentStep++;
|
||||
$wizard.step++;
|
||||
}
|
||||
}
|
||||
|
||||
$: sortedSteps = [...steps].sort(([a], [b]) => (a > b ? 1 : -1));
|
||||
$: isLastStep = currentStep === steps.size;
|
||||
$: isLastStep = $wizard.step === steps.size;
|
||||
|
||||
$: console.log({ sortedSteps, current: $wizard.step });
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
@@ -114,7 +115,7 @@
|
||||
text: label,
|
||||
optional
|
||||
}))}
|
||||
{currentStep} />
|
||||
currentStep={$wizard.step} />
|
||||
</aside>
|
||||
<div class="wizard-media">
|
||||
{#if $wizard.media}
|
||||
@@ -124,24 +125,24 @@
|
||||
<div class="wizard-main">
|
||||
<Form noStyle onSubmit={submit}>
|
||||
{#each sortedSteps as [step, { component }]}
|
||||
{#if currentStep === step}
|
||||
{#if $wizard.step === step}
|
||||
<svelte:component this={component} />
|
||||
{/if}
|
||||
{/each}
|
||||
<div class="form-footer">
|
||||
<div class="u-flex u-main-end u-gap-12">
|
||||
{#if !isLastStep && sortedSteps[currentStep - 1][1].optional}
|
||||
{#if !isLastStep && sortedSteps[$wizard.step - 1]?.[1]?.optional}
|
||||
<Button text on:click={() => dispatch('finish')}>
|
||||
Skip optional steps
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
{#if currentStep === 1}
|
||||
{#if $wizard.step === 1}
|
||||
<Button secondary on:click={handleExit}>Cancel</Button>
|
||||
{:else}
|
||||
<Button
|
||||
secondary
|
||||
on:click={() => currentStep--}
|
||||
on:click={() => $wizard.step--}
|
||||
on:click={() => trackEvent('wizard_back')}>Back</Button>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -2,21 +2,23 @@ import { getProjectId } from '$lib/helpers/project';
|
||||
import { VARS } from '$lib/system';
|
||||
import {
|
||||
Account,
|
||||
Assistant,
|
||||
Avatars,
|
||||
Client,
|
||||
Console,
|
||||
Databases,
|
||||
Functions,
|
||||
Health,
|
||||
Locale,
|
||||
Migrations,
|
||||
Projects,
|
||||
Project,
|
||||
Project as ProjectApi,
|
||||
Projects,
|
||||
Proxy,
|
||||
Storage,
|
||||
Teams,
|
||||
Users,
|
||||
Project as ProjectApi,
|
||||
Vcs,
|
||||
Proxy
|
||||
Vcs
|
||||
} from '@appwrite.io/console';
|
||||
|
||||
const endpoint = VARS.APPWRITE_ENDPOINT ?? `${globalThis?.location?.origin}/v1`;
|
||||
@@ -63,7 +65,9 @@ export const sdk = {
|
||||
projects: new Projects(clientConsole),
|
||||
teams: new Teams(clientConsole),
|
||||
users: new Users(clientConsole),
|
||||
migrations: new Migrations(clientConsole)
|
||||
migrations: new Migrations(clientConsole),
|
||||
console: new Console(clientConsole),
|
||||
assistant: new Assistant(clientConsole)
|
||||
},
|
||||
get forProject() {
|
||||
const projectId = getProjectId();
|
||||
|
||||
@@ -9,6 +9,7 @@ export type WizardStore = {
|
||||
cover?: typeof SvelteComponent;
|
||||
interceptor?: () => Promise<void>;
|
||||
nextDisabled: boolean;
|
||||
step: number;
|
||||
};
|
||||
|
||||
function createWizardStore() {
|
||||
@@ -18,7 +19,8 @@ function createWizardStore() {
|
||||
cover: null,
|
||||
interceptor: null,
|
||||
media: null,
|
||||
nextDisabled: false
|
||||
nextDisabled: false,
|
||||
step: 1
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -30,6 +32,7 @@ function createWizardStore() {
|
||||
n.component = component;
|
||||
n.interceptor = null;
|
||||
n.media = media;
|
||||
n.step = 1;
|
||||
n.cover = null;
|
||||
trackEvent('wizard_start');
|
||||
return n;
|
||||
@@ -52,6 +55,7 @@ function createWizardStore() {
|
||||
n.component = null;
|
||||
n.interceptor = null;
|
||||
n.media = null;
|
||||
n.step = 1;
|
||||
n.cover = null;
|
||||
return n;
|
||||
}),
|
||||
@@ -59,7 +63,19 @@ function createWizardStore() {
|
||||
update((n) => {
|
||||
n.cover = component;
|
||||
return n;
|
||||
})
|
||||
}),
|
||||
updateStep: (cb: (prevStep: number) => number) => {
|
||||
update((n) => {
|
||||
n.step = cb(n.step);
|
||||
return n;
|
||||
});
|
||||
},
|
||||
setStep: (step: number) => {
|
||||
update((n) => {
|
||||
n.step = step;
|
||||
return n;
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -185,4 +185,25 @@
|
||||
background: var(--separator-color);
|
||||
}
|
||||
}
|
||||
|
||||
.border-gradient {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.border-gradient::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-radius: var(--border-radius);
|
||||
border: var(--border-size) solid transparent;
|
||||
background: var(--border-gradient) border-box;
|
||||
mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
|
||||
-webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
|
||||
-webkit-mask-composite: destination-out;
|
||||
mask-composite: exclude;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
@@ -1,9 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { EyebrowHeading } from '$lib/components';
|
||||
import { Alert, EyebrowHeading } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { deepMap } from '$lib/helpers/object';
|
||||
import type { WritableValue } from '$lib/helpers/types';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { sdk, type getSdkForProject } from '$lib/stores/sdk';
|
||||
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
providerResources,
|
||||
resourcesToMigrationForm
|
||||
} from '$lib/stores/migration';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
|
||||
export let formData: ReturnType<typeof createMigrationFormStore>;
|
||||
export let provider: ReturnType<typeof createMigrationProviderStore>;
|
||||
export let projectSdk: ReturnType<typeof getSdkForProject>;
|
||||
|
||||
type ValueOf<T> = T[keyof T];
|
||||
type FormData = WritableValue<typeof formData>;
|
||||
@@ -80,12 +80,14 @@
|
||||
$: version = report?.version || '0.0.0';
|
||||
|
||||
let isOpen = false;
|
||||
|
||||
let error = false;
|
||||
onMount(async () => {
|
||||
isOpen = true;
|
||||
try {
|
||||
switch ($provider.provider) {
|
||||
case 'appwrite': {
|
||||
const res = await sdk.forProject.migrations.getAppwriteReport(
|
||||
const res = await projectSdk.migrations.getAppwriteReport(
|
||||
providerResources.appwrite,
|
||||
$provider.endpoint,
|
||||
$provider.projectID,
|
||||
@@ -95,7 +97,7 @@
|
||||
break;
|
||||
}
|
||||
case 'supabase': {
|
||||
const res = await sdk.forProject.migrations.getSupabaseReport(
|
||||
const res = await projectSdk.migrations.getSupabaseReport(
|
||||
providerResources.supabase,
|
||||
$provider.endpoint,
|
||||
$provider.apiKey,
|
||||
@@ -118,7 +120,7 @@
|
||||
report = res;
|
||||
} else if ($provider.serviceAccount) {
|
||||
// Manual auth
|
||||
const res = await sdk.forProject.migrations.getFirebaseReport(
|
||||
const res = await projectSdk.migrations.getFirebaseReport(
|
||||
providerResources.firebase,
|
||||
$provider.serviceAccount
|
||||
);
|
||||
@@ -128,7 +130,7 @@
|
||||
break;
|
||||
}
|
||||
case 'nhost': {
|
||||
const res = await sdk.forProject.migrations.getNHostReport(
|
||||
const res = await projectSdk.migrations.getNHostReport(
|
||||
providerResources.nhost,
|
||||
$provider.subdomain,
|
||||
$provider.region,
|
||||
@@ -142,10 +144,7 @@
|
||||
}
|
||||
} catch (e) {
|
||||
if (!isOpen) return;
|
||||
addNotification({
|
||||
message: e.message,
|
||||
type: 'error'
|
||||
});
|
||||
error = true;
|
||||
}
|
||||
|
||||
return () => {
|
||||
@@ -154,7 +153,6 @@
|
||||
});
|
||||
|
||||
$: resources = providerResources[$provider.provider];
|
||||
|
||||
$: wizard.setNextDisabled(!report);
|
||||
</script>
|
||||
|
||||
@@ -206,6 +204,45 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if report && !isVersionAtLeast(version, '1.4.0')}
|
||||
<div class="u-margin-block-start-24">
|
||||
<Alert
|
||||
type="warning"
|
||||
isStandalone
|
||||
buttons={[
|
||||
{
|
||||
name: 'Learn more',
|
||||
method() {
|
||||
wizard.updateStep((p) => p - 1);
|
||||
}
|
||||
}
|
||||
]}>
|
||||
<svelte:fragment slot="title">Functions not available for import</svelte:fragment>
|
||||
To migrate your functions, update the version of the Appwrite instance you're importing from
|
||||
to a version newer than 1.4
|
||||
</Alert>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if error}
|
||||
<div class="u-margin-block-start-24">
|
||||
<Alert
|
||||
type="error"
|
||||
isStandalone
|
||||
buttons={[
|
||||
{
|
||||
name: 'Edit credentials',
|
||||
method() {
|
||||
wizard.updateStep((p) => p - 1);
|
||||
}
|
||||
}
|
||||
]}>
|
||||
<svelte:fragment slot="title">Request failed</svelte:fragment>
|
||||
Please check if your credentials are filled in correctly in the previous step
|
||||
</Alert>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<ul class="buttons-list u-margin-block-start-32 u-main-end">
|
||||
<li class="buttons-list-item">
|
||||
<Button text on:click={deselectAll}>Deselect all</Button>
|
||||
@@ -216,18 +253,22 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="u-flex u-flex-vertical u-gap-32 u-margin-block-start-16">
|
||||
<ul class="u-flex u-flex-vertical u-margin-block-start-16">
|
||||
{#if resources.includes('user')}
|
||||
<li class="checkbox-field">
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={$formData.users.root}
|
||||
on:change={handleInputChange('users.root')} />
|
||||
<div class="u-flex u-gap-4">
|
||||
<div class="u-flex u-gap-4 u-cross-center">
|
||||
<span class="u-bold">Users</span>
|
||||
|
||||
{#if $provider.provider !== 'firebase'}
|
||||
<span class="inline-tag">{report?.user ?? '...'}</span>
|
||||
{#if report?.user !== undefined}
|
||||
<span class="inline-tag">{report.user}</span>
|
||||
{:else if !error}
|
||||
<span class="loader is-small u-margin-inline-start-4" />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div />
|
||||
@@ -240,10 +281,14 @@
|
||||
type="checkbox"
|
||||
bind:checked={$formData.users.teams}
|
||||
on:change={handleInputChange('users.teams')} />
|
||||
<div class="u-flex u-gap-4">
|
||||
<div class="u-flex u-gap-4 u-cross-center">
|
||||
<span class="u-bold">Include teams</span>
|
||||
{#if $provider.provider === 'firebase'}
|
||||
<span class="inline-tag">{report?.team ?? '...'}</span>
|
||||
{#if report?.team !== undefined}
|
||||
<span class="inline-tag">{report.team}</span>
|
||||
{:else if !error}
|
||||
<span class="loader is-small u-margin-inline-start-4" />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div />
|
||||
@@ -260,10 +305,14 @@
|
||||
type="checkbox"
|
||||
bind:checked={$formData.databases.root}
|
||||
on:change={handleInputChange('databases.root')} />
|
||||
<div class="u-flex u-gap-4">
|
||||
<div class="u-flex u-gap-4 u-cross-center">
|
||||
<span class="u-bold">Databases</span>
|
||||
{#if $provider.provider !== 'firebase'}
|
||||
<span class="inline-tag">{report?.database ?? '...'}</span>
|
||||
{#if report?.database !== undefined}
|
||||
<span class="inline-tag">{report.database}</span>
|
||||
{:else if !error}
|
||||
<span class="loader is-small u-margin-inline-start-4" />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div />
|
||||
@@ -276,10 +325,14 @@
|
||||
type="checkbox"
|
||||
bind:checked={$formData.databases.documents}
|
||||
on:change={handleInputChange('databases.documents')} />
|
||||
<div class="u-flex u-gap-4">
|
||||
<div class="u-flex u-gap-4 u-cross-center">
|
||||
<span class="u-bold">Include documents</span>
|
||||
{#if $provider.provider !== 'firebase'}
|
||||
<span class="inline-tag">{report?.document ?? '...'}</span>
|
||||
{#if report?.document !== undefined}
|
||||
<span class="inline-tag">{report.document}</span>
|
||||
{:else if !error}
|
||||
<span class="loader is-small u-margin-inline-start-4" />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div />
|
||||
@@ -296,10 +349,14 @@
|
||||
type="checkbox"
|
||||
bind:checked={$formData.functions.root}
|
||||
on:change={handleInputChange('functions.root')} />
|
||||
<div class="u-flex u-gap-4">
|
||||
<div class="u-flex u-gap-4 u-cross-center">
|
||||
<span class="u-bold">Functions</span>
|
||||
{#if $provider.provider !== 'firebase'}
|
||||
<span class="inline-tag">{report?.function ?? '...'}</span>
|
||||
{#if report?.function !== undefined}
|
||||
<span class="inline-tag">{report.function}</span>
|
||||
{:else if !error}
|
||||
<span class="loader is-small u-margin-inline-start-4" />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div />
|
||||
@@ -341,26 +398,28 @@
|
||||
type="checkbox"
|
||||
bind:checked={$formData.storage.root}
|
||||
on:change={handleInputChange('storage.root')} />
|
||||
<div class="u-flex u-gap-4">
|
||||
<div class="u-flex u-gap-4 u-cross-center">
|
||||
<span class="u-bold">Storage</span>
|
||||
{#if $provider.provider !== 'firebase'}
|
||||
<span class="inline-tag">
|
||||
{report?.size ? `${report.size.toFixed(2)}MB` : '...'}
|
||||
</span>
|
||||
{#if report?.size !== undefined}
|
||||
<span class="inline-tag">{`${report.size.toFixed(2)}MB`}</span>
|
||||
{:else if !error}
|
||||
<span class="loader is-small u-margin-inline-start-4" />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div />
|
||||
|
||||
<span>
|
||||
<p>
|
||||
Import all buckets
|
||||
{#if $provider.provider !== 'firebase'}
|
||||
<span class="inline-tag">{report?.bucket ?? '...'}</span>
|
||||
{#if $provider.provider !== 'firebase' && report?.bucket}
|
||||
<span class="inline-tag">{report.bucket}</span>
|
||||
{/if}
|
||||
and files
|
||||
{#if $provider.provider !== 'firebase'}
|
||||
<span class="inline-tag">{report?.file ?? '...'}</span>
|
||||
{#if $provider.provider !== 'firebase' && report?.file}
|
||||
<span class="inline-tag">{report.file}</span>
|
||||
{/if}
|
||||
</span>
|
||||
</p>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { getSdkForProject } from '$lib/stores/sdk';
|
||||
|
||||
import { formData, provider } from '.';
|
||||
import { formData, provider, selectedProject } from '.';
|
||||
import ResourceForm from './resource-form.svelte';
|
||||
</script>
|
||||
|
||||
<WizardStep>
|
||||
<svelte:fragment slot="title">Select data</svelte:fragment>
|
||||
<ResourceForm {provider} {formData} />
|
||||
<ResourceForm {provider} {formData} projectSdk={getSdkForProject($selectedProject)} />
|
||||
</WizardStep>
|
||||
@@ -17,20 +17,53 @@
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import { CommandCenter, registerCommands, registerSearchers } from '$lib/commandCenter';
|
||||
import { AIPanel, OrganizationsPanel, ProjectsPanel } from '$lib/commandCenter/panels';
|
||||
import { AIPanel } from '$lib/commandCenter/panels';
|
||||
import { orgSearcher, projectsSearcher } from '$lib/commandCenter/searchers';
|
||||
import { addSubPanel } from '$lib/commandCenter/subPanels';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { openMigrationWizard } from './(migration-wizard)';
|
||||
import { project } from './project-[project]/store';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
|
||||
function kebabToSentenceCase(str: string) {
|
||||
return str
|
||||
.split('-')
|
||||
.map((word) => word[0].toUpperCase() + word.slice(1))
|
||||
.join(' ');
|
||||
}
|
||||
|
||||
let isAssistantEnabled = false;
|
||||
onMount(async () => {
|
||||
const vars = sdk.forConsole.console.variables();
|
||||
isAssistantEnabled = vars._APP_ASSISTANT_ENABLED === true;
|
||||
});
|
||||
|
||||
$: isOnSettingsLayout = $project?.$id
|
||||
? $page.url.pathname.includes(`project-${$project.$id}/settings`)
|
||||
: false;
|
||||
|
||||
$: $registerCommands([
|
||||
{
|
||||
label: 'Ask AI',
|
||||
label: 'Go to projects',
|
||||
callback: () => {
|
||||
goto('/console');
|
||||
},
|
||||
keys: ['g', 'p'],
|
||||
group: 'navigation',
|
||||
disabled:
|
||||
$page.url.pathname.includes('/console/organization-') &&
|
||||
!$page.url.pathname.endsWith('/members') &&
|
||||
!$page.url.pathname.endsWith('/settings'),
|
||||
rank: -1
|
||||
},
|
||||
{
|
||||
label: 'Ask the AI',
|
||||
callback: () => {
|
||||
addSubPanel(AIPanel);
|
||||
},
|
||||
keys: ['a', 'i'],
|
||||
icon: 'light-bulb'
|
||||
icon: 'sparkles',
|
||||
disabled: !isAssistantEnabled
|
||||
},
|
||||
{
|
||||
label: 'Go to account',
|
||||
@@ -38,25 +71,8 @@
|
||||
goto('/console/account');
|
||||
},
|
||||
keys: ['i'],
|
||||
group: 'navigation'
|
||||
},
|
||||
{
|
||||
label: 'Find an organization',
|
||||
callback: () => {
|
||||
addSubPanel(OrganizationsPanel);
|
||||
},
|
||||
group: 'organizations',
|
||||
icon: 'search',
|
||||
keys: ['f', 'o']
|
||||
},
|
||||
{
|
||||
label: 'Find a project',
|
||||
callback: () => {
|
||||
addSubPanel(ProjectsPanel);
|
||||
},
|
||||
keys: ['f', 'p'],
|
||||
group: 'projects',
|
||||
icon: 'search'
|
||||
group: 'navigation',
|
||||
rank: -2
|
||||
},
|
||||
{
|
||||
label: 'Create new organization',
|
||||
@@ -66,14 +82,6 @@
|
||||
keys: ['c', 'o'],
|
||||
group: 'organizations'
|
||||
},
|
||||
{
|
||||
label: 'Go to home',
|
||||
callback: () => {
|
||||
goto('/console');
|
||||
},
|
||||
keys: ['h'],
|
||||
group: 'navigation'
|
||||
},
|
||||
{
|
||||
label: 'Open documentation',
|
||||
callback: () => {
|
||||
@@ -106,24 +114,96 @@
|
||||
group: 'help',
|
||||
icon: 'discord'
|
||||
},
|
||||
...(['auto', 'dark', 'light'] as const).map((theme) => {
|
||||
return {
|
||||
label: `Set theme to ${theme}`,
|
||||
callback: () => {
|
||||
$app.theme = theme;
|
||||
addNotification({
|
||||
title: 'Theme changed',
|
||||
message: `Theme changed to ${$app.theme}`,
|
||||
type: 'success'
|
||||
});
|
||||
},
|
||||
group: 'misc',
|
||||
icon: 'switch-horizontal',
|
||||
keys: ['t', theme[0]]
|
||||
} as const;
|
||||
}),
|
||||
// Auth
|
||||
...[
|
||||
'users-limit',
|
||||
'session-length',
|
||||
'sessions-limit',
|
||||
'password-history',
|
||||
'password-dictionary',
|
||||
'personal-data'
|
||||
].map(
|
||||
(heading) =>
|
||||
({
|
||||
label: kebabToSentenceCase(heading),
|
||||
async callback() {
|
||||
await goto(`/console/project-${$project.$id}/auth/security#${heading}`);
|
||||
scrollBy({ top: -100 });
|
||||
},
|
||||
group: 'security',
|
||||
icon: 'pencil'
|
||||
} as const)
|
||||
),
|
||||
// Settings
|
||||
{
|
||||
label: 'Toggle theme',
|
||||
label: 'Go to settings overview',
|
||||
|
||||
keys: isOnSettingsLayout ? ['g', 'o'] : undefined,
|
||||
callback: () => {
|
||||
if ($app.theme === 'auto') {
|
||||
$app.theme = 'light';
|
||||
} else if ($app.theme === 'light') {
|
||||
$app.theme = 'dark';
|
||||
} else {
|
||||
$app.theme = 'auto';
|
||||
}
|
||||
addNotification({
|
||||
title: 'Theme changed',
|
||||
message: `Theme changed to ${$app.theme}`,
|
||||
type: 'success'
|
||||
});
|
||||
goto(`/console/project-${$project.$id}/settings`);
|
||||
},
|
||||
group: 'misc',
|
||||
icon: 'switch-horizontal'
|
||||
disabled: isOnSettingsLayout && $page.url.pathname.endsWith('settings'),
|
||||
group: 'navigation',
|
||||
rank: isOnSettingsLayout ? 40 : -1
|
||||
},
|
||||
{
|
||||
label: 'Go to custom domains',
|
||||
|
||||
keys: isOnSettingsLayout ? ['g', 'd'] : undefined,
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/settings/domains`);
|
||||
},
|
||||
disabled: isOnSettingsLayout && $page.url.pathname.includes('domains'),
|
||||
group: 'navigation',
|
||||
rank: isOnSettingsLayout ? 30 : -1
|
||||
},
|
||||
{
|
||||
label: 'Go to webhooks',
|
||||
keys: isOnSettingsLayout ? ['g', 'w'] : undefined,
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/settings/webhooks`);
|
||||
},
|
||||
disabled: isOnSettingsLayout && $page.url.pathname.includes('webhooks'),
|
||||
group: 'navigation',
|
||||
|
||||
rank: isOnSettingsLayout ? 20 : -1
|
||||
},
|
||||
{
|
||||
label: 'Go to migrations',
|
||||
keys: isOnSettingsLayout ? ['g', 'm'] : undefined,
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/settings/migrations`);
|
||||
},
|
||||
disabled: isOnSettingsLayout && $page.url.pathname.includes('migrations'),
|
||||
group: 'navigation',
|
||||
|
||||
rank: isOnSettingsLayout ? 10 : -1
|
||||
},
|
||||
{
|
||||
label: 'Go to SMTP settings',
|
||||
keys: isOnSettingsLayout ? ['g', 's'] : undefined,
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/settings/smtp`);
|
||||
},
|
||||
disabled: isOnSettingsLayout && $page.url.pathname.includes('smtp'),
|
||||
group: 'navigation',
|
||||
rank: -1
|
||||
}
|
||||
]);
|
||||
let isOpen = false;
|
||||
|
||||
@@ -1,13 +1,39 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { registerCommands } from '$lib/commandCenter';
|
||||
import { newMemberModal, newOrgModal } from '$lib/stores/organization';
|
||||
import { requestedMigration } from '$routes/store';
|
||||
import { openMigrationWizard } from '../(migration-wizard)';
|
||||
import Create from '../createOrganization.svelte';
|
||||
import CreateMember from './createMember.svelte';
|
||||
|
||||
export let data;
|
||||
|
||||
$: if ($requestedMigration) {
|
||||
openMigrationWizard();
|
||||
}
|
||||
|
||||
$: $registerCommands([
|
||||
{
|
||||
label: 'Go to members',
|
||||
callback: () => {
|
||||
goto(`/console/organization-${data.organization.$id}/members`);
|
||||
},
|
||||
keys: ['g', 'm'],
|
||||
disabled: $page.url.pathname.endsWith('/members'),
|
||||
group: 'navigation'
|
||||
},
|
||||
{
|
||||
label: 'Go to settings',
|
||||
callback: () => {
|
||||
goto(`/console/organization-${data.organization.$id}/settings`);
|
||||
},
|
||||
keys: ['g', 's'],
|
||||
disabled: $page.url.pathname.endsWith('/settings'),
|
||||
group: 'navigation'
|
||||
}
|
||||
]);
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
||||
@@ -5,15 +5,8 @@
|
||||
import { project, stats } from './store';
|
||||
|
||||
import { goto } from '$app/navigation';
|
||||
import { addSubPanel, registerCommands, registerSearchers } from '$lib/commandCenter';
|
||||
import { registerCommands, registerSearchers } from '$lib/commandCenter';
|
||||
|
||||
import {
|
||||
BucketsPanel,
|
||||
DatabasesPanel,
|
||||
FunctionsPanel,
|
||||
TeamsPanel,
|
||||
UsersPanel
|
||||
} from '$lib/commandCenter/panels';
|
||||
import {
|
||||
bucketSearcher,
|
||||
dbSearcher,
|
||||
@@ -35,24 +28,7 @@
|
||||
|
||||
$: $registerCommands([
|
||||
{
|
||||
label: 'Go to overview',
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}`);
|
||||
},
|
||||
keys: ['o'],
|
||||
group: 'navigation'
|
||||
},
|
||||
|
||||
{
|
||||
label: 'Go to auth',
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/auth`);
|
||||
},
|
||||
keys: ['a'],
|
||||
group: 'navigation'
|
||||
},
|
||||
{
|
||||
label: 'Go to databases',
|
||||
label: 'Go to Databases',
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/databases`);
|
||||
},
|
||||
@@ -60,7 +36,15 @@
|
||||
group: 'navigation'
|
||||
},
|
||||
{
|
||||
label: 'Go to functions',
|
||||
label: 'Go to Auth',
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/auth`);
|
||||
},
|
||||
keys: ['a'],
|
||||
group: 'navigation'
|
||||
},
|
||||
{
|
||||
label: 'Go to Functions',
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/functions`);
|
||||
},
|
||||
@@ -68,7 +52,7 @@
|
||||
group: 'navigation'
|
||||
},
|
||||
{
|
||||
label: 'Go to storage',
|
||||
label: 'Go to Storage',
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/storage`);
|
||||
},
|
||||
@@ -84,50 +68,12 @@
|
||||
group: 'navigation'
|
||||
},
|
||||
{
|
||||
label: 'Find users',
|
||||
label: 'Go to overview',
|
||||
callback: () => {
|
||||
addSubPanel(UsersPanel);
|
||||
goto(`/console/project-${$project.$id}`);
|
||||
},
|
||||
group: 'users',
|
||||
icon: 'search',
|
||||
keys: ['f', 'u'],
|
||||
rank: 10
|
||||
},
|
||||
{
|
||||
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']
|
||||
},
|
||||
{
|
||||
label: 'Find functions',
|
||||
callback: () => {
|
||||
addSubPanel(FunctionsPanel);
|
||||
},
|
||||
group: 'functions',
|
||||
icon: 'search',
|
||||
keys: ['f', 'f']
|
||||
},
|
||||
{
|
||||
label: 'Find buckets',
|
||||
callback: () => {
|
||||
addSubPanel(BucketsPanel);
|
||||
},
|
||||
group: 'buckets',
|
||||
icon: 'search',
|
||||
keys: ['f', 'b']
|
||||
keys: ['o'],
|
||||
group: 'navigation'
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
@@ -74,51 +74,6 @@
|
||||
group: 'navigation',
|
||||
rank: 1,
|
||||
disabled: $page.url.pathname.endsWith('settings')
|
||||
},
|
||||
{
|
||||
label: 'Users limit',
|
||||
async callback() {
|
||||
await goto(`/console/project-${$project.$id}/auth/security#users-limit`);
|
||||
scrollBy({ top: -100 });
|
||||
},
|
||||
group: 'security',
|
||||
icon: 'pencil'
|
||||
},
|
||||
{
|
||||
label: 'Session length',
|
||||
async callback() {
|
||||
await goto(`/console/project-${$project.$id}/auth/security#session-length`);
|
||||
scrollBy({ top: -100 });
|
||||
},
|
||||
group: 'security',
|
||||
icon: 'pencil'
|
||||
},
|
||||
{
|
||||
label: 'Sessions limit',
|
||||
async callback() {
|
||||
await goto(`/console/project-${$project.$id}/auth/security#sessions-limit`);
|
||||
scrollBy({ top: -100 });
|
||||
},
|
||||
group: 'security',
|
||||
icon: 'pencil'
|
||||
},
|
||||
{
|
||||
label: 'Password history',
|
||||
async callback() {
|
||||
await goto(`/console/project-${$project.$id}/auth/security#password-history`);
|
||||
scrollBy({ top: -100 });
|
||||
},
|
||||
group: 'security',
|
||||
icon: 'pencil'
|
||||
},
|
||||
{
|
||||
label: 'Password dictionary',
|
||||
async callback() {
|
||||
await goto(`/console/project-${$project.$id}/auth/security#password-dictionary`);
|
||||
scrollBy({ top: -100 });
|
||||
},
|
||||
group: 'security',
|
||||
icon: 'pencil'
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<Form onSubmit={updatePersonalDataCheck}>
|
||||
<CardGrid>
|
||||
<Heading tag="h2" size="7">Personal data</Heading>
|
||||
<Heading tag="h2" size="7" id="personal-data">Personal data</Heading>
|
||||
<svelte:fragment slot="aside">
|
||||
<FormList>
|
||||
<InputSwitch
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import CreateCollection from './createCollection.svelte';
|
||||
import { showCreate } from './store';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import {
|
||||
addSubPanel,
|
||||
registerCommands,
|
||||
registerSearchers,
|
||||
updateCommandGroupRanks
|
||||
} from '$lib/commandCenter';
|
||||
import { collectionsSearcher } from '$lib/commandCenter/searchers';
|
||||
import { CollectionsPanel } from '$lib/commandCenter/panels';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import CreateCollection from './createCollection.svelte';
|
||||
import { showCreate } from './store';
|
||||
|
||||
const project = $page.params.project;
|
||||
const databaseId = $page.params.database;
|
||||
@@ -27,15 +25,6 @@
|
||||
}
|
||||
|
||||
$: $registerCommands([
|
||||
{
|
||||
label: 'Find collections',
|
||||
callback() {
|
||||
addSubPanel(CollectionsPanel);
|
||||
},
|
||||
keys: ['f', 'c'],
|
||||
group: 'collections',
|
||||
icon: 'search'
|
||||
},
|
||||
{
|
||||
label: 'Create collection',
|
||||
callback() {
|
||||
|
||||
+9
-23
@@ -51,7 +51,12 @@
|
||||
equal: {
|
||||
toQuery: Query.equal,
|
||||
toTag: (attribute, input) => `**${attribute}** equal to **${input}**`,
|
||||
types: ['string', 'integer', 'double']
|
||||
types: ['string', 'integer', 'double', 'boolean']
|
||||
},
|
||||
'not equal to': {
|
||||
toQuery: Query.notEqual,
|
||||
toTag: (attribute, input) => `**${attribute}** not equal to **${input}**`,
|
||||
types: ['string', 'integer', 'double', 'boolean']
|
||||
},
|
||||
'not null': {
|
||||
toQuery: Query.isNotNull,
|
||||
@@ -108,7 +113,7 @@
|
||||
|
||||
<div>
|
||||
<form on:submit|preventDefault={addFilter}>
|
||||
<div class="selects u-flex u-gap-12 u-margin-block-start-16">
|
||||
<div class="selects u-flex u-gap-8 u-margin-block-start-16">
|
||||
<InputSelect
|
||||
id="column"
|
||||
options={$columns.map((c) => ({
|
||||
@@ -125,7 +130,7 @@
|
||||
bind:value={operatorKey} />
|
||||
</div>
|
||||
{#if column && operator && !operator?.hideInput}
|
||||
<div class="u-margin-block-start-16">
|
||||
<div class="u-margin-block-start-8">
|
||||
{#if column.type === 'integer' || column.type === 'double'}
|
||||
<InputNumber id="value" bind:value placeholder="Enter value" />
|
||||
{:else}
|
||||
@@ -133,7 +138,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<Button text disabled={isDisabled} class="u-margin-block-start-12" submit>
|
||||
<Button text disabled={isDisabled} class="u-margin-block-start-4" submit>
|
||||
<i class="icon-plus" />
|
||||
Add filter
|
||||
</Button>
|
||||
@@ -156,16 +161,6 @@
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.dropped {
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0px 16px 32px 0px rgba(55, 59, 77, 0.04);
|
||||
|
||||
padding: 1rem;
|
||||
margin-top: 0.5rem;
|
||||
|
||||
width: 37.5rem;
|
||||
}
|
||||
|
||||
.selects {
|
||||
:global(> *) {
|
||||
flex: 1;
|
||||
@@ -177,13 +172,4 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
hr {
|
||||
height: 1px;
|
||||
width: calc(100% + 2rem);
|
||||
background-color: hsl(var(--color-border));
|
||||
|
||||
margin-block-start: 1rem;
|
||||
margin-inline: -1rem;
|
||||
}
|
||||
</style>
|
||||
+2
@@ -13,6 +13,8 @@
|
||||
function apply() {
|
||||
queries.apply();
|
||||
applied = $tags.length;
|
||||
showFiltersDesktop = false;
|
||||
showFiltersMobile = false;
|
||||
}
|
||||
|
||||
function clearAll() {
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@
|
||||
};
|
||||
export let editing = false;
|
||||
|
||||
$: if (data.required || data.array) {
|
||||
$: if (data.array) {
|
||||
data.default = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
+12
-7
@@ -234,14 +234,21 @@
|
||||
<div class="u-flex u-cross-center u-main-space-between actions">
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
<span class="indicator body-text-2 u-bold">{selectedDb.length}</span>
|
||||
<span>
|
||||
{selected.length > 1 ? 'documents' : 'document'} selected
|
||||
</span>
|
||||
<p>
|
||||
<span class="is-only-desktop">
|
||||
{selectedDb.length > 1 ? 'documents' : 'document'}
|
||||
</span>
|
||||
selected
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
<Button text on:click={() => (selected = [])}>Cancel</Button>
|
||||
<Button secondary on:click={() => (showDelete = true)}>Delete selection</Button>
|
||||
<Button text on:click={() => (selectedDb = [])}>Cancel</Button>
|
||||
<Button secondary on:click={() => (showDelete = true)}>
|
||||
<p>
|
||||
Delete <span class="is-only-desktop">selection</span>
|
||||
</p>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</FloatingActionBar>
|
||||
@@ -312,8 +319,6 @@
|
||||
|
||||
<style lang="scss">
|
||||
.actions {
|
||||
width: 31.25rem;
|
||||
|
||||
.indicator {
|
||||
border-radius: 0.25rem;
|
||||
background: hsl(var(--color-information-100));
|
||||
|
||||
@@ -103,14 +103,21 @@
|
||||
<div class="u-flex u-cross-center u-main-space-between actions">
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
<span class="indicator body-text-2 u-bold">{selected.length}</span>
|
||||
<span>
|
||||
{selected.length > 1 ? 'collections' : 'collection'} selected
|
||||
</span>
|
||||
<p>
|
||||
<span class="is-only-desktop">
|
||||
{selected.length > 1 ? 'collections' : 'collection'}
|
||||
</span>
|
||||
selected
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
<Button text on:click={() => (selected = [])}>Cancel</Button>
|
||||
<Button secondary on:click={() => (showDelete = true)}>Delete selection</Button>
|
||||
<Button secondary on:click={() => (showDelete = true)}>
|
||||
<p>
|
||||
Delete <span class="is-only-desktop">selection</span>
|
||||
</p>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</FloatingActionBar>
|
||||
@@ -135,8 +142,6 @@
|
||||
|
||||
<style lang="scss">
|
||||
.actions {
|
||||
width: 31.25rem;
|
||||
|
||||
.indicator {
|
||||
border-radius: 0.25rem;
|
||||
background: hsl(var(--color-information-100));
|
||||
|
||||
@@ -102,14 +102,21 @@
|
||||
<div class="u-flex u-cross-center u-main-space-between actions">
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
<span class="indicator body-text-2 u-bold">{selected.length}</span>
|
||||
<span>
|
||||
{selected.length > 1 ? 'databases' : 'database'} selected
|
||||
</span>
|
||||
<p>
|
||||
<span class="is-only-desktop">
|
||||
{selected.length > 1 ? 'databases' : 'database'}
|
||||
</span>
|
||||
selected
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
<Button text on:click={() => (selected = [])}>Cancel</Button>
|
||||
<Button secondary on:click={() => (showDelete = true)}>Delete selection</Button>
|
||||
<Button secondary on:click={() => (showDelete = true)}>
|
||||
<p>
|
||||
Delete <span class="is-only-desktop">selection</span>
|
||||
</p>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</FloatingActionBar>
|
||||
@@ -134,8 +141,6 @@
|
||||
|
||||
<style lang="scss">
|
||||
.actions {
|
||||
width: 31.25rem;
|
||||
|
||||
.indicator {
|
||||
border-radius: 0.25rem;
|
||||
background: hsl(var(--color-information-100));
|
||||
|
||||
@@ -1,22 +1,7 @@
|
||||
<script context="module" lang="ts">
|
||||
const formatter = Intl.NumberFormat('en', {
|
||||
notation: 'compact'
|
||||
});
|
||||
|
||||
// TODO: metric type is wrong
|
||||
export function last(set: Array<unknown>): Models.Metric | null {
|
||||
if (!set) return null;
|
||||
return (set as Models.Metric[]).slice(-1)[0] ?? null;
|
||||
}
|
||||
|
||||
// TODO: metric type is wrong
|
||||
export function total(set: Array<unknown>): number {
|
||||
<script lang="ts" context="module">
|
||||
export function totalMetrics(set: Array<unknown>): number {
|
||||
if (!set) return 0;
|
||||
return (set as Models.Metric[]).reduce((prev, curr) => prev + curr.value, 0);
|
||||
}
|
||||
|
||||
export function format(number: number): string {
|
||||
return formatter.format(number);
|
||||
return total((set as Models.Metric[]).map((c) => c.value));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -38,6 +23,8 @@
|
||||
import Realtime from './realtime.svelte';
|
||||
import Requests from './requests.svelte';
|
||||
import { usage } from './store';
|
||||
import { formatNum } from '$lib/helpers/string';
|
||||
import { total } from '$lib/helpers/array';
|
||||
|
||||
$: projectId = $page.params.project;
|
||||
$: path = `/console/project-${projectId}/overview`;
|
||||
@@ -95,7 +82,7 @@
|
||||
<Onboard {projectId} />
|
||||
{:else}
|
||||
{#if $usage}
|
||||
{@const storage = humanFileSize(total($usage.filesStorage) ?? 0)}
|
||||
{@const storage = humanFileSize(totalMetrics($usage.filesStorage) ?? 0)}
|
||||
<section class="common-section">
|
||||
<div class="grid-dashboard-1s-2m-6l">
|
||||
<div class="card is-2-columns-medium-screen is-3-columns-large-screen">
|
||||
@@ -119,14 +106,16 @@
|
||||
|
||||
<div class="grid-item-1-end-start">
|
||||
<div class="heading-level-4">
|
||||
{format(total($usage.documentsTotal) ?? 0)}
|
||||
{formatNum(totalMetrics($usage.documentsTotal) ?? 0)}
|
||||
</div>
|
||||
<div>Documents</div>
|
||||
</div>
|
||||
|
||||
<div class="grid-item-1-end-end">
|
||||
<div class="text">
|
||||
Databases: {format(total($usage.databasesTotal) ?? 0)}
|
||||
Databases: {formatNum(
|
||||
totalMetrics($usage.databasesTotal) ?? 0
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -154,7 +143,7 @@
|
||||
|
||||
<div class="grid-item-1-end-end">
|
||||
<div class="text">
|
||||
Buckets: {format(total($usage.bucketsTotal) ?? 0)}
|
||||
Buckets: {formatNum(totalMetrics($usage.bucketsTotal) ?? 0)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -174,7 +163,7 @@
|
||||
|
||||
<div class="grid-item-1-end-start">
|
||||
<div class="heading-level-4">
|
||||
{format(total($usage.usersTotal) ?? 0)}
|
||||
{formatNum(totalMetrics($usage.usersTotal) ?? 0)}
|
||||
</div>
|
||||
<div>Users</div>
|
||||
</div>
|
||||
@@ -195,7 +184,7 @@
|
||||
|
||||
<div class="grid-item-1-end-start">
|
||||
<div class="heading-level-4">
|
||||
{format(total($usage.executionsTotal) ?? 0)}
|
||||
{formatNum(totalMetrics($usage.executionsTotal) ?? 0)}
|
||||
</div>
|
||||
<div>Executions</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Card, DropList, DropListItem } from '$lib/components';
|
||||
import { humanFileSize } from '$lib/helpers/sizeConvertion';
|
||||
import { total } from './+layout.svelte';
|
||||
import { totalMetrics } from './+layout.svelte';
|
||||
import { usage } from './store';
|
||||
import type { UsagePeriods } from '$lib/layout';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
@@ -17,7 +17,7 @@
|
||||
date: number;
|
||||
value: number;
|
||||
}>;
|
||||
$: bandwith = humanFileSize(total($usage?.network));
|
||||
$: bandwith = humanFileSize(totalMetrics($usage?.network));
|
||||
|
||||
$: if (period) {
|
||||
showPeriod = false;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import { page } from '$app/stores';
|
||||
import { BarChart } from '$lib/charts';
|
||||
import { Card } from '$lib/components';
|
||||
import { formatNum } from '$lib/helpers/string';
|
||||
import { stats } from '../store';
|
||||
import { format } from './+layout.svelte';
|
||||
|
||||
$: projectId = $page.params.project;
|
||||
$: projectStats = $stats?.get(projectId);
|
||||
@@ -12,7 +12,7 @@
|
||||
</script>
|
||||
|
||||
<div class="heading-level-4">
|
||||
{format(current)}
|
||||
{formatNum(current)}
|
||||
</div>
|
||||
<div>Realtime Connections</div>
|
||||
{#if total}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { Card, DropList, DropListItem } from '$lib/components';
|
||||
import { format, total } from './+layout.svelte';
|
||||
import { totalMetrics } from './+layout.svelte';
|
||||
import { usage } from './store';
|
||||
import type { UsagePeriods } from '$lib/layout';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { LineChart } from '$lib/charts';
|
||||
import { formatNum } from '$lib/helpers/string';
|
||||
|
||||
export let period: UsagePeriods;
|
||||
|
||||
@@ -25,7 +26,7 @@
|
||||
<div class="u-flex u-gap-16 u-main-space-between">
|
||||
<div>
|
||||
<div class="heading-level-4">
|
||||
{format(total($usage?.requestsTotal))}
|
||||
{formatNum(totalMetrics($usage?.requestsTotal))}
|
||||
</div>
|
||||
<div>Requests</div>
|
||||
</div>
|
||||
@@ -41,13 +42,13 @@
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
</div>
|
||||
{#if total($usage?.requestsTotal) !== 0}
|
||||
{#if totalMetrics($usage?.requestsTotal) !== 0}
|
||||
<div style="height: 12rem;">
|
||||
<LineChart
|
||||
options={{
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: format
|
||||
formatter: formatNum
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { registerCommands, updateCommandGroupRanks } from '$lib/commandCenter';
|
||||
import { project } from '../store';
|
||||
import { openWebhooksWizard } from './webhooks/+page.svelte';
|
||||
|
||||
$: $registerCommands([
|
||||
@@ -14,50 +12,6 @@
|
||||
openWebhooksWizard();
|
||||
},
|
||||
group: 'webhooks'
|
||||
},
|
||||
{
|
||||
label: 'Go to settings overview',
|
||||
|
||||
keys: ['g', 'o'],
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/settings`);
|
||||
},
|
||||
disabled: $page.url.pathname.endsWith('settings'),
|
||||
group: 'navigation',
|
||||
rank: 40
|
||||
},
|
||||
{
|
||||
label: 'Go to custom domains',
|
||||
|
||||
keys: ['g', 'd'],
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/settings/domains`);
|
||||
},
|
||||
disabled: $page.url.pathname.includes('domains'),
|
||||
group: 'navigation',
|
||||
rank: 30
|
||||
},
|
||||
{
|
||||
label: 'Go to webhooks',
|
||||
keys: ['g', 'w'],
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/settings/webhooks`);
|
||||
},
|
||||
disabled: $page.url.pathname.includes('webhooks'),
|
||||
group: 'navigation',
|
||||
|
||||
rank: 20
|
||||
},
|
||||
{
|
||||
label: 'Go to migrations',
|
||||
keys: ['g', 'm'],
|
||||
callback: () => {
|
||||
goto(`/console/project-${$project.$id}/settings/migrations`);
|
||||
},
|
||||
disabled: $page.url.pathname.includes('migrations'),
|
||||
group: 'navigation',
|
||||
|
||||
rank: 10
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
<script lang="ts">
|
||||
import SvgIcon from '$lib/components/svgIcon.svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import {
|
||||
Button,
|
||||
FormList,
|
||||
InputNumber,
|
||||
InputPassword,
|
||||
InputSelect,
|
||||
InputText
|
||||
InputText,
|
||||
InputTextarea
|
||||
} from '$lib/elements/forms';
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import type { Provider } from '$lib/stores/migration';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { page } from '$app/stores';
|
||||
import { provider } from '.';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { provider } from '.';
|
||||
|
||||
const providers: Record<Provider, string> = {
|
||||
appwrite: 'Appwrite Self-hosted',
|
||||
@@ -24,15 +23,15 @@
|
||||
nhost: 'NHost'
|
||||
};
|
||||
|
||||
function connectGoogle() {
|
||||
const redirect = new URL($page.url);
|
||||
const target = new URL(
|
||||
`${sdk.forProject.client.config.endpoint}/migrations/firebase/connect`
|
||||
);
|
||||
target.searchParams.set('redirect', redirect.toString());
|
||||
target.searchParams.set('projectId', $page.params.project);
|
||||
return target;
|
||||
}
|
||||
// function connectGoogle() {
|
||||
// const redirect = new URL($page.url);
|
||||
// const target = new URL(
|
||||
// `${sdk.forProject.client.config.endpoint}/migrations/firebase/connect`
|
||||
// );
|
||||
// target.searchParams.set('redirect', redirect.toString());
|
||||
// target.searchParams.set('projectId', $page.params.project);
|
||||
// return target;
|
||||
// }
|
||||
|
||||
function deauthorizeGoogle() {
|
||||
sdk.forProject.migrations.deleteFirebaseAuth().then(() => {
|
||||
@@ -51,12 +50,12 @@
|
||||
|
||||
$: console.log(firebaseProjects);
|
||||
|
||||
let showAuth = false;
|
||||
// let showAuth = false;
|
||||
</script>
|
||||
|
||||
<WizardStep>
|
||||
<svelte:fragment slot="title">Choose provider</svelte:fragment>
|
||||
<div class="u-flex u-flex-vertical u-gap-16">
|
||||
<div class="u-flex u-flex-vertical u-gap-8">
|
||||
{#each Object.entries(providers) as [key, value]}
|
||||
<label class="u-flex u-cross-center u-cursor-pointer u-gap-8">
|
||||
<input
|
||||
@@ -96,32 +95,32 @@
|
||||
</FormList>
|
||||
{:else if $provider.provider === 'firebase'}
|
||||
{#if !firebaseProjects?.length}
|
||||
<div class="box u-flex u-flex-vertical u-gap-16 u-cross-center u-margin-block-start-24">
|
||||
<!-- <div class="box u-flex u-flex-vertical u-gap-16 u-cross-center u-margin-block-start-24">
|
||||
<p class="u-text-center u-bold">Sign in with Google to get started</p>
|
||||
<Button secondary href={connectGoogle().toString()}>
|
||||
<SvgIcon name="google" />Sign in
|
||||
</Button>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<button
|
||||
<!-- <button
|
||||
class="tag u-margin-block-start-16"
|
||||
type="button"
|
||||
on:click={() => (showAuth = !showAuth)}
|
||||
class:is-selected={showAuth}>
|
||||
<span class="icon-lock-closed" aria-hidden="true" />
|
||||
<span class="text">Manual authentication</span>
|
||||
</button>
|
||||
</button> -->
|
||||
|
||||
{#if showAuth}
|
||||
<div class="u-margin-block-start-16">
|
||||
<InputText
|
||||
id="credentials"
|
||||
label="Account credentials"
|
||||
required
|
||||
bind:value={$provider.serviceAccount}
|
||||
placeholder="Enter account credentials" />
|
||||
</div>
|
||||
{/if}
|
||||
<!-- {#if showAuth} -->
|
||||
<div class="u-margin-block-start-16">
|
||||
<InputTextarea
|
||||
id="credentials"
|
||||
label="Account credentials"
|
||||
required
|
||||
bind:value={$provider.serviceAccount}
|
||||
placeholder="Enter account credentials" />
|
||||
</div>
|
||||
<!-- {/if} -->
|
||||
{:else}
|
||||
<FormList class="u-margin-block-start-24">
|
||||
<InputSelect
|
||||
@@ -194,7 +193,9 @@
|
||||
<InputText
|
||||
id="database"
|
||||
label="Database"
|
||||
placeholder={$provider.subdomain || 'Enter database'}
|
||||
placeholder={$provider.subdomain
|
||||
? `Default: ${$provider.subdomain}`
|
||||
: 'Enter database'}
|
||||
bind:value={$provider.database} />
|
||||
<InputText
|
||||
id="username"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
|
||||
import ResourceForm from '$routes/console/(migration-wizard)/resource-form.svelte';
|
||||
import { formData, provider } from '.';
|
||||
@@ -7,5 +8,5 @@
|
||||
|
||||
<WizardStep>
|
||||
<svelte:fragment slot="title">Select data</svelte:fragment>
|
||||
<ResourceForm {formData} {provider} />
|
||||
<ResourceForm {formData} {provider} projectSdk={sdk.forProject} />
|
||||
</WizardStep>
|
||||
@@ -107,4 +107,4 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<Wizard title="Create Project" {steps} on:exit={onExit} on:finish={onFinish} />
|
||||
<Wizard title="Create Migration" {steps} on:exit={onExit} on:finish={onFinish} />
|
||||
@@ -21,6 +21,8 @@
|
||||
import { openImportWizard } from './(import)';
|
||||
import Details from './details.svelte';
|
||||
import ExportModal from './exportModal.svelte';
|
||||
import Status from '$lib/components/status.svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
|
||||
export let data;
|
||||
let details: string | null = null;
|
||||
@@ -28,12 +30,12 @@
|
||||
|
||||
const getStatus = (status: string) => {
|
||||
if (status === 'failed') {
|
||||
return { text: 'Failed', icon: 'exclamation', iconColor: 'danger' };
|
||||
return 'failed';
|
||||
} else if (status === 'completed') {
|
||||
return { text: 'Completed', icon: 'check', iconColor: 'success' };
|
||||
return 'completed';
|
||||
}
|
||||
|
||||
return { text: 'Pending', icon: 'clock', iconColor: 'blue' };
|
||||
return 'pending';
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
@@ -165,16 +167,15 @@
|
||||
</TableCell>
|
||||
<TableCell title="Source">{entry.source}</TableCell>
|
||||
<TableCell title="Status">
|
||||
<div class="u-flex u-gap-4 u-cross-center">
|
||||
<i
|
||||
class="icon-{status.icon}"
|
||||
style="color: hsl(var(--color-text-{status.iconColor}))" />
|
||||
<span>{status.text}</span>
|
||||
</div>
|
||||
<Status {status}>
|
||||
{capitalize(status)}
|
||||
</Status>
|
||||
</TableCell>
|
||||
<TableCell title="">
|
||||
<Button secondary on:click={() => (details = entry.$id)}
|
||||
>Details</Button>
|
||||
<div class="u-flex u-main-end">
|
||||
<Button secondary on:click={() => (details = entry.$id)}
|
||||
>Details</Button>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{/each}
|
||||
@@ -182,7 +183,7 @@
|
||||
</Table>
|
||||
{:else}
|
||||
<div class="import-box">
|
||||
<ul class="avatars-group">
|
||||
<ul class="avatars-group is-with-border">
|
||||
<li class="avatars-group-item">
|
||||
<div class="avatar">
|
||||
<i class="icon-user-group" />
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { Modal } from '$lib/components';
|
||||
import { Alert, Code, Modal, Tab } from '$lib/components';
|
||||
import Tabs from '$lib/components/tabs.svelte';
|
||||
import { total } from '$lib/helpers/array';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { parseIfString } from '$lib/helpers/object';
|
||||
import { formatNum } from '$lib/helpers/string';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
|
||||
export let migrations: Models.Migration[] = [];
|
||||
@@ -39,8 +42,10 @@
|
||||
|
||||
const totalItems = (counter: StatusCounter) => {
|
||||
if (!counter) return 0;
|
||||
return Object.values(counter).reduce((acc, curr) => acc + curr, 0);
|
||||
return formatNum(total(Object.values(counter)));
|
||||
};
|
||||
|
||||
let tab = 'details' as 'details' | 'logs';
|
||||
</script>
|
||||
|
||||
<Modal bind:show on:close={() => (migrationId = null)} size="big">
|
||||
@@ -51,7 +56,14 @@
|
||||
Migration details
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
{#if details}
|
||||
<Tabs>
|
||||
<Tab selected={tab === 'details'} on:click={() => (tab = 'details')}>Details</Tab>
|
||||
<Tab selected={tab === 'logs'} on:click={() => (tab = 'logs')}>Logs</Tab>
|
||||
</Tabs>
|
||||
|
||||
{#if tab === 'logs'}
|
||||
<Code code={JSON.stringify(details, null, 2)} language="json" allowScroll />
|
||||
{:else if tab === 'details'}
|
||||
<div class="box meta">
|
||||
<span>Date</span>
|
||||
<span>{toLocaleDateTime(details.$createdAt)}</span>
|
||||
@@ -59,6 +71,21 @@
|
||||
<span>{details.source}</span>
|
||||
</div>
|
||||
|
||||
{#if Object.values(statusCounters).some(hasError)}
|
||||
<Alert
|
||||
type="error"
|
||||
buttons={[
|
||||
{
|
||||
name: 'View logs',
|
||||
method() {
|
||||
tab = 'logs';
|
||||
}
|
||||
}
|
||||
]}>
|
||||
There was an error migrating some of the project's entities.
|
||||
</Alert>
|
||||
{/if}
|
||||
|
||||
{#if Object.keys(statusCounters).length}
|
||||
<div class="box">
|
||||
{#each Object.keys(statusCounters) as entity}
|
||||
@@ -79,7 +106,7 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="u-capitalize">{entity}</span>
|
||||
<span class="u-capitalize">{entity + 's'}</span>
|
||||
<span class="inline-tag">{totalItems(entityCounter)}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { Alert, Modal } from '$lib/components';
|
||||
import { Button, InputText, InputTextarea } from '$lib/elements/forms';
|
||||
import { getFormData } from '$lib/helpers/form';
|
||||
import { feedback } from '$lib/stores/feedback';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { project } from '../../store';
|
||||
|
||||
@@ -48,7 +49,9 @@
|
||||
const formData = getFormData<{ endpoint: string; feedback: string }>(e);
|
||||
|
||||
// TODO: Send feedback somewhere
|
||||
const { endpoint, feedback: _feedback } = formData;
|
||||
const { endpoint, feedback: message } = formData;
|
||||
|
||||
await feedback.submitFeedback(`feedback-${$feedback.type}`, message);
|
||||
|
||||
if (!isValidEndpoint(endpoint)) {
|
||||
const endpointInput = document.getElementById('endpoint') as HTMLInputElement;
|
||||
|
||||
@@ -2,27 +2,16 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import {
|
||||
addSubPanel,
|
||||
registerCommands,
|
||||
registerSearchers,
|
||||
updateCommandGroupRanks
|
||||
} from '$lib/commandCenter';
|
||||
import { FilesPanel } from '$lib/commandCenter/panels';
|
||||
import { fileSearcher } from '$lib/commandCenter/searchers';
|
||||
import { project } from '../../store';
|
||||
import { showCreateFile } from './+page.svelte';
|
||||
import { bucket } from './store';
|
||||
|
||||
$: $registerCommands([
|
||||
{
|
||||
label: 'Search files',
|
||||
callback() {
|
||||
addSubPanel(FilesPanel);
|
||||
},
|
||||
keys: ['f', 'l'],
|
||||
group: 'files',
|
||||
icon: 'search'
|
||||
},
|
||||
{
|
||||
label: 'Create file',
|
||||
async callback() {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 2C5.55229 2 6 2.44772 6 3V4H7C7.55229 4 8 4.44772 8 5C8 5.55228 7.55229 6 7 6H6V7C6 7.55228 5.55229 8 5 8C4.44772 8 4 7.55228 4 7V6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H4V3C4 2.44772 4.44772 2 5 2ZM5 12C5.55229 12 6 12.4477 6 13V14H7C7.55229 14 8 14.4477 8 15C8 15.5523 7.55229 16 7 16H6V17C6 17.5523 5.55229 18 5 18C4.44772 18 4 17.5523 4 17V16H3C2.44772 16 2 15.5523 2 15C2 14.4477 2.44772 14 3 14H4V13C4 12.4477 4.44772 12 5 12Z" fill="url(#paint0_linear_1513_36621)"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9999 2C12.4537 2 12.8505 2.30548 12.9667 2.74411L14.1459 7.19893L17.4997 9.13381C17.8092 9.3124 17.9999 9.64262 17.9999 10C17.9999 10.3574 17.8092 10.6876 17.4997 10.8662L14.1459 12.8011L12.9667 17.2559C12.8505 17.6945 12.4537 18 11.9999 18C11.5462 18 11.1494 17.6945 11.0332 17.2559L9.85402 12.8011L6.50027 10.8662C6.19072 10.6876 6 10.3574 6 10C6 9.64262 6.19072 9.31241 6.50027 9.13382L9.85402 7.19893L11.0332 2.74411C11.1494 2.30548 11.5462 2 11.9999 2Z" fill="url(#paint1_linear_1513_36621)"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 2C5.55229 2 6 2.44772 6 3V4H7C7.55229 4 8 4.44772 8 5C8 5.55228 7.55229 6 7 6H6V7C6 7.55228 5.55229 8 5 8C4.44772 8 4 7.55228 4 7V6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H4V3C4 2.44772 4.44772 2 5 2ZM5 12C5.55229 12 6 12.4477 6 13V14H7C7.55229 14 8 14.4477 8 15C8 15.5523 7.55229 16 7 16H6V17C6 17.5523 5.55229 18 5 18C4.44772 18 4 17.5523 4 17V16H3C2.44772 16 2 15.5523 2 15C2 14.4477 2.44772 14 3 14H4V13C4 12.4477 4.44772 12 5 12Z" stroke="url(#paint2_linear_1513_36621)" stroke-width="0.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9999 2C12.4537 2 12.8505 2.30548 12.9667 2.74411L14.1459 7.19893L17.4997 9.13381C17.8092 9.3124 17.9999 9.64262 17.9999 10C17.9999 10.3574 17.8092 10.6876 17.4997 10.8662L14.1459 12.8011L12.9667 17.2559C12.8505 17.6945 12.4537 18 11.9999 18C11.5462 18 11.1494 17.6945 11.0332 17.2559L9.85402 12.8011L6.50027 10.8662C6.19072 10.6876 6 10.3574 6 10C6 9.64262 6.19072 9.31241 6.50027 9.13382L9.85402 7.19893L11.0332 2.74411C11.1494 2.30548 11.5462 2 11.9999 2Z" stroke="url(#paint3_linear_1513_36621)" stroke-width="0.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_1513_36621" x1="9.99998" y1="-5" x2="9.99998" y2="31.5" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#E8E9F0"/>
|
||||
<stop offset="1" stop-color="#E8E9F0" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_1513_36621" x1="9.99998" y1="-5" x2="9.99998" y2="31.5" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#E8E9F0"/>
|
||||
<stop offset="1" stop-color="#E8E9F0" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_1513_36621" x1="9.99997" y1="2" x2="9.99997" y2="18" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="white"/>
|
||||
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint3_linear_1513_36621" x1="9.99997" y1="2" x2="9.99997" y2="18" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="white"/>
|
||||
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
@@ -0,0 +1,24 @@
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 2C5.55229 2 6 2.44772 6 3V4H7C7.55229 4 8 4.44772 8 5C8 5.55228 7.55229 6 7 6H6V7C6 7.55228 5.55229 8 5 8C4.44772 8 4 7.55228 4 7V6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H4V3C4 2.44772 4.44772 2 5 2ZM5 12C5.55229 12 6 12.4477 6 13V14H7C7.55229 14 8 14.4477 8 15C8 15.5523 7.55229 16 7 16H6V17C6 17.5523 5.55229 18 5 18C4.44772 18 4 17.5523 4 17V16H3C2.44772 16 2 15.5523 2 15C2 14.4477 2.44772 14 3 14H4V13C4 12.4477 4.44772 12 5 12Z" fill="url(#paint0_linear_1513_36627)"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9999 2C12.4537 2 12.8505 2.30548 12.9667 2.74411L14.1459 7.19893L17.4997 9.13381C17.8092 9.3124 17.9999 9.64262 17.9999 10C17.9999 10.3574 17.8092 10.6876 17.4997 10.8662L14.1459 12.8011L12.9667 17.2559C12.8505 17.6945 12.4537 18 11.9999 18C11.5462 18 11.1494 17.6945 11.0332 17.2559L9.85402 12.8011L6.50027 10.8662C6.19072 10.6876 6 10.3574 6 10C6 9.64262 6.19072 9.31241 6.50027 9.13382L9.85402 7.19893L11.0332 2.74411C11.1494 2.30548 11.5462 2 11.9999 2Z" fill="url(#paint1_linear_1513_36627)"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 2C5.55229 2 6 2.44772 6 3V4H7C7.55229 4 8 4.44772 8 5C8 5.55228 7.55229 6 7 6H6V7C6 7.55228 5.55229 8 5 8C4.44772 8 4 7.55228 4 7V6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H4V3C4 2.44772 4.44772 2 5 2ZM5 12C5.55229 12 6 12.4477 6 13V14H7C7.55229 14 8 14.4477 8 15C8 15.5523 7.55229 16 7 16H6V17C6 17.5523 5.55229 18 5 18C4.44772 18 4 17.5523 4 17V16H3C2.44772 16 2 15.5523 2 15C2 14.4477 2.44772 14 3 14H4V13C4 12.4477 4.44772 12 5 12Z" stroke="url(#paint2_linear_1513_36627)" stroke-width="0.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9999 2C12.4537 2 12.8505 2.30548 12.9667 2.74411L14.1459 7.19893L17.4997 9.13381C17.8092 9.3124 17.9999 9.64262 17.9999 10C17.9999 10.3574 17.8092 10.6876 17.4997 10.8662L14.1459 12.8011L12.9667 17.2559C12.8505 17.6945 12.4537 18 11.9999 18C11.5462 18 11.1494 17.6945 11.0332 17.2559L9.85402 12.8011L6.50027 10.8662C6.19072 10.6876 6 10.3574 6 10C6 9.64262 6.19072 9.31241 6.50027 9.13382L9.85402 7.19893L11.0332 2.74411C11.1494 2.30548 11.5462 2 11.9999 2Z" stroke="url(#paint3_linear_1513_36627)" stroke-width="0.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_1513_36627" x1="9.99998" y1="-5" x2="9.99998" y2="31.5" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FD366E"/>
|
||||
<stop offset="1" stop-color="#FD366E" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_1513_36627" x1="9.99998" y1="-5" x2="9.99998" y2="31.5" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FD366E"/>
|
||||
<stop offset="1" stop-color="#FD366E" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_1513_36627" x1="9.99997" y1="2" x2="9.99997" y2="18" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="white"/>
|
||||
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint3_linear_1513_36627" x1="9.99997" y1="2" x2="9.99997" y2="18" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="white"/>
|
||||
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
Reference in new issue
Block a user