Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command center and migrations #479

Merged
merged 143 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
fc2932b
feat: command center POC
TGlide May 15, 2023
a7c53ae
feat: multi key commands
TGlide May 15, 2023
afcbb5d
refactor: one-liner registers
TGlide May 15, 2023
05d9cb7
refactor: cleaner registerCommand fn
TGlide May 15, 2023
41ce56e
fix: onboarding missing shortcus
TGlide May 16, 2023
bf77043
fix: disabling commands
TGlide May 16, 2023
adbd2c7
fix: command key order
TGlide May 16, 2023
46c7a26
refactor: disable commands on input elements
TGlide May 16, 2023
ea8a924
feat: cmd center animation
TGlide May 16, 2023
6874ab2
feat: more command center animations
TGlide May 16, 2023
d01c078
refactor: command center positioning
TGlide May 16, 2023
7de0a21
refactor: animation changes
TGlide May 16, 2023
142e89a
fix: enter bug
TGlide May 16, 2023
dce2d82
Merge branch 'command-center-poc' of https://github.com/appwrite/cons…
TGlide May 16, 2023
7badf3a
refactor: improve commands
TGlide May 16, 2023
318d72d
refactor: rename fn
TGlide May 16, 2023
de42801
feat(wip): ai command panel
TGlide May 19, 2023
411fa32
feat(wip): ask ai
TGlide May 19, 2023
ca7c9c0
feat: ai panel
TGlide May 22, 2023
ba27b42
feat: migrations screen
TGlide May 30, 2023
5069ee2
feat: initial migrations page
TGlide May 31, 2023
0a74fd9
feat: migrations wizard structure
TGlide May 31, 2023
920c65f
feat: migrations select data form
TGlide May 31, 2023
47d51eb
feat: more mocked ui
TGlide Jun 5, 2023
9cb611b
chore: small changes
TGlide Jun 6, 2023
6ac6c6a
feat: migrations sdk impl
TGlide Jun 7, 2023
29d5826
refactor: failed status
TGlide Jun 7, 2023
7a18b76
feat: export data modal
TGlide Jun 9, 2023
1ca164b
feat: supabase and nhost forms
TGlide Jun 14, 2023
9382eff
refactor: command center styles
TGlide Jun 14, 2023
92032f5
fix: ai
TGlide Jun 15, 2023
5256a13
refactor: small changes
TGlide Jun 20, 2023
09df201
feat: grouped options
TGlide Jun 20, 2023
1ee4daf
feat: basic search functionality
TGlide Jun 21, 2023
bd3c086
feat: improve search
TGlide Jun 21, 2023
7a6a44d
Update imports
PineappleIOnic Jul 3, 2023
f32e1d5
refactor: migrations
TGlide Jul 3, 2023
2bfd693
feat: command center icons
TGlide Jul 3, 2023
21de81d
refactor: details modal & self-hosted screens
TGlide Jul 5, 2023
59ccdf8
Merge branch 'migrations' into migrations-bradley
PineappleIOnic Jul 5, 2023
1daa098
refactor: vercel ai sdk
TGlide Jul 7, 2023
e7c9eab
command center styling
TGlide Jul 7, 2023
60591cc
Implement new SDK Methods and Reporting
PineappleIOnic Jul 10, 2023
0bbd82e
feat: AI restyling and examples
TGlide Jul 10, 2023
1c0b050
fix: command center styles
TGlide Jul 10, 2023
f977fab
force redeploy
TGlide Jul 10, 2023
e91ef41
pnpm fixes everything
TGlide Jul 10, 2023
1a9207d
refactor: change installCommand
TGlide Jul 10, 2023
b4c1516
back to npm
TGlide Jul 10, 2023
cf21609
fix: ai streaming
TGlide Jul 10, 2023
e6363ec
feat: find projects command
TGlide Jul 11, 2023
e983413
feat: streamed projects
TGlide Jul 11, 2023
dd0bc31
refactor: minor cmdCenter changes
TGlide Jul 11, 2023
89255a1
feat: basic command prioritization
TGlide Jul 11, 2023
79feb7d
refactor: improve command ranking algorithm
TGlide Jul 11, 2023
edea04c
refactor: further improve cmd ranking
TGlide Jul 11, 2023
7d4009f
command center debug
TGlide Jul 12, 2023
311d5c8
feat: working migrations & details
TGlide Jul 12, 2023
c8e9da2
mock deploy to cloud & self-hosted
TGlide Jul 12, 2023
aef914d
add commands & fix command kbd selection
TGlide Jul 12, 2023
1957154
feat: ranked groups and options
TGlide Jul 13, 2023
4238efe
refactor: improve group ranking functionality
TGlide Jul 13, 2023
cb20d7a
Merge branch 'migrations-t' into command-center-and-migrations
TGlide Jul 13, 2023
11dd905
migrations stuff
TGlide Jul 13, 2023
13e972d
more commands
TGlide Jul 14, 2023
d02fd1c
add search icon
TGlide Jul 17, 2023
09a9be3
feat: basic export data modal functionality
TGlide Jul 17, 2023
23cb171
refactor: migration export
TGlide Jul 17, 2023
cd193f2
fix: progress color & loader
TGlide Jul 17, 2023
40396d2
feat: mocked deploy to cloud
TGlide Jul 17, 2023
08f0202
feat: deploy to cloud & export to self-hosted
TGlide Jul 17, 2023
a4fddd6
remove key debug on input events
TGlide Jul 17, 2023
575dcf2
feat: add auth commands
TGlide Jul 17, 2023
248fbb6
reactive details
TGlide Jul 17, 2023
5535d43
fix details
TGlide Jul 17, 2023
9de3158
refactor: small changes
TGlide Jul 17, 2023
e11b177
ai examples kbd nav
TGlide Jul 17, 2023
297974f
storage commands
TGlide Jul 17, 2023
597ae77
add password inputs
TGlide Jul 18, 2023
cfd815d
fix: supabase & nhost formdata
TGlide Jul 18, 2023
b9c4393
fix deploy
TGlide Jul 20, 2023
7c03f05
feat: user searcher
TGlide Jul 20, 2023
ece145d
feat: more searchers
TGlide Jul 20, 2023
791f55f
nested commands
TGlide Jul 20, 2023
2e13a56
fix: modifier keys triggering non modifier commands
TGlide Jul 21, 2023
9a31ce8
more searchers & commands
TGlide Jul 21, 2023
10acb77
more commands
TGlide Jul 22, 2023
1fb3a01
db commands
TGlide Jul 22, 2023
14051cc
more commands & searchers & version check
TGlide Jul 24, 2023
c76a61e
feat: import from org settings
TGlide Jul 24, 2023
fe90912
fix: report
TGlide Jul 24, 2023
f0961b4
feat: firebase migrations wip
TGlide Jul 24, 2023
8c4825f
commands & migrations fixes
TGlide Jul 24, 2023
41102e6
function commands
TGlide Jul 24, 2023
e45823f
function commands
TGlide Jul 24, 2023
92d3baf
more fn commands & icons
TGlide Jul 25, 2023
0b21fe4
storage commands
TGlide Jul 25, 2023
1fdd2fc
add light theme
TGlide Jul 27, 2023
263e328
basic db selection
TGlide Jul 27, 2023
92af191
bulk db deletion
TGlide Jul 27, 2023
cee7726
nanoid instead of cyrpto.randomUUID
TGlide Jul 27, 2023
d0693ad
Merge branch 'command-center-and-migrations' into bulk-deletion
TGlide Jul 27, 2023
382b473
collection deletion
TGlide Jul 27, 2023
5d2aace
Start work on firebase OAuth
PineappleIOnic Jul 28, 2023
f922cc1
Update sdk.ts
PineappleIOnic Jul 28, 2023
274e110
Add stage 2 of Firebase OAuth
PineappleIOnic Jul 28, 2023
8d8d690
feat: document bulk deletion
TGlide Jul 28, 2023
d32bfc5
Update step1.svelte
PineappleIOnic Aug 1, 2023
ea2ae81
small changes
TGlide Aug 1, 2023
57d5541
Merge branch 'command-center-and-migrations' into filtering
TGlide Aug 1, 2023
ccc9a72
basic styling
TGlide Aug 1, 2023
42c8e91
basic filter add & theme command
TGlide Aug 2, 2023
836a3b0
firebase oauth changes
TGlide Aug 3, 2023
58f652f
Add 401 catch to firebaseProjects
PineappleIOnic Aug 4, 2023
2664b54
working filtering
TGlide Aug 4, 2023
545a256
add more filters
TGlide Aug 6, 2023
6cb932b
basic query param save data
TGlide Aug 6, 2023
d437f64
improve filtering
TGlide Aug 7, 2023
deb173a
sentence case commands
TGlide Aug 7, 2023
29924a2
Update API's
PineappleIOnic Aug 7, 2023
1c8d520
pr changes
TGlide Aug 7, 2023
e8f73d5
Merge branch 'command-center-and-migrations' of https://github.com/ap…
TGlide Aug 7, 2023
1a9a61d
Merge branch 'main' into command-center-and-migrations
TGlide Aug 7, 2023
f9c9b19
disable cmd center on wizards and modals
TGlide Aug 7, 2023
8b6ae78
Merge branch 'command-center-and-migrations' of https://github.com/ap…
TGlide Aug 7, 2023
1cfe0e3
address pr reviews
TGlide Aug 7, 2023
68f8fe7
Merge branch 'command-center-and-migrations' into bulk-deletion
TGlide Aug 7, 2023
d5e26ca
fix multiple selection checkbox
TGlide Aug 7, 2023
c8b6048
tableCellHeadCheck cmp
TGlide Aug 7, 2023
87a4ef3
refactor: pr changes
TGlide Aug 8, 2023
bf9617e
small changes
TGlide Aug 8, 2023
1c38e70
Update src/routes/console/project-[project]/databases/database-[datab…
TGlide Aug 9, 2023
5d4d2ff
review changes
TGlide Aug 9, 2023
3164453
add command tracking
TGlide Aug 9, 2023
98143ef
Merge pull request #485 from appwrite/bulk-deletion
christyjacob4 Aug 9, 2023
6d9a528
filtering mobile
TGlide Aug 9, 2023
dd44289
Merge branch 'bulk-deletion' into filtering
TGlide Aug 9, 2023
35a74b2
Merge pull request #490 from appwrite/filtering
christyjacob4 Aug 9, 2023
6cb9333
Merge pull request #497 from appwrite/bulk-deletion
TGlide Aug 9, 2023
5d5f6a0
file changes
TGlide Aug 9, 2023
d64b9cd
Merge branch 'main' into command-center-and-migrations
TGlide Aug 9, 2023
af6480a
small changes
TGlide Aug 9, 2023
e674fe3
Merge branch 1.4.x into command-center-and-migrations
TGlide Aug 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ node_modules
node_modules/
dist/
.vercel

*.swp
3,951 changes: 2,412 additions & 1,539 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
"@popperjs/core": "^2.11.6",
"@sentry/svelte": "^7.44.2",
"@sentry/tracing": "^7.44.2",
"ai": "^2.1.15",
"analytics": "^0.8.1",
"dotenv": "^16.0.3",
"echarts": "^5.4.1",
"logrocket": "^3.0.1",
"nanoid": "^4.0.2",
"pretty-bytes": "^6.1.0",
"prismjs": "^1.29.0",
"svelte-confetti": "^1.2.2",
Expand Down
42 changes: 42 additions & 0 deletions src/lib/actions/portal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { tick } from 'svelte';
import type { Action } from 'svelte/action';

export type PortalConfig = string | HTMLElement | undefined;

export const portal: Action<HTMLElement, PortalConfig> = (el, target = 'body') => {
let targetEl;

async function update(newTarget: PortalConfig) {
target = newTarget;
if (typeof target === 'string') {
targetEl = document.querySelector(target);
if (targetEl === null) {
await tick();
targetEl = document.querySelector(target);
}
if (targetEl === null) {
throw new Error(`No element found matching css selector: "${target}"`);
}
} else if (target instanceof HTMLElement) {
targetEl = target;
} else {
throw new TypeError(
`Unknown portal target type: ${
target === null ? 'null' : typeof target
}. Allowed types: string (CSS selector) or HTMLElement.`
);
}
targetEl.appendChild(el);
el.hidden = false;
}

function destroy() {
el.remove();
}

update(target);
return {
update,
destroy
};
};
142 changes: 142 additions & 0 deletions src/lib/commandCenter/commandCenter.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<script lang="ts" context="module">
type Context = Readable<{
isInitialPanel: boolean;
open: boolean;
}>;
type ReadableValue<T> = T extends Readable<infer U> ? U : never;

const contextKey = 'command-center';
export const getCommandCenterCtx = () => getContext<Context>(contextKey);
const setCommandCenterCtx = (value: ReadableValue<Context>) => {
const store = writable(value);
setContext(contextKey, store);
return store;
};

export const toggleCommandCenter = () => {
if (get(subPanels).length > 0) {
clearSubPanels();
} else {
addSubPanel(RootPanel);
}
};
</script>

<script lang="ts">
import { dev } from '$app/environment';
import { portal } from '$lib/actions/portal';
import { last } from '$lib/helpers/array';
import { debounce } from '$lib/helpers/debounce';
import { getContext, setContext } from 'svelte';
import { get, writable, type Readable } from 'svelte/store';
import { fade } from 'svelte/transition';
import { commandCenterKeyDownHandler, disableCommands, registerCommands } from './commands';
import { RootPanel } from './panels';
import { addSubPanel, clearSubPanels, subPanels } from './subPanels';

$: $registerCommands([
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we typically put all these $: at the end?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily, as the order of where they are matters (Svelte uses static code analysis to determine how to execute the code, so we can't be super liberal with this: https://svelte.dev/docs/svelte-components#script-3-$-marks-a-statement-as-reactive)

{
callback: toggleCommandCenter,
keys: ['k'],
ctrl: true,
forceEnable: true
}
]);

$: openSubPanel = last($subPanels) ?? null;
$: $disableCommands(!!openSubPanel);

$: if (openSubPanel) {
document.documentElement.classList.add('u-overflow-hidden');
} else {
document.documentElement.classList.remove('u-overflow-hidden');
}

let dialog: HTMLDivElement;

function handleBlur(event: MouseEvent) {
if (event.target === dialog) {
clearSubPanels();
}
}

const ctx = setCommandCenterCtx({
isInitialPanel: true,
open: false
});

$: if (!openSubPanel) {
$ctx.isInitialPanel = true;
}
$: $subPanels.length > 1 && ($ctx.isInitialPanel = false);

$: $ctx.open = !!openSubPanel;

let keys: string[] = [];

const resetKeys = debounce(() => {
keys = [];
}, 1000);

function isInputEvent(event: KeyboardEvent) {
return ['INPUT', 'TEXTAREA', 'SELECT'].includes((event.target as HTMLElement).tagName);
}

const handleKeydown = (e) => {
if (!$subPanels.length) {
if (isInputEvent(e)) return;
keys = [...keys, e.key].slice(-10);
resetKeys();
}
$commandCenterKeyDownHandler(e);
};
</script>

<svelte:window on:mousedown={handleBlur} on:keydown={handleKeydown} />

{#if openSubPanel}
<div class="dialog" bind:this={dialog} transition:fade={{ duration: 100 }}>
<svelte:component this={openSubPanel.component} />
</div>
{/if}

{#if dev}
<div class="debug-keys" use:portal>
{#each keys as key, i (i)}
<kbd class="kbd" transition:fade|local={{ duration: 150 }}>
{key.length === 1 ? key.toUpperCase() : key}
</kbd>
{/each}
</div>
{/if}

<style lang="scss">
.dialog {
padding: 0.5rem;
position: fixed;
inset: 0;

background-color: hsl(var(--color-neutral-500) / 0.5);
z-index: 9999;
}

.debug-keys {
position: fixed;
bottom: 10%;
left: 50%;
transform: translateX(-50%);
padding: 0.5rem;
// background-color: hsl(var(--color-neutral-500) / 0.5);
z-index: 9999;

display: flex;
gap: 1rem;

font-size: 2rem;

.kbd {
padding-inline: 0.5rem;
padding-block: 1.5rem;
}
}
</style>
Loading