Skip to content

Commit 24ce79c

Browse files
committed
Merge branch 'main' into fix-realtime-logic
2 parents bb65ce2 + 52dc725 commit 24ce79c

12 files changed

Lines changed: 181 additions & 54 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Copilot Setup Steps
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
pull_request:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
14+
jobs:
15+
copilot-setup-steps:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
steps:
20+
- uses: actions/checkout@v5
21+
- name: Use Node.js
22+
uses: actions/setup-node@v6
23+
with:
24+
node-version: 20
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script lang="ts">
2+
import { Copy } from '.';
3+
import { Icon, Tag } from '@appwrite.io/pink-svelte';
4+
import { IconDuplicate } from '@appwrite.io/pink-icons-svelte';
5+
import { getProjectEndpoint } from '$lib/helpers/project';
6+
</script>
7+
8+
<Copy value={getProjectEndpoint()} copyText="Copy endpoint">
9+
<Tag size="xs" variant="code">
10+
<Icon icon={IconDuplicate} size="s" slot="start" />
11+
<span style:white-space="nowrap" style:overflow="hidden" style:word-break="break-all">
12+
API endpoint
13+
</span>
14+
</Tag>
15+
</Copy>

src/lib/components/copy.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
disabled={tooltipDisabled}
5858
portal={tooltipPortal}
5959
delay={tooltipDelay}
60+
maxWidth="500px"
6061
placement={tooltipPlacement}>
6162
<span
6263
data-private

src/lib/components/id.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,11 @@
9595
export let tooltipPortal = false;
9696
export let tooltipDelay: number = 0;
9797
export let tooltipPlacement: TooltipPlacement = undefined;
98+
export let copyText: string | undefined = undefined;
9899
</script>
99100

100101
{#key value}
101-
<Copy {value} {event} {tooltipPortal} {tooltipDelay} {tooltipPlacement}>
102+
<Copy {value} {event} {tooltipPortal} {tooltipDelay} {tooltipPlacement} {copyText}>
102103
<Tag size="xs" variant="code">
103104
<Icon icon={IconDuplicate} size="s" slot="start" />
104105
<span

src/lib/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export { default as BottomSheet } from './bottom-sheet/index';
8282
export { default as Confirm } from './confirm.svelte';
8383
export { default as UsageCard } from './usageCard.svelte';
8484
export { default as ViewToggle } from './viewToggle.svelte';
85+
export { default as ApiEndpoint } from './apiEndpoint.svelte';
8586
export { default as RegionEndpoint } from './regionEndpoint.svelte';
8687
export { default as ExpirationInput } from './expirationInput.svelte';
8788
export { default as EstimatedCard } from './estimatedCard.svelte';
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script lang="ts">
22
import { Copy } from '.';
33
import { sdk } from '$lib/stores/sdk';
4-
import { Layout, Tag } from '@appwrite.io/pink-svelte';
4+
import { Icon, Tag } from '@appwrite.io/pink-svelte';
5+
import { IconDuplicate } from '@appwrite.io/pink-icons-svelte';
56
import { Flag, type Models } from '@appwrite.io/console';
6-
import { truncateText } from '$lib/components/id.svelte';
77
import { isValueOfStringEnum } from '$lib/helpers/types';
88
import { getProjectEndpoint } from '$lib/helpers/project';
99
@@ -21,28 +21,28 @@
2121
</script>
2222

2323
{#if region}
24-
<Copy value={getProjectEndpoint()} copyText="Copy endpoint">
25-
<Tag size="xs" variant="default">
26-
<Layout.Stack direction="row" gap="s" alignItems="center" inline>
27-
{#if flagSrc}
28-
<img
29-
width={16}
30-
height={12}
31-
src={flagSrc}
32-
alt={region?.name}
33-
style:border-radius="2.5px" />
34-
{/if}
35-
36-
<span
37-
style:white-space="nowrap"
38-
class="text u-line-height-1-5"
39-
style:overflow="hidden"
40-
style:word-break="break-all"
41-
use:truncateText
42-
style:font-family="unset">
43-
{region?.name}
44-
</span>
45-
</Layout.Stack>
24+
<Copy value={getProjectEndpoint()} copyText={`Copy endpoint (${region.name})`}>
25+
<Tag size="xs" variant="code">
26+
<Icon icon={IconDuplicate} size="s" slot="start" />
27+
<span class="endpoint-label"> API endpoint </span>
28+
{#if flagSrc}
29+
<img class="region-flag" src={flagSrc} alt={region?.name} />
30+
{/if}
4631
</Tag>
4732
</Copy>
4833
{/if}
34+
35+
<style>
36+
.endpoint-label {
37+
white-space: nowrap;
38+
overflow: hidden;
39+
word-break: break-all;
40+
}
41+
42+
.region-flag {
43+
width: 16px;
44+
height: 12px;
45+
border-radius: 2.5px;
46+
margin-inline-start: 6px;
47+
}
48+
</style>

src/routes/(console)/project-[region]-[project]/overview/(components)/create.svelte

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import { writable } from 'svelte/store';
1616
import Scopes from '../api-keys/scopes.svelte';
1717
import { page } from '$app/state';
18+
import { copy } from '$lib/helpers/copy';
1819
1920
const projectId = page.params.project;
2021
@@ -28,7 +29,7 @@
2829
2930
async function create() {
3031
try {
31-
const { $id } = await sdk.forConsole.projects.createKey({
32+
const { $id, secret } = await sdk.forConsole.projects.createKey({
3233
projectId,
3334
name,
3435
scopes,
@@ -45,7 +46,21 @@
4546
);
4647
addNotification({
4748
message: `API key has been created`,
48-
type: 'success'
49+
type: 'success',
50+
buttons: [
51+
{
52+
name: 'Copy API key',
53+
method: async () => {
54+
await copy(secret);
55+
}
56+
},
57+
{
58+
name: 'Copy endpoint',
59+
method: async () => {
60+
await copy(sdk.forConsole.client.config.endpoint);
61+
}
62+
}
63+
]
4964
});
5065
} catch (error) {
5166
addNotification({

src/routes/(console)/project-[region]-[project]/overview/api-keys/[key]/header.svelte

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import { page } from '$app/state';
44
import { Cover, CoverTitle } from '$lib/layout';
55
import { key } from './store';
6+
import { RegionEndpoint, Copy } from '$lib/components';
7+
import { Layout, Tag, Icon } from '@appwrite.io/pink-svelte';
8+
import { IconDuplicate } from '@appwrite.io/pink-icons-svelte';
9+
import { projectRegion } from '../../../store';
610
711
const projectId = page.params.project;
812
</script>
@@ -12,5 +16,26 @@
1216
<CoverTitle href={`${base}/project-${page.params.region}-${projectId}/overview/api-keys`}>
1317
{$key?.name}
1418
</CoverTitle>
19+
<Layout.Stack direction="row" inline>
20+
{#if $key?.secret}
21+
<Copy value={$key.secret} copyText="Copy API secret">
22+
<Tag size="xs" variant="code">
23+
<Icon icon={IconDuplicate} size="s" slot="start" />
24+
<span class="api-secret-label"> API secret </span>
25+
</Tag>
26+
</Copy>
27+
{/if}
28+
{#if $projectRegion}
29+
<RegionEndpoint region={$projectRegion} />
30+
{/if}
31+
</Layout.Stack>
1532
</svelte:fragment>
1633
</Cover>
34+
35+
<style>
36+
.api-secret-label {
37+
white-space: nowrap;
38+
overflow: hidden;
39+
word-break: break-all;
40+
}
41+
</style>
308 KB
Loading
31 KB
Loading

0 commit comments

Comments
 (0)