mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix(dev-keys): remove dev key creation, add deprecation notice
Dev key creation is no longer allowed. Removes the create button, create modal, empty-state create action, and command palette entry, and adds a deprecation alert linking the changelog: https://appwrite.io/changelog/entry/2026-07-22
This commit is contained in:
1 parent
c424116653
commit
d9db09f0fb
6 files changed
+43
-110
No files matched your search
+20
-10
@@ -7,8 +7,9 @@
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { diffDays } from '$lib/helpers/date';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
import { devKeyColumns, keyColumns, showDevKeysCreateModal } from '../store';
|
||||
import { Badge, Layout, Table } from '@appwrite.io/pink-svelte';
|
||||
import { devKeyColumns, keyColumns } from '../store';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Badge, Card, Empty as EmptyState, Layout, Table } from '@appwrite.io/pink-svelte';
|
||||
import DeleteBatch from './deleteBatch.svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
|
||||
@@ -127,7 +128,7 @@
|
||||
{offset}
|
||||
total={keys.total} />
|
||||
{/if}
|
||||
{:else}
|
||||
{:else if isApiKey}
|
||||
<Empty
|
||||
single
|
||||
allowCreate={$canWriteKeys}
|
||||
@@ -135,14 +136,23 @@
|
||||
target="{label} key"
|
||||
description={getDescription()}
|
||||
on:click={async () => {
|
||||
if (isApiKey) {
|
||||
await goto(
|
||||
`${base}/project-${page.params.region}-${page.params.project}/overview/${slug}/create`
|
||||
);
|
||||
} else {
|
||||
$showDevKeysCreateModal = true;
|
||||
}
|
||||
await goto(
|
||||
`${base}/project-${page.params.region}-${page.params.project}/overview/${slug}/create`
|
||||
);
|
||||
}} />
|
||||
{:else}
|
||||
<Card.Base padding="none">
|
||||
<EmptyState title="No dev keys" description={getDescription()}>
|
||||
<svelte:fragment slot="actions">
|
||||
<Button
|
||||
external
|
||||
href="https://appwrite.io/docs/advanced/platform/{slug}"
|
||||
text
|
||||
size="s"
|
||||
ariaLabel="dev keys documentation">Documentation</Button>
|
||||
</svelte:fragment>
|
||||
</EmptyState>
|
||||
</Card.Base>
|
||||
{/if}
|
||||
|
||||
<DeleteBatch {keyType} bind:keyIds={selectedKeys} bind:showDelete={showDeleteModal} />
|
||||
@@ -93,16 +93,6 @@
|
||||
keys: ['c', 'k'],
|
||||
group: 'integrations',
|
||||
disabled: !$canWriteProjects
|
||||
},
|
||||
{
|
||||
label: 'Create Dev Key',
|
||||
icon: IconPlus,
|
||||
callback() {
|
||||
goto(`${path}/dev-keys/create`);
|
||||
},
|
||||
keys: ['c', 'd', 'k'],
|
||||
group: 'integrations',
|
||||
disabled: !$canWriteProjects
|
||||
}
|
||||
]);
|
||||
$updateCommandGroupRanks({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { getContext, type Component } from 'svelte';
|
||||
import type { Writable } from 'svelte/store';
|
||||
|
||||
export type OverviewActionContext = Writable<Component>;
|
||||
export type OverviewActionContext = Writable<Component | null>;
|
||||
|
||||
export function setOverviewAction(component: Component) {
|
||||
export function setOverviewAction(component: Component | null) {
|
||||
getContext<OverviewActionContext>('overview-action').set(component);
|
||||
}
|
||||
@@ -1,11 +1,27 @@
|
||||
<script lang="ts">
|
||||
import Action from './action.svelte';
|
||||
import { setOverviewAction } from '../context';
|
||||
import Table from '../(components)/table.svelte';
|
||||
import { Alert, Layout, Typography } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let data;
|
||||
let { data } = $props();
|
||||
|
||||
setOverviewAction(Action);
|
||||
setOverviewAction(null);
|
||||
</script>
|
||||
|
||||
<Table keys={data.devKeys} keyType="dev" />
|
||||
<Layout.Stack gap="l">
|
||||
<Alert.Inline status="warning" title="Dev keys are deprecated">
|
||||
<Typography.Text>
|
||||
Creating new dev keys is no longer supported. Existing dev keys keep working until they
|
||||
expire. Learn more in the
|
||||
<a
|
||||
href="https://appwrite.io/changelog/entry/2026-07-22"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
style="text-decoration: underline;">
|
||||
changelog
|
||||
</a>.
|
||||
</Typography.Text>
|
||||
</Alert.Inline>
|
||||
|
||||
<Table keys={data.devKeys} keyType="dev" />
|
||||
</Layout.Stack>
|
||||
@@ -1,81 +0,0 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/elements/forms/button.svelte';
|
||||
import { canWriteKeys } from '$lib/stores/roles';
|
||||
import { Icon, Modal, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Form, InputText } from '$lib/elements/forms/index.js';
|
||||
import { ExpirationInput } from '$lib/components';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { goto } from '$app/navigation';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { base } from '$app/paths';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { page } from '$app/state';
|
||||
import { showDevKeysCreateModal } from '$routes/(console)/project-[region]-[project]/overview/store';
|
||||
|
||||
let name = '';
|
||||
let expire = null;
|
||||
let isSubmitting = false;
|
||||
const projectId = page.params.project;
|
||||
|
||||
async function create() {
|
||||
try {
|
||||
isSubmitting = true;
|
||||
const { $id } = await sdk.forConsole.projects.createDevKey({
|
||||
projectId,
|
||||
name,
|
||||
expire
|
||||
});
|
||||
|
||||
$showDevKeysCreateModal = false;
|
||||
trackEvent(Submit.DevKeyCreate);
|
||||
await goto(
|
||||
`${base}/project-${page.params.region}-${page.params.project}/overview/dev-keys/${$id}`
|
||||
);
|
||||
addNotification({
|
||||
message: `Dev key has been created`,
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.DevKeyCreate);
|
||||
} finally {
|
||||
isSubmitting = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if $canWriteKeys}
|
||||
<Button on:click={() => ($showDevKeysCreateModal = true)}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Create dev key
|
||||
</Button>
|
||||
|
||||
<Form onSubmit={create} isModal>
|
||||
<Modal title="Create dev key" bind:open={$showDevKeysCreateModal}>
|
||||
<span slot="description">
|
||||
Bypass Appwrite rate limits and CORS errors in your development environment.
|
||||
</span>
|
||||
|
||||
<Layout.Stack>
|
||||
<InputText
|
||||
id="name"
|
||||
label="Name"
|
||||
placeholder="Enter key name"
|
||||
required
|
||||
bind:value={name} />
|
||||
|
||||
<ExpirationInput bind:value={expire} expiryOptions="limited" />
|
||||
</Layout.Stack>
|
||||
|
||||
<Layout.Stack direction="row" justifyContent="flex-end" slot="footer">
|
||||
<Button fullWidthMobile secondary on:click={() => ($showDevKeysCreateModal = false)}
|
||||
>Cancel</Button>
|
||||
<Button fullWidthMobile submit disabled={isSubmitting}>Create</Button>
|
||||
</Layout.Stack>
|
||||
</Modal>
|
||||
</Form>
|
||||
{/if}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { cachedStore } from '$lib/helpers/cache';
|
||||
import { get, readable, writable, type Writable } from 'svelte/store';
|
||||
import { get, readable } from 'svelte/store';
|
||||
import type { Models, ProjectUsageRange } from '@appwrite.io/console';
|
||||
import { page } from '$app/state';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
@@ -25,8 +25,6 @@ export const usage = cachedStore<
|
||||
};
|
||||
});
|
||||
|
||||
export const showDevKeysCreateModal: Writable<boolean> = writable(false);
|
||||
|
||||
export const devKeyColumns = readable<Column[]>([
|
||||
{ id: 'name', title: 'Name', type: 'string', width: { min: 120 } },
|
||||
{ id: 'last_accessed', title: 'Last accessed', type: 'datetime', width: { min: 120 } },
|
||||
|
||||
Reference in new issue
Block a user