mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge branch 'feat-pink-v2' into 'file-tokens'.
This commit is contained in:
commit
aae9382b95
814 files changed
+13032
-16397
No files matched your search
@@ -1,10 +0,0 @@
|
||||
src/sdk.ts
|
||||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
/playwright-report
|
||||
@@ -1,43 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:svelte/recommended',
|
||||
'prettier'
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
extraFileExtensions: ['.svelte'], // This is a required setting in `@typescript-eslint/parser` v4.24.0.
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2020
|
||||
},
|
||||
ignorePatterns: ['*.cjs'],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.svelte'],
|
||||
parser: 'svelte-eslint-parser',
|
||||
parserOptions: {
|
||||
parser: '@typescript-eslint/parser' //This is required to parse TypeScript inside Svelte files.
|
||||
}
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
'no-redeclare': 'off',
|
||||
'@typescript-eslint/no-duplicate-enum-values': 'off',
|
||||
'svelte/no-at-html-tags': 'off',
|
||||
'no-unused-vars': 'off', // This rule is handled by `@typescript-eslint/no-unused-vars` so it needs to be disabled to avoid conflicts.
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^(_|\\$\\$)' } // Ignore unused variables starting with `_` or `$$`.
|
||||
]
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
es2017: true,
|
||||
node: true
|
||||
},
|
||||
globals: {
|
||||
globalThis: false // false means it is not writeable
|
||||
}
|
||||
};
|
||||
@@ -25,8 +25,6 @@ jobs:
|
||||
run: pnpm audit --audit-level high
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
- name: Run sync
|
||||
run: pnpm run sync
|
||||
- name: Svelte Diagnostics
|
||||
run: pnpm run check
|
||||
- name: Linter
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ ENV PUBLIC_STRIPE_KEY=$PUBLIC_STRIPE_KEY
|
||||
ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN
|
||||
ENV NODE_OPTIONS=--max_old_space_size=8192
|
||||
|
||||
RUN pnpm run sync && pnpm run build
|
||||
RUN pnpm run build
|
||||
|
||||
FROM nginx:1.25-alpine
|
||||
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,51 @@
|
||||
import prettier from 'eslint-config-prettier';
|
||||
import js from '@eslint/js';
|
||||
import { includeIgnoreFile } from '@eslint/compat';
|
||||
import svelte from 'eslint-plugin-svelte';
|
||||
import globals from 'globals';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import ts from 'typescript-eslint';
|
||||
import svelteConfig from './svelte.config.js';
|
||||
|
||||
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
|
||||
|
||||
export default ts.config(
|
||||
includeIgnoreFile(gitignorePath),
|
||||
js.configs.recommended,
|
||||
...ts.configs.recommended,
|
||||
...svelte.configs.recommended,
|
||||
prettier,
|
||||
...svelte.configs.prettier,
|
||||
{
|
||||
languageOptions: {
|
||||
globals: { ...globals.browser, ...globals.node }
|
||||
},
|
||||
rules: {
|
||||
// TODO: remove them one by one
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-duplicate-enum-values': 'off',
|
||||
'@typescript-eslint/no-empty-object-type': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'off',
|
||||
'svelte/infinite-reactive-loop': 'off',
|
||||
'svelte/require-each-key': 'off',
|
||||
'svelte/no-immutable-reactive-statements': 'off',
|
||||
'svelte/no-at-html-tags': 'off',
|
||||
'svelte/no-useless-mustaches': 'off',
|
||||
'svelte/no-reactive-reassign': 'off',
|
||||
'svelte/no-reactive-literals': 'off'
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
|
||||
ignores: ['eslint.config.js', 'svelte.config.js'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
// Only uncomment this if you want it to take 3 minutes https://github.com/sveltejs/eslint-plugin-svelte/issues/1084
|
||||
// projectService: true,
|
||||
extraFileExtensions: ['.svelte'],
|
||||
parser: ts.parser,
|
||||
svelteConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
+48
-37
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "@appwrite/console",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
@@ -7,78 +8,88 @@
|
||||
"dev": "vite dev",
|
||||
"build": "node build.js",
|
||||
"preview": "vite preview",
|
||||
"sync": "svelte-kit sync",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings --threshold warning",
|
||||
"prepare": "svelte-kit sync || echo ''",
|
||||
"clean": "rm -rf node_modules && rm -rf .svelte_kit && pnpm i --force",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --check . && eslint .",
|
||||
"format": "prettier --write .",
|
||||
"lint": "prettier --check . && eslint .",
|
||||
"test": "TZ=EST vitest run",
|
||||
"test:ui": "TZ=EST vitest --ui",
|
||||
"test:watch": "TZ=EST vitest watch",
|
||||
"e2e": "playwright test tests/e2e",
|
||||
"e2e:ui": "playwright test tests/e2e --ui"
|
||||
"e2e": "playwright test",
|
||||
"e2e:ui": "playwright test --ui"
|
||||
},
|
||||
"dependencies": {
|
||||
"@appwrite.io/console": "https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@74f9464",
|
||||
"@appwrite.io/console": "https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@e2f082e",
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@64948b6 ",
|
||||
"@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@6b17cb23",
|
||||
"@appwrite.io/pink-legacy": "^1.0.3",
|
||||
"@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@64948b6 ",
|
||||
"@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@29b227f",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@sentry/sveltekit": "^8.38.0",
|
||||
"@stripe/stripe-js": "^3.5.0",
|
||||
"ai": "^2.2.37",
|
||||
"analytics": "^0.8.14",
|
||||
"analytics": "^0.8.16",
|
||||
"cron-parser": "^4.9.0",
|
||||
"dayjs": "^1.11.13",
|
||||
"deep-equal": "^2.2.3",
|
||||
"echarts": "^5.5.1",
|
||||
"envfile": "^7.1.0",
|
||||
"echarts": "^5.6.0",
|
||||
"ignore": "^6.0.2",
|
||||
"nanoid": "^5.0.8",
|
||||
"nanoid": "^5.1.5",
|
||||
"nanotar": "^0.1.1",
|
||||
"plausible-tracker": "^0.3.9",
|
||||
"pretty-bytes": "^6.1.1",
|
||||
"prismjs": "^1.29.0",
|
||||
"prismjs": "^1.30.0",
|
||||
"remarkable": "^2.0.1",
|
||||
"svelte-confetti": "^1.4.0",
|
||||
"tippy.js": "^6.3.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.7",
|
||||
"@eslint/js": "^9.24.0",
|
||||
"@melt-ui/pp": "^0.3.2",
|
||||
"@melt-ui/svelte": "^0.86.2",
|
||||
"@playwright/test": "^1.49.0",
|
||||
"@sveltejs/adapter-static": "^3.0.6",
|
||||
"@sveltejs/kit": "^2.8.1",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
||||
"@melt-ui/svelte": "^0.86.5",
|
||||
"@playwright/test": "^1.51.1",
|
||||
"@sveltejs/adapter-static": "^3.0.8",
|
||||
"@sveltejs/kit": "^2.20.2",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/svelte": "^5.2.4",
|
||||
"@testing-library/user-event": "^14.5.2",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@types/deep-equal": "^1.0.4",
|
||||
"@types/prismjs": "^1.26.5",
|
||||
"@types/remarkable": "^2.0.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"@vitest/ui": "^1.6.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-svelte": "^2.46.0",
|
||||
"jsdom": "^22.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
||||
"@typescript-eslint/parser": "^8.28.0",
|
||||
"@vitest/ui": "^3.0.9",
|
||||
"eslint": "^9.23.0",
|
||||
"eslint-config-prettier": "^10.1.0",
|
||||
"eslint-plugin-svelte": "^3.3.3",
|
||||
"globals": "^16.0.0",
|
||||
"jsdom": "^26.0.0",
|
||||
"kleur": "^4.1.5",
|
||||
"prettier": "^3.3.3",
|
||||
"prettier-plugin-svelte": "^3.2.8",
|
||||
"sass": "^1.81.0",
|
||||
"svelte": "^4.2.19",
|
||||
"svelte-check": "^3.8.6",
|
||||
"svelte-jester": "^2.3.2",
|
||||
"prettier": "^3.5.3",
|
||||
"prettier-plugin-svelte": "^3.3.3",
|
||||
"sass": "^1.86.0",
|
||||
"svelte": "^5.25.3",
|
||||
"svelte-check": "^4.1.5",
|
||||
"svelte-preprocess": "^6.0.3",
|
||||
"svelte-sequential-preprocessor": "^2.0.2",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^5.4.11",
|
||||
"vitest": "^1.6.0"
|
||||
"typescript": "^5.8.2",
|
||||
"typescript-eslint": "^8.30.1",
|
||||
"vite": "^6.2.3",
|
||||
"vitest": "^3.0.0"
|
||||
},
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@10.4.1"
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"@parcel/watcher",
|
||||
"@sentry/cli",
|
||||
"esbuild",
|
||||
"svelte-preprocess"
|
||||
]
|
||||
},
|
||||
"packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6"
|
||||
}
|
||||
@@ -5,6 +5,7 @@ const config: PlaywrightTestConfig = {
|
||||
reportSlowTests: null,
|
||||
reporter: [['html', { open: 'never' }]],
|
||||
retries: 3,
|
||||
testDir: 'e2e',
|
||||
use: {
|
||||
baseURL: 'http://localhost:4173/console/',
|
||||
trace: 'on-first-retry'
|
||||
|
||||
Generated
+1841
-3229
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,7 @@
|
||||
import Analytics, { type AnalyticsPlugin } from 'analytics';
|
||||
import Plausible from 'plausible-tracker';
|
||||
import { get } from 'svelte/store';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { ENV, MODE, VARS, isCloud } from '$lib/system';
|
||||
import { AppwriteException } from '@appwrite.io/console';
|
||||
@@ -55,13 +55,12 @@ export function trackEvent(name: string, data: object = null): void {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentPage = get(page);
|
||||
const path = currentPage.route.id;
|
||||
const path = page.route.id;
|
||||
|
||||
if (currentPage.params?.project) {
|
||||
if (page.params?.project) {
|
||||
data = {
|
||||
...data,
|
||||
project: currentPage.params.project
|
||||
project: page.params.project
|
||||
};
|
||||
}
|
||||
|
||||
@@ -139,6 +138,8 @@ export function isTrackingAllowed() {
|
||||
}
|
||||
|
||||
export enum Click {
|
||||
BackupCopyIdClick = 'click_backup_copy_id',
|
||||
BackupDeleteClick = 'click_backup_delete',
|
||||
BackupRestoreClick = 'click_backup_restore',
|
||||
BreadcrumbClick = 'click_breadcrumb',
|
||||
ConnectRepositoryClick = 'click_connect_repository',
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
|
||||
<svelte:window on:resize={onResize} />
|
||||
|
||||
<div class="echart" bind:this={container} />
|
||||
<div class="echart" bind:this={container}></div>
|
||||
|
||||
<style>
|
||||
.echart {
|
||||
|
||||
@@ -158,14 +158,13 @@
|
||||
</div>
|
||||
|
||||
<div slot="option" let:option class="u-flex u-cross-center u-gap-8">
|
||||
<i class="icon-question-mark-circle" />
|
||||
<i class="icon-question-mark-circle"></i>
|
||||
<span>{option.label}</span>
|
||||
</div>
|
||||
|
||||
{#if !$preferences.hideAiDisclaimer}
|
||||
<div style="padding: 1rem; padding-block-end: 0;">
|
||||
<Alert
|
||||
type="default"
|
||||
<Alert.Inline
|
||||
dismissible
|
||||
on:dismiss={() => {
|
||||
$preferences.hideAiDisclaimer = true;
|
||||
@@ -173,7 +172,7 @@
|
||||
<span slot="title">
|
||||
We collect user responses to refine our experimental AI feature.
|
||||
</span>
|
||||
</Alert>
|
||||
</Alert.Inline>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -248,7 +247,7 @@
|
||||
aria-label="ask AI"
|
||||
type="submit"
|
||||
disabled={!$input.trim() || $isLoading}>
|
||||
<span class="icon-arrow-sm-right" aria-hidden="true" />
|
||||
<span class="icon-arrow-sm-right" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<Template options={filteredOptions} bind:search>
|
||||
<div class="u-flex u-cross-center u-gap-8" slot="option" let:option>
|
||||
<i class="icon-{option.icon}" />
|
||||
<i class="icon-{option.icon}"></i>
|
||||
<span>{option.label}</span>
|
||||
</div>
|
||||
</Template>
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
<Template options={filteredOptions} bind:search>
|
||||
<div class="u-flex u-cross-center u-gap-8" slot="option" let:option>
|
||||
<i class="icon-{option.icon}" />
|
||||
<i class="icon-{option.icon}"></i>
|
||||
<span>{option.label}</span>
|
||||
</div>
|
||||
</Template>
|
||||
@@ -4,13 +4,14 @@
|
||||
addPlatform
|
||||
} from '$routes/(console)/project-[project]/overview/platforms/+page.svelte';
|
||||
import Template from './template.svelte';
|
||||
import { IconAndroid, IconApple, IconCode, IconFlutter } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
let search = '';
|
||||
|
||||
let platforms = [
|
||||
{
|
||||
label: 'Web',
|
||||
icon: 'code',
|
||||
icon: IconCode,
|
||||
group: 'platforms',
|
||||
callback: () => {
|
||||
addPlatform(Platform.Web);
|
||||
@@ -18,7 +19,7 @@
|
||||
},
|
||||
{
|
||||
label: 'Flutter',
|
||||
icon: 'flutter',
|
||||
icon: IconFlutter,
|
||||
group: 'platforms',
|
||||
callback: () => {
|
||||
addPlatform(Platform.Flutter);
|
||||
@@ -26,7 +27,7 @@
|
||||
},
|
||||
{
|
||||
label: 'Android',
|
||||
icon: 'android',
|
||||
icon: IconAndroid,
|
||||
group: 'platforms',
|
||||
callback: () => {
|
||||
addPlatform(Platform.Android);
|
||||
@@ -34,7 +35,7 @@
|
||||
},
|
||||
{
|
||||
label: 'Apple',
|
||||
icon: 'apple',
|
||||
icon: IconApple,
|
||||
group: 'platforms',
|
||||
callback: () => {
|
||||
addPlatform(Platform.Apple);
|
||||
@@ -49,7 +50,7 @@
|
||||
|
||||
<Template options={filteredPlatforms} bind:search>
|
||||
<div class="u-flex u-cross-center u-gap-8" slot="option" let:option>
|
||||
<i class="icon-{option.icon}" />
|
||||
<i class="icon-{option.icon}"></i>
|
||||
<span>{option.label}</span>
|
||||
</div>
|
||||
</Template>
|
||||
@@ -262,7 +262,7 @@
|
||||
{@const isLast = i === breadcrumbs.length - 1}
|
||||
<button class="crumb" on:click={() => handleCrumbClick(i)}>
|
||||
<span>{crumb}</span>
|
||||
<i class="icon-x" />
|
||||
<i class="icon-x"></i>
|
||||
</button>
|
||||
{#if !isLast}
|
||||
<span style="opacity: 50%">/</span>
|
||||
@@ -296,7 +296,7 @@
|
||||
class:first-nested={isFirstNested(i)}
|
||||
class:last-nested={isLastNested(i)}>
|
||||
{#if isSelected}
|
||||
<div class="bg" />
|
||||
<div class="bg"></div>
|
||||
{/if}
|
||||
<button
|
||||
class="option"
|
||||
|
||||
@@ -7,6 +7,13 @@ import type { Command, Searcher } from '../commands';
|
||||
import { addSubPanel } from '../subPanels';
|
||||
import { FilesPanel } from '../panels';
|
||||
import { base } from '$app/paths';
|
||||
import {
|
||||
IconFolder,
|
||||
IconKey,
|
||||
IconLockClosed,
|
||||
IconPuzzle,
|
||||
IconSearch
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
const getBucketCommand = (bucket: Models.Bucket, projectId: string) => {
|
||||
return {
|
||||
@@ -15,7 +22,7 @@ const getBucketCommand = (bucket: Models.Bucket, projectId: string) => {
|
||||
goto(`${base}/project-${projectId}/storage/bucket-${bucket.$id}`);
|
||||
},
|
||||
group: 'buckets',
|
||||
icon: 'folder'
|
||||
icon: IconFolder
|
||||
} satisfies Command;
|
||||
};
|
||||
|
||||
@@ -37,7 +44,7 @@ export const bucketSearcher = (async (query: string) => {
|
||||
},
|
||||
group: 'buckets',
|
||||
nested: true,
|
||||
icon: 'search',
|
||||
icon: IconSearch,
|
||||
keepOpen: true
|
||||
},
|
||||
{
|
||||
@@ -50,7 +57,7 @@ export const bucketSearcher = (async (query: string) => {
|
||||
},
|
||||
group: 'buckets',
|
||||
nested: true,
|
||||
icon: 'key'
|
||||
icon: IconKey
|
||||
},
|
||||
{
|
||||
label: 'Extensions',
|
||||
@@ -61,7 +68,7 @@ export const bucketSearcher = (async (query: string) => {
|
||||
},
|
||||
group: 'buckets',
|
||||
nested: true,
|
||||
icon: 'puzzle'
|
||||
icon: IconPuzzle
|
||||
},
|
||||
{
|
||||
label: 'File Security',
|
||||
@@ -73,7 +80,7 @@ export const bucketSearcher = (async (query: string) => {
|
||||
},
|
||||
group: 'buckets',
|
||||
nested: true,
|
||||
icon: 'lock-closed'
|
||||
icon: IconLockClosed
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { get } from 'svelte/store';
|
||||
import type { Searcher } from '../commands';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { base } from '$app/paths';
|
||||
import { IconDatabase } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export const dbSearcher = (async (query: string) => {
|
||||
const { databases } = await sdk.forProject.databases.list();
|
||||
@@ -18,7 +19,7 @@ export const dbSearcher = (async (query: string) => {
|
||||
callback: () => {
|
||||
goto(`${base}/project-${get(project).$id}/databases/database-${db.$id}`);
|
||||
},
|
||||
icon: 'database'
|
||||
icon: IconDatabase
|
||||
}) as const
|
||||
);
|
||||
}) satisfies Searcher;
|
||||
@@ -6,6 +6,7 @@ import { Query } from '@appwrite.io/console';
|
||||
import { goto } from '$app/navigation';
|
||||
import { project } from '$routes/(console)/project-[project]/store';
|
||||
import { base } from '$app/paths';
|
||||
import { IconDocument } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export const fileSearcher = (async (query: string) => {
|
||||
const $bucket = get(bucket);
|
||||
@@ -22,7 +23,7 @@ export const fileSearcher = (async (query: string) => {
|
||||
callback: () => {
|
||||
goto(`${base}/project-${$project.$id}/storage/bucket-${$bucket.$id}/file-${file.$id}`);
|
||||
},
|
||||
icon: 'document',
|
||||
icon: IconDocument,
|
||||
group: 'files'
|
||||
}));
|
||||
}) satisfies Searcher;
|
||||
@@ -3,32 +3,33 @@ import { project } from '$routes/(console)/project-[project]/store';
|
||||
import { get } from 'svelte/store';
|
||||
import { type Searcher } from '../commands';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { MessagingProviderType } from '@appwrite.io/console';
|
||||
import { MessagingProviderType, type Models } from '@appwrite.io/console';
|
||||
import { base } from '$app/paths';
|
||||
import { IconAnnotation, IconDeviceMobile, IconMail } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
const getLabel = (message) => {
|
||||
const getLabel = (message: Models.Message) => {
|
||||
switch (message.providerType) {
|
||||
case MessagingProviderType.Push:
|
||||
return message.data.title;
|
||||
return message.data['title'];
|
||||
case MessagingProviderType.Sms:
|
||||
return message.data.content;
|
||||
return message.data['content'];
|
||||
case MessagingProviderType.Email:
|
||||
return message.data.subject;
|
||||
return message.data['subject'];
|
||||
default:
|
||||
return 'null';
|
||||
}
|
||||
};
|
||||
|
||||
const getIcon = (message) => {
|
||||
const getIcon = (message: Models.Message) => {
|
||||
switch (message.providerType) {
|
||||
case MessagingProviderType.Push:
|
||||
return 'device-mobile';
|
||||
return IconDeviceMobile;
|
||||
case MessagingProviderType.Sms:
|
||||
return 'annotation';
|
||||
return IconAnnotation;
|
||||
case MessagingProviderType.Email:
|
||||
return 'mail';
|
||||
return IconMail;
|
||||
default:
|
||||
return 'send';
|
||||
throw new Error('Unsupported provider type');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { get } from 'svelte/store';
|
||||
import type { Command, Searcher } from '../commands';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { base } from '$app/paths';
|
||||
import { IconUserCircle } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
const getTeamCommand = (team: Models.Team<Models.Preferences>, projectId: string) =>
|
||||
({
|
||||
@@ -13,7 +14,7 @@ const getTeamCommand = (team: Models.Team<Models.Preferences>, projectId: string
|
||||
goto(`${base}/project-${projectId}/auth/teams/team-${team.$id}`);
|
||||
},
|
||||
group: 'teams',
|
||||
icon: 'user-circle'
|
||||
icon: IconUserCircle
|
||||
}) satisfies Command;
|
||||
|
||||
export const teamSearcher = (async (query: string) => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { get } from 'svelte/store';
|
||||
import type { Searcher } from '../commands';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { base } from '$app/paths';
|
||||
import { IconChevronRight } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export const topicsSearcher = (async (query: string) => {
|
||||
const { topics } = await sdk.forProject.messaging.listTopics([], query || undefined);
|
||||
@@ -20,7 +21,7 @@ export const topicsSearcher = (async (query: string) => {
|
||||
callback: () => {
|
||||
goto(`${base}/project-${projectId}/messaging/topics/topic-${topic.$id}`);
|
||||
},
|
||||
icon: 'send'
|
||||
icon: IconChevronRight // TODO: @itznotabug - 'send' no replacement yet.
|
||||
}) as const
|
||||
);
|
||||
}) satisfies Searcher;
|
||||
@@ -6,6 +6,7 @@ import type { Command, Searcher } from '../commands';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { promptDeleteUser } from '$routes/(console)/project-[project]/auth/user-[user]/dangerZone.svelte';
|
||||
import { base } from '$app/paths';
|
||||
import { IconTrash, IconUserCircle } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
const getUserCommand = (user: Models.User<Models.Preferences>, projectId: string) =>
|
||||
({
|
||||
@@ -14,7 +15,7 @@ const getUserCommand = (user: Models.User<Models.Preferences>, projectId: string
|
||||
goto(`${base}/project-${projectId}/auth/user-${user.$id}`);
|
||||
},
|
||||
group: 'users',
|
||||
icon: 'user-circle'
|
||||
icon: IconUserCircle
|
||||
}) satisfies Command;
|
||||
|
||||
export const userSearcher = (async (query: string) => {
|
||||
@@ -31,7 +32,7 @@ export const userSearcher = (async (query: string) => {
|
||||
},
|
||||
group: 'users',
|
||||
nested: true,
|
||||
icon: 'trash'
|
||||
icon: IconTrash
|
||||
},
|
||||
{
|
||||
label: 'Go to activity',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { SvelteComponent } from 'svelte';
|
||||
import type { Component } from 'svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export type SubPanel = {
|
||||
name: string;
|
||||
component: typeof SvelteComponent<unknown>;
|
||||
component: Component;
|
||||
};
|
||||
|
||||
type CastSubPanel = Omit<SubPanel, 'component'> & {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
class="button is-text is-only-icon"
|
||||
aria-label="close alert box"
|
||||
on:click={() => dispatch('dismiss')}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
<span class="icon-x" aria-hidden="true"></span>
|
||||
</button>
|
||||
{/if}
|
||||
<span
|
||||
@@ -39,7 +39,7 @@
|
||||
class:icon-check-circle={type === 'success'}
|
||||
class:icon-exclamation={type === 'warning'}
|
||||
class:icon-exclamation-circle={type === 'error'}
|
||||
aria-hidden="true" />
|
||||
aria-hidden="true"></span>
|
||||
<div class="alert-content" data-private>
|
||||
{#if $$slots.title}
|
||||
<h6 class="alert-title">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if $showPolicyAlert && isCloud && $organization?.$id && $page.url.pathname.match(/\/databases\/database-[^/]+$/)}
|
||||
{#if $showPolicyAlert && isCloud && $organization?.$id && page.url.pathname.match(/\/databases\/database-[^/]+$/)}
|
||||
{@const isFreePlan = $organization?.billingPlan === BillingPlan.FREE}
|
||||
|
||||
{@const subtitle = isFreePlan
|
||||
@@ -25,7 +25,7 @@
|
||||
: 'Protect your data by quickly adding a backup policy'}
|
||||
|
||||
{@const ctaText = isFreePlan ? 'Upgrade plan' : 'Create policy'}
|
||||
{@const ctaURL = isFreePlan ? $upgradeURL : `${$page.url.pathname}/backups`}
|
||||
{@const ctaURL = isFreePlan ? $upgradeURL : `${page.url.pathname}/backups`}
|
||||
|
||||
<HeaderAlert type="warning" title="Your database has no backup policy">
|
||||
<svelte:fragment>{subtitle}</svelte:fragment>
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
import { BillingPlan, Dependencies } from '$lib/constants';
|
||||
import type { BackupArchive, BackupRestoration } from '$lib/sdk/backups';
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { base } from '$app/paths';
|
||||
import { getProjectId } from '$lib/helpers/project';
|
||||
import { toLocaleDate } from '$lib/helpers/date';
|
||||
import { Typography } from '@appwrite.io/pink-svelte';
|
||||
|
||||
const backupRestoreItems: {
|
||||
archives: Map<string, BackupArchive>;
|
||||
@@ -33,7 +34,7 @@
|
||||
|
||||
function showRestoreNotification(newDatabaseId: string, newDatabaseName: string) {
|
||||
if (newDatabaseId && newDatabaseName && lastDatabaseRestorationId !== newDatabaseId) {
|
||||
const project = $page.params.project;
|
||||
const project = page.params.project;
|
||||
lastDatabaseRestorationId = newDatabaseId;
|
||||
|
||||
addNotification({
|
||||
@@ -146,7 +147,9 @@
|
||||
<section class="upload-box">
|
||||
<header class="upload-box-header">
|
||||
<h4 class="upload-box-title">
|
||||
<span class="text">{titleText} ({items.size})</span>
|
||||
<Typography.Text variant="m-500">
|
||||
{titleText} ({items.size})
|
||||
</Typography.Text>
|
||||
</h4>
|
||||
<button
|
||||
class="upload-box-button"
|
||||
@@ -155,13 +158,13 @@
|
||||
on:click={() => {
|
||||
openStates[key] = !openStates[key];
|
||||
}}>
|
||||
<span class="icon-cheveron-up" aria-hidden="true" />
|
||||
<span class="icon-cheveron-up" aria-hidden="true"></span>
|
||||
</button>
|
||||
<button
|
||||
class="upload-box-button"
|
||||
aria-label="close backup restore box"
|
||||
on:click={() => handleClose(key)}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
<span class="icon-x" aria-hidden="true"></span>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
@@ -172,18 +175,19 @@
|
||||
<section class="progress-bar u-width-full-line">
|
||||
<div
|
||||
class="progress-bar-top-line u-flex u-gap-8 u-main-space-between">
|
||||
<span class="body-text-2">
|
||||
<Typography.Text>
|
||||
{text(item.status, key)}
|
||||
</span>
|
||||
</Typography.Text>
|
||||
|
||||
<span class="backup-name">
|
||||
<Typography.Caption variant="400">
|
||||
{backupName(item, key)}
|
||||
</span>
|
||||
</Typography.Caption>
|
||||
</div>
|
||||
<div
|
||||
class="progress-bar-container"
|
||||
class:is-danger={item.status === 'failed'}
|
||||
style="--graph-size:{graphSize(item.status)}%" />
|
||||
style="--graph-size:{graphSize(item.status)}%">
|
||||
</div>
|
||||
</section>
|
||||
</li>
|
||||
{/each}
|
||||
@@ -195,7 +199,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
<style lang="scss">
|
||||
.upload-box-title {
|
||||
font-size: 11px;
|
||||
}
|
||||
@@ -211,13 +215,17 @@
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.backup-name {
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
line-height: 130%;
|
||||
font-style: normal;
|
||||
letter-spacing: -0.12px;
|
||||
color: var(--mid-neutrals-50, #818186);
|
||||
font-family: var(--font-family-sansSerif, Inter);
|
||||
.progress-bar-container {
|
||||
height: 4px;
|
||||
|
||||
&::before {
|
||||
height: 4px;
|
||||
background-color: var(--bgcolor-neutral-invert);
|
||||
}
|
||||
|
||||
&.is-danger::before {
|
||||
height: 4px;
|
||||
background-color: var(--bgcolor-error);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { Click, trackEvent } from '$lib/actions/analytics';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
@@ -9,7 +9,7 @@
|
||||
import { organization } from '$lib/stores/organization';
|
||||
</script>
|
||||
|
||||
{#if $organization?.$id && $organization?.billingPlan === BillingPlan.FREE && $readOnly && !hideBillingHeaderRoutes.includes($page.url.pathname)}
|
||||
{#if $organization?.$id && $organization?.billingPlan === BillingPlan.FREE && $readOnly && !hideBillingHeaderRoutes.includes(page.url.pathname)}
|
||||
<HeaderAlert
|
||||
type="error"
|
||||
title={`${$organization.name} usage has reached the ${tierToPlan($organization.billingPlan).name} plan limit`}>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { HeaderAlert } from '$lib/layout';
|
||||
import { hideBillingHeaderRoutes } from '$lib/stores/billing';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
</script>
|
||||
|
||||
{#if $organization?.markedForDeletion && !hideBillingHeaderRoutes.includes($page.url.pathname)}
|
||||
{#if $organization?.markedForDeletion && !hideBillingHeaderRoutes.includes(page.url.pathname)}
|
||||
<HeaderAlert title="Organization flagged for deletion">
|
||||
<svelte:fragment>
|
||||
All existing projects in the {$organization.name} organization have been paused. This organization
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { HeaderAlert } from '$lib/layout';
|
||||
@@ -8,7 +8,7 @@
|
||||
import { orgMissingPaymentMethod } from '$routes/(console)/store';
|
||||
</script>
|
||||
|
||||
{#if ($orgMissingPaymentMethod.billingPlan === BillingPlan.PRO || $orgMissingPaymentMethod.billingPlan === BillingPlan.SCALE) && !$orgMissingPaymentMethod.paymentMethodId && !$orgMissingPaymentMethod.backupPaymentMethodId && !hideBillingHeaderRoutes.includes($page.url.pathname)}
|
||||
{#if ($orgMissingPaymentMethod.billingPlan === BillingPlan.PRO || $orgMissingPaymentMethod.billingPlan === BillingPlan.SCALE) && !$orgMissingPaymentMethod.paymentMethodId && !$orgMissingPaymentMethod.backupPaymentMethodId && !hideBillingHeaderRoutes.includes(page.url.pathname)}
|
||||
<HeaderAlert
|
||||
type="error"
|
||||
title={`Payment method required for ${$orgMissingPaymentMethod.name}`}>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { Click, trackEvent } from '$lib/actions/analytics';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if show && $organization?.$id && $organization?.billingPlan === BillingPlan.FREE && !$page.url.pathname.includes('/console/account')}
|
||||
{#if show && $organization?.$id && $organization?.billingPlan === BillingPlan.FREE && !page.url.pathname.includes('/console/account')}
|
||||
<GradientBanner on:close={handleClose}>
|
||||
<div class="u-flex u-gap-24 u-main-center u-cross-center u-flex-vertical-mobile">
|
||||
<span class="body-text-1">Get $50 Cloud credits for Appwrite Pro.</span>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { HeaderAlert } from '$lib/layout';
|
||||
import { actionRequiredInvoices, hideBillingHeaderRoutes } from '$lib/stores/billing';
|
||||
@@ -9,7 +9,7 @@
|
||||
const endpoint = getApiEndpoint();
|
||||
</script>
|
||||
|
||||
{#if $actionRequiredInvoices && $actionRequiredInvoices?.invoices?.length && !hideBillingHeaderRoutes.includes($page.url.pathname)}
|
||||
{#if $actionRequiredInvoices && $actionRequiredInvoices?.invoices?.length && !hideBillingHeaderRoutes.includes(page.url.pathname)}
|
||||
<HeaderAlert title="Authorization required" type="error">
|
||||
Please authorize your upcoming payment for {$organization.name}. Your bank requires this
|
||||
security measure to proceed with payment.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { HeaderAlert } from '$lib/layout';
|
||||
import { hideBillingHeaderRoutes, paymentMissingMandate } from '$lib/stores/billing';
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if $paymentMissingMandate && $paymentMissingMandate?.country?.toLowerCase() === 'in' && $paymentMissingMandate.mandateId === null && !hideBillingHeaderRoutes.includes($page.url.pathname)}
|
||||
{#if $paymentMissingMandate && $paymentMissingMandate?.country?.toLowerCase() === 'in' && $paymentMissingMandate.mandateId === null && !hideBillingHeaderRoutes.includes(page.url.pathname)}
|
||||
<HeaderAlert title="Authorization required" type="info">
|
||||
The payment method for {$organization.name} needs to be verified.
|
||||
<svelte:fragment slot="buttons">
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { diffDays, toLocaleDate } from '$lib/helpers/date';
|
||||
import { HeaderAlert } from '$lib/layout';
|
||||
import { failedInvoice, hideBillingHeaderRoutes } from '$lib/stores/billing';
|
||||
</script>
|
||||
|
||||
{#if $failedInvoice && !hideBillingHeaderRoutes.includes($page.url.pathname)}
|
||||
{#if $failedInvoice && !hideBillingHeaderRoutes.includes(page.url.pathname)}
|
||||
{@const daysPassed = diffDays(new Date($failedInvoice.dueAt), new Date())}
|
||||
<HeaderAlert title="Your projects are at risk">
|
||||
<svelte:fragment>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { Button, FormList, InputText } from '$lib/elements/forms';
|
||||
import { Button, InputText } from '$lib/elements/forms';
|
||||
import { formatCurrency } from '$lib/helpers/numbers';
|
||||
import type { Coupon } from '$lib/sdk/billing';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
@@ -36,20 +37,22 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<InputText
|
||||
placeholder="Coupon code"
|
||||
id="code"
|
||||
label="Add credits"
|
||||
{required}
|
||||
disabled={couponData?.status === 'active'}
|
||||
bind:value={coupon}>
|
||||
<Layout.Stack direction="row" gap="s" wrap="wrap" alignItems="center">
|
||||
<InputText
|
||||
placeholder="Coupon code"
|
||||
id="code"
|
||||
label="Add credits"
|
||||
{required}
|
||||
disabled={couponData?.status === 'active'}
|
||||
bind:value={coupon}>
|
||||
</InputText>
|
||||
<Button secondary disabled={couponData?.status === 'active' || !coupon} on:click={addCoupon}>
|
||||
Apply
|
||||
</Button>
|
||||
</InputText>
|
||||
</Layout.Stack>
|
||||
{#if couponData?.status === 'error'}
|
||||
<div>
|
||||
<span class="icon-exclamation-circle u-color-text-danger" />
|
||||
<span class="icon-exclamation-circle u-color-text-danger"></span>
|
||||
<span>
|
||||
{couponData.code.toUpperCase()} is not a valid promo code
|
||||
</span>
|
||||
@@ -57,7 +60,7 @@
|
||||
{:else if couponData?.status === 'active'}
|
||||
<div class="u-flex u-main-space-between u-cross-center">
|
||||
<div>
|
||||
<span class="icon-tag u-color-text-success" />
|
||||
<span class="icon-tag u-color-text-success"></span>
|
||||
<slot data={couponData}>
|
||||
<span>
|
||||
{couponData.code.toUpperCase()} applied (-{formatCurrency(couponData.credits)})
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<span class="u-flex u-main-space-between">
|
||||
<div class="u-flex u-cross-center u-gap-4">
|
||||
<p class="text">
|
||||
<span class="icon-tag u-color-text-success" aria-hidden="true" />
|
||||
<span class="icon-tag u-color-text-success" aria-hidden="true"></span>
|
||||
{#if couponData.credits >= 100}
|
||||
{couponData?.code?.toUpperCase()}
|
||||
{:else}
|
||||
@@ -40,7 +40,7 @@
|
||||
status: null,
|
||||
credits: null
|
||||
})}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
<span class="icon-x" aria-hidden="true"></span>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { FakeModal } from '$lib/components';
|
||||
import { InputText, Button, FormList } from '$lib/elements/forms';
|
||||
import { InputText, Button } from '$lib/elements/forms';
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { initializeStripe, submitStripeCard } from '$lib/stores/stripe';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { page } from '$app/stores';
|
||||
import { Layout, Spinner } from '@appwrite.io/pink-svelte';
|
||||
import { page } from '$app/state';
|
||||
import { Spinner } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let show = false;
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const card = await submitStripeCard(name, $page?.params?.organization ?? null);
|
||||
const card = await submitStripeCard(name, page?.params?.organization ?? null);
|
||||
show = false;
|
||||
invalidate(Dependencies.PAYMENT_METHODS);
|
||||
dispatch('submit', card);
|
||||
show = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: 'A new payment method has been added to your account'
|
||||
@@ -77,7 +77,9 @@
|
||||
|
||||
<div class="aw-stripe-container" data-private>
|
||||
{#if isLoading}
|
||||
<Spinner />
|
||||
<div class="loader-element">
|
||||
<Spinner />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="stripe-element" bind:this={element}>
|
||||
@@ -99,5 +101,11 @@
|
||||
.stripe-element {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.loader-element {
|
||||
width: 100%;
|
||||
align-self: center;
|
||||
justify-items: end;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -11,7 +11,6 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { Alert, Icon, Table, Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import Cell from '$lib/elements/table/cell.svelte';
|
||||
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let tier: Tier;
|
||||
@@ -65,7 +64,7 @@
|
||||
<Table.Header.Cell {root}>Resource</Table.Header.Cell>
|
||||
<Table.Header.Cell {root}>Free limit</Table.Header.Cell>
|
||||
<Table.Header.Cell {root}>
|
||||
Excess usage <Tooltip
|
||||
Excess usage <Tooltip maxWidth="fit-content"
|
||||
><Icon icon={IconInfo} />
|
||||
<span slot="tooltip">Metrics are estimates updated every 24 hours</span>
|
||||
</Tooltip>
|
||||
@@ -77,7 +76,7 @@
|
||||
<Table.Cell {root}>{plan.members} members</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
<p class="u-color-text-danger u-flex u-cross-center u-gap-4">
|
||||
<span class="icon-arrow-up" />
|
||||
<span class="icon-arrow-up"></span>
|
||||
{excess?.members} members
|
||||
</p>
|
||||
</Table.Cell>
|
||||
@@ -89,7 +88,7 @@
|
||||
<Table.Cell {root}>{plan.storage} GB</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
<p class="u-color-text-danger">
|
||||
<span class="icon-arrow-up" />
|
||||
<span class="icon-arrow-up"></span>
|
||||
{humanFileSize(excess?.storage).value}
|
||||
{humanFileSize(excess?.storage).unit}
|
||||
</p>
|
||||
@@ -104,7 +103,7 @@
|
||||
</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
<p class="u-color-text-danger">
|
||||
<span class="icon-arrow-up" />
|
||||
<span class="icon-arrow-up"></span>
|
||||
<span
|
||||
title={excess?.executions
|
||||
? excess.executions.toString()
|
||||
@@ -123,7 +122,7 @@
|
||||
</Table.Cell>
|
||||
<Table.Cell column="usage" {root}>
|
||||
<p class="u-color-text-danger">
|
||||
<span class="icon-arrow-up" />
|
||||
<span class="icon-arrow-up"></span>
|
||||
<span title={excess?.users ? excess.users.toString() : 'users'}>
|
||||
{formatNum(excess?.users)} users
|
||||
</span>
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
export let anyOrgFree = false;
|
||||
export let isNewOrg = false;
|
||||
export let selfService = true;
|
||||
let classes: string = '';
|
||||
export { classes as class };
|
||||
|
||||
$: freePlan = $plansInfo.get(BillingPlan.FREE);
|
||||
$: proPlan = $plansInfo.get(BillingPlan.PRO);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { Button, InputChoice, InputText } from '$lib/elements/forms';
|
||||
import { Button, InputText } from '$lib/elements/forms';
|
||||
import type { PaymentList, PaymentMethodData } from '$lib/sdk/billing';
|
||||
import { hasStripePublicKey, isCloud } from '$lib/system';
|
||||
import { onMount } from 'svelte';
|
||||
import PaymentModal from './paymentModal.svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import { Alert, Fieldset, Icon, Layout, Selector } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Alert, Icon, Layout, Selector, Card, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { IconExclamationCircle, IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import InputSelect from '$lib/elements/forms/inputSelect.svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
@@ -33,48 +33,57 @@
|
||||
$: selectedPaymentMethod = methods?.paymentMethods?.find((method) => method.$id === value);
|
||||
</script>
|
||||
|
||||
<Fieldset legend="Payment">
|
||||
<Layout.Stack>
|
||||
{#if filteredMethods?.length}
|
||||
{#if selectedPaymentMethod?.country?.toLowerCase() === 'in'}
|
||||
<Alert.Inline status="warning">
|
||||
<svelte:fragment slot="title"
|
||||
>Indian credit or debit card-holders</svelte:fragment>
|
||||
To comply with RBI regulations in India, Appwrite will ask for verification to charge
|
||||
up to $150 USD on your payment method. We will never charge more than the cost of
|
||||
your plan and the resources you use, or your budget cap limit. For higher usage limits,
|
||||
please contact us.
|
||||
</Alert.Inline>
|
||||
{/if}
|
||||
<InputSelect
|
||||
id="method"
|
||||
required
|
||||
label="Payment method"
|
||||
placeholder="Select payment method"
|
||||
bind:value
|
||||
options={filteredMethods.map((method) => {
|
||||
return {
|
||||
value: method.$id,
|
||||
label: `${capitalize(method.brand)} ending in ${method.last4}`,
|
||||
data: [method.brand]
|
||||
};
|
||||
})} />
|
||||
<div>
|
||||
<Layout.Stack gap="s">
|
||||
{#if filteredMethods?.length}
|
||||
{#if selectedPaymentMethod?.country?.toLowerCase() === 'in'}
|
||||
<Alert.Inline status="warning">
|
||||
<svelte:fragment slot="title">Indian credit or debit card-holders</svelte:fragment>
|
||||
To comply with RBI regulations in India, Appwrite will ask for verification to charge
|
||||
up to $150 USD on your payment method. We will never charge more than the cost of your
|
||||
plan and the resources you use, or your budget cap limit. For higher usage limits, please
|
||||
contact us.
|
||||
</Alert.Inline>
|
||||
{/if}
|
||||
<InputSelect
|
||||
id="method"
|
||||
required
|
||||
label="Payment method"
|
||||
placeholder="Select payment method"
|
||||
bind:value
|
||||
options={filteredMethods.map((method) => {
|
||||
return {
|
||||
value: method.$id,
|
||||
label: `${capitalize(method.brand)} ending in ${method.last4}`,
|
||||
data: [method.brand]
|
||||
};
|
||||
})} />
|
||||
<Layout.Stack direction="row" alignItems="center">
|
||||
<Button on:click={() => (showPaymentModal = true)} compact size="s">
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Add payment method
|
||||
</Button>
|
||||
<slot name="actions" />
|
||||
</Layout.Stack>
|
||||
{:else}
|
||||
<Card.Base variant="secondary" radius="s" padding="xs">
|
||||
<Layout.Stack direction="row">
|
||||
<Layout.Stack direction="row" gap="xxs" alignItems="center">
|
||||
<Icon
|
||||
icon={IconExclamationCircle}
|
||||
size="m"
|
||||
color="--fgcolor-neutral-tertiary" />
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-tertiary"
|
||||
>No saved payment methods</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<Button secondary on:click={() => (showPaymentModal = true)}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Add new payment method
|
||||
</Button>
|
||||
</div>
|
||||
{:else}
|
||||
<Alert.Inline title="No saved payment methods">
|
||||
<Button slot="actions" secondary on:click={() => (showPaymentModal = true)}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Add
|
||||
</Button>
|
||||
</Alert.Inline>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Fieldset>
|
||||
</Layout.Stack>
|
||||
<slot name="actions" />
|
||||
</Card.Base>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
|
||||
{#if showPaymentModal && isCloud && hasStripePublicKey}
|
||||
<PaymentModal bind:show={showPaymentModal} on:submit={cardSaved}>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
import { upgradeURL } from '$lib/stores/billing';
|
||||
import { addBottomModalAlerts } from '$routes/(console)/bottomAlerts';
|
||||
import { project } from '$routes/(console)/project-[project]/store';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { Click, trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
let currentIndex = 0;
|
||||
@@ -46,7 +46,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
$: filteredModalAlerts = filterModalAlerts($bottomModalAlerts, $page.route.id);
|
||||
$: filteredModalAlerts = filterModalAlerts($bottomModalAlerts, page.route.id);
|
||||
|
||||
$: currentModalAlert = filteredModalAlerts[currentIndex] as BottomModalAlertItem;
|
||||
|
||||
@@ -93,7 +93,10 @@
|
||||
<div class="alert-container">
|
||||
<article class="card">
|
||||
{#key currentModalAlert.id}
|
||||
<button class="icon-inline-tag" on:click={() => handleClose()}>
|
||||
<button
|
||||
aria-label="Close modal"
|
||||
class="icon-inline-tag"
|
||||
on:click={() => handleClose()}>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
@@ -129,17 +132,19 @@
|
||||
|
||||
<div class="u-flex u-gap-10">
|
||||
<button
|
||||
aria-label="Previous"
|
||||
class="icon-cheveron-left"
|
||||
on:click={showPrevious}
|
||||
disabled={currentIndex === 0}
|
||||
class:active={currentIndex > 0} />
|
||||
class:active={currentIndex > 0}></button>
|
||||
|
||||
<button
|
||||
aria-label="Next"
|
||||
class="icon-cheveron-right"
|
||||
on:click={showNext}
|
||||
disabled={currentIndex === filteredModalAlerts.length - 1}
|
||||
class:active={currentIndex !==
|
||||
filteredModalAlerts.length - 1} />
|
||||
filteredModalAlerts.length - 1}></button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -203,7 +208,10 @@
|
||||
<div class="alert-container">
|
||||
<article class="card">
|
||||
{#key currentModalAlert.id}
|
||||
<button class="icon-inline-tag" on:click={() => handleClose()}>
|
||||
<button
|
||||
aria-label="Close modal"
|
||||
class="icon-inline-tag"
|
||||
on:click={() => handleClose()}>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
@@ -239,18 +247,20 @@
|
||||
|
||||
<div class="u-flex u-gap-10">
|
||||
<button
|
||||
aria-label="Previous"
|
||||
class="icon-cheveron-left"
|
||||
on:click={showPrevious}
|
||||
disabled={currentIndex === 0}
|
||||
class:active={currentIndex > 0} />
|
||||
class:active={currentIndex > 0}></button>
|
||||
|
||||
<button
|
||||
aria-label="Next"
|
||||
class="icon-cheveron-right"
|
||||
on:click={showNext}
|
||||
disabled={currentIndex ===
|
||||
filteredModalAlerts.length - 1}
|
||||
class:active={currentIndex !==
|
||||
filteredModalAlerts.length - 1} />
|
||||
filteredModalAlerts.length - 1}></button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -319,9 +329,6 @@
|
||||
<div class="u-flex-vertical u-gap-4">
|
||||
<div class="u-flex u-cross-center u-main-space-between">
|
||||
<h3 class="body-text-2 u-bold">New features available</h3>
|
||||
<button on:click={hideAllModalAlerts}>
|
||||
<span class="icon-x" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<span class="u-width-fit-content">
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
{#if organizations.length > 1}
|
||||
<div class="separator" use:melt={$separatorOrganizations} />
|
||||
<div class="separator" use:melt={$separatorOrganizations}></div>
|
||||
|
||||
<div use:melt={$subTriggerOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
@@ -244,7 +244,7 @@
|
||||
</ActionMenu.Root>
|
||||
</div>
|
||||
{/each}
|
||||
<div class="separator" use:melt={$separatorOrganizations} />
|
||||
<div class="separator" use:melt={$separatorOrganizations}></div>
|
||||
<div use:melt={$itemOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Button
|
||||
@@ -257,7 +257,7 @@
|
||||
</Card.Base>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="separator" use:melt={$separatorOrganizations} />
|
||||
<div class="separator" use:melt={$separatorOrganizations}></div>
|
||||
<div use:melt={$itemOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Button leadingIcon={IconPlusSm} on:click={createOrg}
|
||||
@@ -275,7 +275,7 @@
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
{/each}
|
||||
<div class="separator" use:melt={$separatorOrganizations} />
|
||||
<div class="separator" use:melt={$separatorOrganizations}></div>
|
||||
<div use:melt={$itemOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Button leadingIcon={IconPlusSm} on:click={createOrg}
|
||||
@@ -329,7 +329,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
<div class="separator" use:melt={$separatorProjects} />
|
||||
<div class="separator" use:melt={$separatorProjects}></div>
|
||||
{/if}
|
||||
<div use:melt={$itemProjects}>
|
||||
<ActionMenu.Root>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
import type { ComponentProps } from 'svelte';
|
||||
|
||||
type BaseProps = {
|
||||
isTile?: boolean;
|
||||
isDashed?: boolean;
|
||||
danger?: boolean;
|
||||
style?: string;
|
||||
@@ -23,7 +22,6 @@
|
||||
|
||||
type $$Props = BaseProps & (ButtonProps | AnchorProps | BaseProps) & ComponentProps<Base>;
|
||||
|
||||
export let isTile = false;
|
||||
export let isDashed = false;
|
||||
export let isButton = false;
|
||||
export let href: string = null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { Empty } from '$lib/components';
|
||||
import { CARD_LIMIT } from '$lib/constants';
|
||||
import { getServiceLimit, type PlanServices } from '$lib/stores/billing';
|
||||
@@ -7,7 +7,7 @@
|
||||
import { isCloud } from '$lib/system';
|
||||
import CardPlanLimit from './cardPlanLimit.svelte';
|
||||
|
||||
export let showEmpty = true;
|
||||
export let disableEmpty = true;
|
||||
export let offset = 0;
|
||||
export let total = 0;
|
||||
export let event: string = null;
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
$: planLimit = getServiceLimit(serviceId) || Infinity;
|
||||
|
||||
$: limit = preferences.get($page.route)?.limit ?? CARD_LIMIT;
|
||||
$: limit = preferences.get(page.route)?.limit ?? CARD_LIMIT;
|
||||
</script>
|
||||
|
||||
<ul class="grid-box" style={`--grid-item-size:${total > 3 ? '22rem' : '25rem'};`} data-private>
|
||||
@@ -25,8 +25,8 @@
|
||||
{#if total > 3 ? total < limit + offset : total % 2 !== 0}
|
||||
{#if isCloud && serviceId && total >= planLimit}
|
||||
<CardPlanLimit {service} />
|
||||
{:else if showEmpty}
|
||||
<Empty on:click target={event}>
|
||||
{:else}
|
||||
<Empty on:click target={event} disabled={disableEmpty}>
|
||||
<slot name="empty" />
|
||||
</Empty>
|
||||
{/if}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Divider, Layout, Card, Typography } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let hideOverflow = false;
|
||||
export let hideFooter = false;
|
||||
export let gap: 'none' | 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl' = 'l';
|
||||
</script>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
{#if label}
|
||||
<Pill>
|
||||
{#if labelIcon}
|
||||
<span class={`icon-${labelIcon}`} aria-hidden="true" />
|
||||
<span class={`icon-${labelIcon}`} aria-hidden="true"></span>
|
||||
{/if}
|
||||
{label}
|
||||
</Pill>
|
||||
@@ -59,7 +59,7 @@
|
||||
{#if withCopy}
|
||||
<Copy value={code}>
|
||||
<button class="button is-small is-text is-only-icon" aria-label="copy code">
|
||||
<span class="icon-duplicate" aria-hidden="true" />
|
||||
<span class="icon-duplicate" aria-hidden="true"></span>
|
||||
</button>
|
||||
</Copy>
|
||||
{/if}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<span
|
||||
class="icon-cheveron-down u-font-size-20"
|
||||
class:u-color-text-disabled={disabled}
|
||||
aria-hidden="true" />
|
||||
aria-hidden="true"></span>
|
||||
</div>
|
||||
</slot>
|
||||
</summary>
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import { preferences } from '$lib/stores/preferences';
|
||||
import { onMount, type Snippet } from 'svelte';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import { ActionMenu, Layout, Popover, Selector } from '@appwrite.io/pink-svelte';
|
||||
|
||||
let {
|
||||
columns,
|
||||
isCustomCollection = false,
|
||||
allowNoColumns = false,
|
||||
children
|
||||
}: {
|
||||
columns: Writable<Column[]>;
|
||||
isCustomCollection?: boolean;
|
||||
allowNoColumns?: boolean;
|
||||
children: Snippet<[toggle: () => void, selectedColumnsNumber: number]>;
|
||||
} = $props();
|
||||
|
||||
onMount(async () => {
|
||||
if (isCustomCollection) {
|
||||
const prefs = preferences.getCustomCollectionColumns(page.params.collection);
|
||||
columns.set(
|
||||
$columns.map((column) => {
|
||||
column.hide = prefs?.includes(column.id) ?? false;
|
||||
return column;
|
||||
})
|
||||
);
|
||||
} else {
|
||||
const prefs = preferences.get(page.route);
|
||||
|
||||
// Override the shown columns only if a preference was set
|
||||
if (prefs?.columns) {
|
||||
columns.set(
|
||||
$columns.map((column) => {
|
||||
column.hide = prefs.columns?.includes(column.id) ?? false;
|
||||
return column;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
columns.subscribe((ctx) => {
|
||||
const columns = ctx.filter((n) => n.hide === true).map((n) => n.id);
|
||||
|
||||
if (isCustomCollection) {
|
||||
preferences.setCustomCollectionColumns(columns);
|
||||
} else {
|
||||
preferences.setColumns(columns);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
let selectedColumnsNumber = $derived(
|
||||
$columns.reduce((acc, column) => {
|
||||
if (column.hide === true) return acc;
|
||||
|
||||
return ++acc;
|
||||
}, 0)
|
||||
);
|
||||
</script>
|
||||
|
||||
{#if $columns?.length}
|
||||
<Popover let:toggle placement="bottom-end" padding="none">
|
||||
{@render children(toggle, selectedColumnsNumber)}
|
||||
<svelte:fragment slot="tooltip">
|
||||
<ActionMenu.Root>
|
||||
{#each $columns as column}
|
||||
{#if !column?.exclude}
|
||||
<ActionMenu.Item.Button
|
||||
on:click={() => (column.hide = !column.hide)}
|
||||
disabled={allowNoColumns
|
||||
? false
|
||||
: selectedColumnsNumber <= 1 && column.hide !== true}>
|
||||
<Layout.Stack direction="row" gap="s">
|
||||
<Selector.Checkbox
|
||||
checked={!column.hide}
|
||||
size="s"
|
||||
on:click={() => (column.hide = !column.hide)} />
|
||||
{column.title}
|
||||
</Layout.Stack>
|
||||
</ActionMenu.Item.Button>
|
||||
{/if}
|
||||
{/each}
|
||||
</ActionMenu.Root>
|
||||
</svelte:fragment>
|
||||
</Popover>
|
||||
{/if}
|
||||
@@ -15,32 +15,39 @@
|
||||
|
||||
let confirm = false;
|
||||
let checkboxId = `delete_${title.replaceAll(' ', '_').toLowerCase()}`;
|
||||
|
||||
// reset checkbox status
|
||||
$: if (open && confirmDeletion) {
|
||||
confirm = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<Form isModal {onSubmit}>
|
||||
<Dialog {title} bind:open>
|
||||
{#if error}
|
||||
<Alert.Inline
|
||||
dismissible
|
||||
status="error"
|
||||
on:dismiss={() => {
|
||||
error = null;
|
||||
}}>
|
||||
{error}
|
||||
</Alert.Inline>
|
||||
{/if}
|
||||
|
||||
<Layout.Stack gap="l">
|
||||
<slot />
|
||||
|
||||
{#if confirmDeletion}
|
||||
<InputCheckbox
|
||||
size="s"
|
||||
required
|
||||
id={checkboxId}
|
||||
bind:checked={confirm}
|
||||
label="I understand and confirm" />
|
||||
<Layout.Stack gap="xl">
|
||||
{#if error}
|
||||
<Alert.Inline
|
||||
dismissible
|
||||
status="error"
|
||||
on:dismiss={() => {
|
||||
error = null;
|
||||
}}>
|
||||
{error}
|
||||
</Alert.Inline>
|
||||
{/if}
|
||||
|
||||
<Layout.Stack gap="l">
|
||||
<slot />
|
||||
|
||||
{#if confirmDeletion}
|
||||
<InputCheckbox
|
||||
size="s"
|
||||
required
|
||||
id={checkboxId}
|
||||
bind:checked={confirm}
|
||||
label="I understand and confirm" />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
role="button"
|
||||
tabindex="0"
|
||||
style:cursor="pointer"
|
||||
on:click|preventDefault={handleClick}
|
||||
on:click|preventDefault|stopPropagation={handleClick}
|
||||
on:keyup={clickOnEnter}
|
||||
on:mouseenter={() => setTimeout(() => (content = 'Click to copy'))}>
|
||||
<slot />
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
export let name: string;
|
||||
export let id: string;
|
||||
export let autofocus = true;
|
||||
export let fullWidth = false;
|
||||
export let isProject = false;
|
||||
$: if (!show) {
|
||||
id = null;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<script lang="ts">
|
||||
import { Link } from '$lib/elements';
|
||||
import { consoleVariables } from '$routes/(console)/store';
|
||||
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
|
||||
import {
|
||||
Badge,
|
||||
Layout,
|
||||
Typography,
|
||||
Table,
|
||||
Icon,
|
||||
InteractiveText
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let domain: string;
|
||||
export let verified = false;
|
||||
|
||||
let subdomain = domain.split('.').slice(0, -2).join('.');
|
||||
</script>
|
||||
|
||||
<Layout.Stack gap="xl">
|
||||
<Layout.Stack gap="s">
|
||||
<Layout.Stack gap="s" direction="row" alignItems="center">
|
||||
<Typography.Text variant="l-500" color="--fgcolor-neutral-primary">
|
||||
{domain}
|
||||
</Typography.Text>
|
||||
{#if verified}
|
||||
<Badge variant="secondary" type="success" content="Verified" />
|
||||
{:else if verified === false}
|
||||
<Badge variant="secondary" type="error" content="Verification failed" />
|
||||
{:else}
|
||||
<Badge
|
||||
variant="secondary"
|
||||
type="warning"
|
||||
size="xs"
|
||||
content="Pending verification" />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
<Typography.Text variant="m-400">
|
||||
Add the following record on your DNS provider. Note that DNS changes may take time to
|
||||
propagate fully.
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
|
||||
<Table.Root columns={3} let:root>
|
||||
<svelte:fragment slot="header" let:root>
|
||||
<Table.Header.Cell {root}>Type</Table.Header.Cell>
|
||||
<Table.Header.Cell {root}>Name</Table.Header.Cell>
|
||||
<Table.Header.Cell {root}>Value</Table.Header.Cell>
|
||||
</svelte:fragment>
|
||||
<Table.Row.Base {root}>
|
||||
<Table.Cell {root}>CNAME</Table.Cell>
|
||||
<Table.Cell {root}>{subdomain}</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
<InteractiveText
|
||||
variant="copy"
|
||||
isVisible
|
||||
text={$consoleVariables._APP_DOMAIN_TARGET_CNAME} />
|
||||
</Table.Cell>
|
||||
</Table.Row.Base>
|
||||
</Table.Root>
|
||||
<Layout.Stack gap="s" direction="row" alignItems="center">
|
||||
<Icon icon={IconInfo} size="s" color="--fgcolor-neutral-secondary" />
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-secondary">
|
||||
A list of all domain providers and their DNS setting is available <Link
|
||||
variant="muted"
|
||||
external
|
||||
href="https://appwrite.io/docs/advanced/platform/custom-domains">here</Link
|
||||
>.
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
@@ -0,0 +1,44 @@
|
||||
<script lang="ts">
|
||||
import { consoleVariables } from '$routes/(console)/store';
|
||||
|
||||
import { Badge, Layout, Typography, Table, InteractiveText } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let domain: string;
|
||||
export let verified = false;
|
||||
|
||||
const nameserverList = $consoleVariables?._APP_DOMAINS_NAMESERVERS
|
||||
? $consoleVariables?._APP_DOMAINS_NAMESERVERS?.split(',')
|
||||
: ['ns1.appwrite.io', 'ns2.appwrite.io'];
|
||||
</script>
|
||||
|
||||
<Layout.Stack gap="s">
|
||||
<Layout.Stack gap="s" direction="row" alignItems="center">
|
||||
<Typography.Text variant="l-500" color="--fgcolor-neutral-primary">
|
||||
{domain}
|
||||
</Typography.Text>
|
||||
{#if verified}
|
||||
<Badge variant="secondary" type="success" content="Verified" />
|
||||
{:else if verified === false}
|
||||
<Badge variant="secondary" type="warning" size="xs" content="Pending verification" />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
<Typography.Text variant="m-400">
|
||||
Add the following nameservers on your DNS provider. Note that DNS changes may take time to
|
||||
propagate fully.
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
|
||||
<Table.Root columns={2} let:root>
|
||||
<svelte:fragment slot="header" let:root>
|
||||
<Table.Header.Cell {root}>Type</Table.Header.Cell>
|
||||
<Table.Header.Cell {root}>Value</Table.Header.Cell>
|
||||
</svelte:fragment>
|
||||
{#each nameserverList as nameserver}
|
||||
<Table.Row.Base {root}>
|
||||
<Table.Cell {root}>NS</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
<InteractiveText variant="copy" isVisible text={nameserver} />
|
||||
</Table.Cell>
|
||||
</Table.Row.Base>
|
||||
{/each}
|
||||
</Table.Root>
|
||||
@@ -0,0 +1,80 @@
|
||||
<script lang="ts">
|
||||
import { Link } from '$lib/elements';
|
||||
import { consoleVariables } from '$routes/(console)/store';
|
||||
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
|
||||
import {
|
||||
Badge,
|
||||
Layout,
|
||||
Typography,
|
||||
Table,
|
||||
Icon,
|
||||
InteractiveText
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let domain: string;
|
||||
export let verified = false;
|
||||
export let variant: 'cname' | 'a' | 'aaaa';
|
||||
|
||||
let subdomain = domain?.split('.')?.slice(0, -2)?.join('.');
|
||||
|
||||
function setTarget() {
|
||||
switch (variant) {
|
||||
case 'cname':
|
||||
return $consoleVariables._APP_DOMAIN_TARGET_CNAME;
|
||||
case 'a':
|
||||
return $consoleVariables._APP_DOMAIN_TARGET_A;
|
||||
case 'aaaa':
|
||||
return $consoleVariables._APP_DOMAIN_TARGET_AAAA;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<Layout.Stack gap="xl">
|
||||
<Layout.Stack gap="s">
|
||||
<Layout.Stack gap="s" direction="row" alignItems="center">
|
||||
<Typography.Text variant="l-500" color="--fgcolor-neutral-primary">
|
||||
{domain}
|
||||
</Typography.Text>
|
||||
{#if verified}
|
||||
<Badge variant="secondary" type="success" content="Verified" />
|
||||
{:else if verified === false}
|
||||
<Badge variant="secondary" type="error" content="Verification failed" />
|
||||
{:else}
|
||||
<Badge
|
||||
variant="secondary"
|
||||
type="warning"
|
||||
size="xs"
|
||||
content="Pending verification" />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
<Typography.Text variant="m-400">
|
||||
Add the following record on your DNS provider. Note that DNS changes may take time to
|
||||
propagate fully.
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
|
||||
<Table.Root columns={3} let:root>
|
||||
<svelte:fragment slot="header" let:root>
|
||||
<Table.Header.Cell {root}>Type</Table.Header.Cell>
|
||||
<Table.Header.Cell {root}>Name</Table.Header.Cell>
|
||||
<Table.Header.Cell {root}>Value</Table.Header.Cell>
|
||||
</svelte:fragment>
|
||||
<Table.Row.Base {root}>
|
||||
<Table.Cell {root}>{variant.toUpperCase()}</Table.Cell>
|
||||
<Table.Cell {root}>{subdomain || '@'}</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
<InteractiveText variant="copy" isVisible text={setTarget()} />
|
||||
</Table.Cell>
|
||||
</Table.Row.Base>
|
||||
</Table.Root>
|
||||
<Layout.Stack gap="s" direction="row" alignItems="center">
|
||||
<Icon icon={IconInfo} size="s" color="--fgcolor-neutral-secondary" />
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-secondary">
|
||||
A list of all domain providers and their DNS setting is available <Link
|
||||
variant="muted"
|
||||
external
|
||||
href="https://appwrite.io/docs/advanced/platform/custom-domains">here</Link
|
||||
>.
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
@@ -125,7 +125,8 @@
|
||||
class="drop-arrow"
|
||||
class:is-popover={isPopover}
|
||||
class:u-hide={!show || (show && noArrow)}
|
||||
bind:this={arrow} />
|
||||
bind:this={arrow}>
|
||||
</div>
|
||||
{#if show}
|
||||
<slot name="list" />
|
||||
{/if}
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
{disabled}>
|
||||
<span class="text"><slot /></span>
|
||||
{#if icon}
|
||||
<span class={`icon-${icon}`} aria-hidden="true" />
|
||||
<span class={`icon-${icon}`} aria-hidden="true"></span>
|
||||
{/if}
|
||||
{#if loading}
|
||||
<span class="loader is-small u-line-height-1-5" aria-hidden="true" />
|
||||
<span class="loader is-small u-line-height-1-5" aria-hidden="true"></span>
|
||||
{/if}
|
||||
</button>
|
||||
</li>
|
||||
@@ -30,7 +30,7 @@
|
||||
rel={external ? 'noopener noreferrer' : ''}>
|
||||
<span class="text"><slot /></span>
|
||||
{#if icon}
|
||||
<span class={`icon-${icon}`} style={iconStyle} aria-hidden="true" />
|
||||
<span class={`icon-${icon}`} style={iconStyle} aria-hidden="true"></span>
|
||||
{/if}
|
||||
</a>
|
||||
</li>
|
||||
@@ -1,10 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { getUTCOffset, timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { type ComponentProps } from 'svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import {
|
||||
timeFromNow,
|
||||
toLocaleDateTime,
|
||||
toLocalDateTimeISO,
|
||||
toISOString
|
||||
} from '$lib/helpers/date';
|
||||
import { Badge, InteractiveText, Layout, Popover, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { menuOpen } from '$lib/components/menu/store';
|
||||
|
||||
export let time: string = '';
|
||||
export let placement: any | string = 'bottom-end';
|
||||
export let placement: ComponentProps<Popover>['placement'] = 'bottom';
|
||||
|
||||
function timeDifference(dateString: string): string {
|
||||
const SECONDS_IN_MINUTE = 60;
|
||||
@@ -23,48 +30,105 @@
|
||||
{ label: 'month', value: Math.floor(diffInSeconds / SECONDS_IN_MONTH) },
|
||||
{ label: 'day', value: Math.floor(diffInSeconds / SECONDS_IN_DAY) % 30 },
|
||||
{ label: 'hour', value: Math.floor(diffInSeconds / SECONDS_IN_HOUR) % 24 },
|
||||
{ label: 'minute', value: Math.floor(diffInSeconds / SECONDS_IN_MINUTE) % 60 }
|
||||
{ label: 'minute', value: Math.floor(diffInSeconds / SECONDS_IN_MINUTE) % 60 },
|
||||
{ label: 'second', value: diffInSeconds % 60 }
|
||||
];
|
||||
|
||||
const formattedTime = timeParts
|
||||
.filter((unit) => unit.value > 0)
|
||||
.slice(0, 3)
|
||||
const month = timeParts[0].value;
|
||||
const day = timeParts[1].value;
|
||||
const hour = timeParts[2].value;
|
||||
const second = timeParts[4].value;
|
||||
|
||||
let outputParts: { label: string; value: number }[];
|
||||
|
||||
if (month === 0 && day === 0 && hour === 0 && second > 0) {
|
||||
// Seconds exist but no months, days, hours — show minutes + seconds
|
||||
outputParts = timeParts.slice(3).filter((unit) => unit.value > 0);
|
||||
} else {
|
||||
// Normal logic — top 3 non-zero units, no seconds.
|
||||
outputParts = timeParts
|
||||
.filter((unit) => unit.label !== 'second' && unit.value > 0)
|
||||
.slice(0, 3);
|
||||
}
|
||||
|
||||
const formattedTime = outputParts
|
||||
.map((unit) => `${unit.value} ${unit.label}${unit.value > 1 ? 's' : ''}`)
|
||||
.join(', ');
|
||||
|
||||
return formattedTime ? `${formattedTime} ago` : 'Just now';
|
||||
}
|
||||
|
||||
let isMouseOverTooltip = false;
|
||||
function hidePopover(hideTooltip: () => void, timeout = true) {
|
||||
if (!timeout) {
|
||||
isMouseOverTooltip = false;
|
||||
return hideTooltip();
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (!isMouseOverTooltip) {
|
||||
hideTooltip();
|
||||
}
|
||||
}, 150);
|
||||
}
|
||||
|
||||
$: timeToString = time ? timeDifference(time) : 'Invalid time';
|
||||
</script>
|
||||
|
||||
<Popover let:toggle {placement} portal>
|
||||
<button on:mouseenter={(e) => toggle(e)}>
|
||||
<Popover let:show let:hide {placement} portal>
|
||||
<button
|
||||
on:mouseenter={() => {
|
||||
if (!$menuOpen) {
|
||||
setTimeout(show, 150);
|
||||
}
|
||||
}}
|
||||
on:mouseleave={() => hidePopover(hide)}>
|
||||
<slot>{capitalize(timeFromNow(time))}</slot>
|
||||
</button>
|
||||
|
||||
<Layout.Stack gap="m" alignContent="flex-start" slot="tooltip">
|
||||
<Typography.Text color="--fgcolor-neutral-tertiary" variant="m-400"
|
||||
>{timeToString}</Typography.Text>
|
||||
<div
|
||||
let:hide
|
||||
slot="tooltip"
|
||||
role="tooltip"
|
||||
style:padding="1rem"
|
||||
style:margin="-1rem"
|
||||
on:mouseenter={() => (isMouseOverTooltip = true)}
|
||||
on:mouseleave={() => hidePopover(hide, false)}>
|
||||
<Layout.Stack gap="s" alignContent="flex-start">
|
||||
<!-- `Raw time` as per design -->
|
||||
<Typography.Caption color="--fgcolor-neutral-tertiary" variant="400">
|
||||
{timeToString}
|
||||
</Typography.Caption>
|
||||
|
||||
<Layout.Stack gap="xxs">
|
||||
<Layout.Stack direction="row" justifyContent="space-between">
|
||||
<Typography.Text variant="m-400">
|
||||
<!-- `Absolute time` as per design -->
|
||||
<Layout.Stack gap="xxs">
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
alignContent="center"
|
||||
justifyContent="space-between">
|
||||
<InteractiveText
|
||||
isVisible
|
||||
variant="copy"
|
||||
text={toLocaleDateTime(time, 'UTC')}
|
||||
isVisible />
|
||||
</Typography.Text>
|
||||
<Badge variant="secondary" content="UTC" size="xs" />
|
||||
</Layout.Stack>
|
||||
value={toISOString(time)} />
|
||||
|
||||
<Layout.Stack direction="row" justifyContent="space-between">
|
||||
<Typography.Text variant="m-400">
|
||||
<InteractiveText variant="copy" text={toLocaleDateTime(time)} isVisible />
|
||||
</Typography.Text>
|
||||
<Badge variant="secondary" content="UTC" size="xs" />
|
||||
</Layout.Stack>
|
||||
|
||||
<Badge variant="secondary" content="UTC{getUTCOffset()}" size="xs" />
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
alignContent="center"
|
||||
justifyContent="space-between">
|
||||
<InteractiveText
|
||||
isVisible
|
||||
variant="copy"
|
||||
text={toLocaleDateTime(time)}
|
||||
value={toLocalDateTimeISO(time)} />
|
||||
<Badge variant="secondary" content="Local" size="xs" />
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</div>
|
||||
</Popover>
|
||||
@@ -9,6 +9,7 @@
|
||||
export let href: string = null;
|
||||
export let allowCreate = true;
|
||||
export let description = 'Need a hand? Learn more in our documentation.';
|
||||
export let disabled = false;
|
||||
export let src: string = null;
|
||||
|
||||
function track() {
|
||||
@@ -47,7 +48,7 @@
|
||||
</Empty>
|
||||
</Card.Base>
|
||||
{:else}
|
||||
<Card.Button on:click on:click={track} aria-label="create">
|
||||
<Card.Button on:click on:click={track} aria-label="create" {disabled}>
|
||||
<Layout.Stack justifyContent="center" alignItems="center" gap="m">
|
||||
<Avatar size="s"><Icon icon={IconPlus} size="s" /></Avatar>
|
||||
<Typography.Text variation="m-400" align="center"><slot /></Typography.Text>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
alignItems="center"
|
||||
wrap="wrap">
|
||||
<p class="text">Total results: 0</p>
|
||||
<PaginationInline limit={1} offset={0} sum={0} {hidePages} />
|
||||
<PaginationInline limit={1} offset={0} total={0} {hidePages} />
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
@@ -184,6 +184,7 @@
|
||||
action: null as EventAction | null,
|
||||
attribute: null as string | null
|
||||
};
|
||||
let helper: string = null;
|
||||
let customInput: string = null;
|
||||
let customInputCursor = -1;
|
||||
let showInput = false;
|
||||
@@ -235,6 +236,10 @@
|
||||
customInput = null;
|
||||
showInput = false;
|
||||
}
|
||||
|
||||
$: if (showInput) {
|
||||
helper = getCustomInputHelperStr(customInput, customInputCursor);
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal title="Create event" bind:show onSubmit={create}>
|
||||
@@ -303,12 +308,17 @@
|
||||
{/if}
|
||||
|
||||
{#if showInput}
|
||||
<Input.Text bind:value={customInput} placeholder="Enter custom event">
|
||||
<svelte:fragment slot="end">
|
||||
<Input.Action icon={IconCheck} on:click={toggleShowInput} />
|
||||
<Input.Action icon={IconX} />
|
||||
</svelte:fragment>
|
||||
</Input.Text>
|
||||
<Layout.Stack gap="s">
|
||||
<Input.Text bind:value={customInput} placeholder="Enter custom event">
|
||||
<svelte:fragment slot="end">
|
||||
<Input.Action icon={IconCheck} on:click={toggleShowInput} />
|
||||
<Input.Action icon={IconX} />
|
||||
</svelte:fragment>
|
||||
</Input.Text>
|
||||
|
||||
<!-- TODO: get checked by design -->
|
||||
<Typography.Caption variant="400">{helper ?? ''}</Typography.Caption>
|
||||
</Layout.Stack>
|
||||
{:else}
|
||||
<Input.Text
|
||||
value={eventString.map((e) => e.value).join('.')}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$: if (backdrop) {
|
||||
$: if (backdrop && show && !document.body.contains(backdrop)) {
|
||||
document.body.appendChild(backdrop);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
class:is-warning={state === 'warning'}
|
||||
class:is-danger={state === 'error'}
|
||||
class:is-info={state === 'info'}>
|
||||
<span class={`icon-${icon}`} aria-hidden="true" />
|
||||
<span class={`icon-${icon}`} aria-hidden="true"></span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
from: 'button'
|
||||
})}
|
||||
on:click={closeModal}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
<span class="icon-x" aria-hidden="true"></span>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -149,9 +149,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
:global() {
|
||||
background-color: hsl(240 5% 8% / 0.6);
|
||||
}
|
||||
background-color: hsl(240 5% 8% / 0.6);
|
||||
|
||||
& :global(.modal-form) {
|
||||
position: unset;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import { user } from '$lib/stores/user';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { Typography } from '@appwrite.io/pink-svelte';
|
||||
|
||||
$: $selectedFeedback = feedbackOptions.find((option) => option.type === $feedback.type);
|
||||
@@ -21,7 +21,7 @@
|
||||
await feedback.submitFeedback(
|
||||
`feedback-${$feedback.type}`,
|
||||
$feedbackData.message,
|
||||
$page.url.href,
|
||||
page.url.href,
|
||||
$user.name,
|
||||
$user.email,
|
||||
$organization.billingPlan,
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { FormList, InputTextarea } from '$lib/elements/forms';
|
||||
import { InputTextarea } from '$lib/elements/forms';
|
||||
import { feedbackData } from '$lib/stores/feedback';
|
||||
</script>
|
||||
|
||||
<FormList>
|
||||
<InputTextarea
|
||||
required
|
||||
id="feedback"
|
||||
bind:value={$feedbackData.message}
|
||||
label="Tell us more about your experience"
|
||||
placeholder="Share your suggestions and feature requests..." />
|
||||
</FormList>
|
||||
<InputTextarea
|
||||
required
|
||||
id="feedback"
|
||||
bind:value={$feedbackData.message}
|
||||
label="Tell us more about your experience"
|
||||
placeholder="Share your suggestions and feature requests..." />
|
||||
@@ -1,18 +1,16 @@
|
||||
<script lang="ts">
|
||||
import Evaluation from './evaluation.svelte';
|
||||
import { feedbackData } from '$lib/stores/feedback';
|
||||
import { FormList, InputTextarea } from '$lib/elements/forms';
|
||||
import { InputTextarea } from '$lib/elements/forms';
|
||||
</script>
|
||||
|
||||
<FormList>
|
||||
<Evaluation bind:value={$feedbackData.value} />
|
||||
{#if $feedbackData.value !== null}
|
||||
<!-- TODO: @itznotabug, helper is a plain string atm, cannot add html/anchor for Discord link -->
|
||||
<InputTextarea
|
||||
id="feedback"
|
||||
bind:value={$feedbackData.message}
|
||||
label="Tell us more about your experience (optional)"
|
||||
placeholder="Share your suggestions and feature requests..."
|
||||
helper="Need help? Join our Discord for community support" />
|
||||
{/if}
|
||||
</FormList>
|
||||
<Evaluation bind:value={$feedbackData.value} />
|
||||
{#if $feedbackData.value !== null}
|
||||
<!-- TODO: @itznotabug, helper is a plain string atm, cannot add html/anchor for Discord link -->
|
||||
<InputTextarea
|
||||
id="feedback"
|
||||
bind:value={$feedbackData.message}
|
||||
label="Tell us more about your experience (optional)"
|
||||
placeholder="Share your suggestions and feature requests..."
|
||||
helper="Need help? Join our Discord for community support" />
|
||||
{/if}
|
||||
@@ -9,7 +9,7 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import { onMount } from 'svelte';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import DualTimeView from './dualTimeView.svelte';
|
||||
import {
|
||||
Layout,
|
||||
@@ -150,7 +150,7 @@
|
||||
<Typography.Caption variant="500">Buckets</Typography.Caption>
|
||||
{#await buckets}
|
||||
<div class="u-flex u-main-center">
|
||||
<div class="loader" />
|
||||
<div class="loader"></div>
|
||||
</div>
|
||||
{:then response}
|
||||
<ActionMenu.Root>
|
||||
@@ -244,6 +244,7 @@
|
||||
<Card.Selector
|
||||
group="files"
|
||||
name="files"
|
||||
title="files"
|
||||
value={file.$id}
|
||||
src={getPreview(
|
||||
currentBucket.$id,
|
||||
@@ -354,7 +355,7 @@
|
||||
slot="actions"
|
||||
secondary
|
||||
external
|
||||
href={`${base}/project-${$page.params.project}/storage`}>
|
||||
href={`${base}/project-${page.params.project}/storage`}>
|
||||
Create bucket
|
||||
</Button>
|
||||
</Empty>
|
||||
|
||||
@@ -138,45 +138,48 @@
|
||||
{/if}
|
||||
</Button>
|
||||
<svelte:fragment slot="tooltip">
|
||||
<Layout.Stack gap="s">
|
||||
{#if displayQuickFilters}
|
||||
<slot name="quick" />
|
||||
{:else}
|
||||
<p>Apply filter rules to refine the table view</p>
|
||||
<Content
|
||||
bind:columnId={selectedColumn}
|
||||
bind:operatorKey
|
||||
bind:value
|
||||
bind:arrayValues
|
||||
{columns}
|
||||
{singleCondition}
|
||||
on:apply={afterApply}
|
||||
on:clear={() => (applied = 0)} />
|
||||
{/if}
|
||||
<div
|
||||
class="u-flex u-cross-center u-margin-block-start-16"
|
||||
class:u-main-end={!quickFilters}
|
||||
class:u-main-space-between={quickFilters}>
|
||||
{#if quickFilters}
|
||||
<Button
|
||||
text
|
||||
on:click={() => (displayQuickFilters = !displayQuickFilters)}
|
||||
class="u-margin-block-end-auto">
|
||||
{displayQuickFilters ? 'Advanced filters' : 'Quick filters'}
|
||||
</Button>
|
||||
<div style:width="420px">
|
||||
<Layout.Stack gap="s">
|
||||
{#if displayQuickFilters}
|
||||
<slot name="quick" />
|
||||
{:else}
|
||||
<p>Apply filter rules to refine the table view</p>
|
||||
<Content
|
||||
bind:columnId={selectedColumn}
|
||||
bind:operatorKey
|
||||
bind:value
|
||||
bind:arrayValues
|
||||
{columns}
|
||||
{singleCondition}
|
||||
on:apply={afterApply}
|
||||
on:clear={() => (applied = 0)} />
|
||||
{/if}
|
||||
<div class="u-flex u-gap-8">
|
||||
{#if singleCondition}
|
||||
<Button size="s" text on:click={toggleDropdown}>Cancel</Button>
|
||||
{:else}
|
||||
<Button size="s" disabled={applied === 0} text on:click={clearAll}>
|
||||
Clear all
|
||||
<div
|
||||
class="u-flex u-cross-center u-margin-block-start-16"
|
||||
class:u-main-end={!quickFilters}
|
||||
class:u-main-space-between={quickFilters}>
|
||||
{#if quickFilters}
|
||||
<Button
|
||||
text
|
||||
on:click={() => (displayQuickFilters = !displayQuickFilters)}
|
||||
class="u-margin-block-end-auto">
|
||||
{displayQuickFilters ? 'Advanced filters' : 'Quick filters'}
|
||||
</Button>
|
||||
{/if}
|
||||
<Button size="s" on:click={apply} disabled={isButtonDisabled}>Apply</Button>
|
||||
<div class="u-flex u-gap-8">
|
||||
{#if singleCondition}
|
||||
<Button size="s" text on:click={toggleDropdown}>Cancel</Button>
|
||||
{:else}
|
||||
<Button size="s" disabled={applied === 0} text on:click={clearAll}>
|
||||
Clear all
|
||||
</Button>
|
||||
{/if}
|
||||
<Button size="s" on:click={apply} disabled={isButtonDisabled}
|
||||
>Apply</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Popover>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
<script lang="ts">
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import { IconChevronLeft, IconChevronRight } from '@appwrite.io/pink-icons-svelte';
|
||||
import { BottomSheet } from '..';
|
||||
import { addFilterAndApply, type FilterData } from './quickFilters';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
|
||||
let {
|
||||
openBottomSheet = $bindable(false),
|
||||
columns,
|
||||
filterCols = $bindable([]),
|
||||
analyticsSource
|
||||
}: {
|
||||
openBottomSheet: boolean;
|
||||
columns: Writable<Column[]>;
|
||||
filterCols: FilterData[];
|
||||
analyticsSource?: string;
|
||||
} = $props();
|
||||
|
||||
let subSheets = $derived(
|
||||
filterCols.map((col) => {
|
||||
return {
|
||||
title: col.title,
|
||||
top: {
|
||||
title: col.title,
|
||||
trailingIcon: IconChevronRight,
|
||||
items: col.options.map((o) => {
|
||||
return {
|
||||
title: capitalize(o.label),
|
||||
name: capitalize(o.label),
|
||||
options: col.options,
|
||||
checked: o.checked,
|
||||
onClick: () => {
|
||||
addFilterAndApply(
|
||||
col.id,
|
||||
col.title,
|
||||
col.operator,
|
||||
o.value,
|
||||
generateFilterArrayValue(col, o.value),
|
||||
$columns,
|
||||
analyticsSource ?? ''
|
||||
);
|
||||
}
|
||||
};
|
||||
})
|
||||
},
|
||||
bottom: {
|
||||
name: 'Back',
|
||||
items: [
|
||||
{
|
||||
name: 'Back',
|
||||
leadingIcon: IconChevronLeft,
|
||||
navigatePrevious: true
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
let filtersBottomSheet = $derived({
|
||||
top: {
|
||||
title: 'Filters',
|
||||
items: filterCols.map((col) => {
|
||||
return {
|
||||
name: col.title,
|
||||
onClick: () =>
|
||||
console.log(subSheets.find((sheet) => sheet?.title === col?.title)),
|
||||
subMenu: subSheets.find((sheet) => sheet?.title === col?.title),
|
||||
trailingIcon: IconChevronRight
|
||||
};
|
||||
})
|
||||
},
|
||||
bottom: {
|
||||
name: 'Clear All',
|
||||
items: [
|
||||
{
|
||||
name: 'Clear All',
|
||||
onClick: () => {
|
||||
filterCols.forEach((col) => {
|
||||
addFilterAndApply(
|
||||
col.id,
|
||||
col.title,
|
||||
col.operator,
|
||||
null,
|
||||
[],
|
||||
$columns,
|
||||
analyticsSource ?? ''
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
function generateFilterArrayValue(col: FilterData, value: string) {
|
||||
if (!col?.array) return [];
|
||||
|
||||
if (col.options?.find((opt) => opt.value === value)?.checked) {
|
||||
return col.options
|
||||
?.filter((opt) => opt?.checked)
|
||||
.map((opt) => opt.value)
|
||||
.filter((item) => item !== value);
|
||||
} else {
|
||||
let arrayValue =
|
||||
col.options?.filter((opt) => opt?.checked)?.map((opt) => opt.value) ?? [];
|
||||
arrayValue = [...arrayValue, value];
|
||||
|
||||
return arrayValue;
|
||||
}
|
||||
}
|
||||
|
||||
$inspect(subSheets);
|
||||
</script>
|
||||
|
||||
<BottomSheet.Menu bind:isOpen={openBottomSheet} menu={filtersBottomSheet} />
|
||||
@@ -20,7 +20,6 @@
|
||||
export let show = false;
|
||||
export let columns: Writable<Column[]>;
|
||||
export let analyticsSource = '';
|
||||
export let clearOnClick = false;
|
||||
/* eslint @typescript-eslint/no-explicit-any: 'off' */
|
||||
let value: any = null;
|
||||
let selectedColumn: string | null = null;
|
||||
|
||||
@@ -4,3 +4,4 @@ export { default as CustomFilters } from './customFilters.svelte';
|
||||
export { default as QuickFilters } from './quickFilters.svelte';
|
||||
export { default as ParsedTagList } from './parsedTagList.svelte';
|
||||
export { hasPageQueries, queryParamToMap, queries } from '$lib/components/filters/store';
|
||||
export { default as FiltersBottomSheet } from './filtersBottomSheet.svelte';
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
{#if $parsedTags?.length}
|
||||
<Layout.Stack direction="row" gap="s" wrap="wrap" alignItems="center" inline>
|
||||
{#each $parsedTags as tag}
|
||||
{#each $parsedTags as tag (tag.tag)}
|
||||
<span>
|
||||
<Tooltip
|
||||
disabled={Array.isArray(tag.value) ? tag.value?.length < 3 : true}
|
||||
|
||||
@@ -3,26 +3,21 @@
|
||||
import { queryParamToMap } from '$lib/components/filters/store';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import { type Writable } from 'svelte/store';
|
||||
import { CustomFilters } from '$lib/components/filters';
|
||||
import { addFilterAndApply, buildFilterCol, type FilterData } from './quickFilters';
|
||||
import { CustomFilters, FiltersBottomSheet } from '$lib/components/filters';
|
||||
import { addFilterAndApply, buildFilterCol } from './quickFilters';
|
||||
import { parsedTags, setFilters } from './setFilters';
|
||||
import Menu from '../menu/menu.svelte';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
import {
|
||||
IconChevronLeft,
|
||||
IconChevronRight,
|
||||
IconFilterLine
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { IconFilterLine } from '@appwrite.io/pink-icons-svelte';
|
||||
import QuickfiltersSubMenu from './quickfiltersSubMenu.svelte';
|
||||
import { isSmallViewport } from '$lib/stores/viewport';
|
||||
import { BottomSheet } from '..';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
|
||||
export let columns: Writable<Column[]>;
|
||||
export let analyticsSource: string;
|
||||
export let openBottomSheet = false;
|
||||
|
||||
let openBottomSheet = false;
|
||||
//TODO: remove this when all header are replace with `ResponsiveContainerHeader`
|
||||
let filterCols = $columns
|
||||
.map((col) => (col.filter !== false ? buildFilterCol(col) : null))
|
||||
.filter((f) => f?.options);
|
||||
@@ -35,102 +30,6 @@
|
||||
setFilters(localTags, filterCols, $columns);
|
||||
filterCols = filterCols;
|
||||
});
|
||||
|
||||
$: subSheets = filterCols.map((col) => {
|
||||
return {
|
||||
title: col.title,
|
||||
top: {
|
||||
title: col.title,
|
||||
trailingIcon: IconChevronRight,
|
||||
items: col.options.map((o) => {
|
||||
return {
|
||||
title: capitalize(o.label),
|
||||
name: capitalize(o.label),
|
||||
options: col.options,
|
||||
checked: o.checked,
|
||||
onClick: () => {
|
||||
addFilterAndApply(
|
||||
col.id,
|
||||
col.title,
|
||||
col.operator,
|
||||
o.value,
|
||||
generateFilterArrayValue(col, o.value),
|
||||
$columns,
|
||||
analyticsSource
|
||||
);
|
||||
subSheets = subSheets;
|
||||
}
|
||||
};
|
||||
})
|
||||
},
|
||||
bottom: {
|
||||
name: 'Back',
|
||||
items: [
|
||||
{
|
||||
name: 'Back',
|
||||
leadingIcon: IconChevronLeft,
|
||||
navigatePrevious: true,
|
||||
onClick: () => {
|
||||
// navigate to the previous menu
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
$: organizationsBottomSheet = {
|
||||
top: {
|
||||
title: 'Filters',
|
||||
items: filterCols.map((col) => {
|
||||
return {
|
||||
name: col.title,
|
||||
onClick: () =>
|
||||
console.log(subSheets.find((sheet) => sheet?.title === col?.title)),
|
||||
subMenu: subSheets.find((sheet) => sheet?.title === col?.title),
|
||||
trailingIcon: IconChevronRight
|
||||
};
|
||||
})
|
||||
},
|
||||
bottom: {
|
||||
name: 'Clear All',
|
||||
items: [
|
||||
{
|
||||
name: 'Clear All',
|
||||
onClick: () => {
|
||||
filterCols.forEach((col) => {
|
||||
addFilterAndApply(
|
||||
col.id,
|
||||
col.title,
|
||||
col.operator,
|
||||
null,
|
||||
[],
|
||||
$columns,
|
||||
analyticsSource
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
function generateFilterArrayValue(col: FilterData, value: string) {
|
||||
if (!col?.array) return [];
|
||||
|
||||
if (col.options?.find((opt) => opt.value === value)?.checked) {
|
||||
return col.options
|
||||
?.filter((opt) => opt?.checked)
|
||||
.map((opt) => opt.value)
|
||||
.filter((item) => item !== value);
|
||||
} else {
|
||||
let arrayValue =
|
||||
col.options?.filter((opt) => opt?.checked)?.map((opt) => opt.value) ?? [];
|
||||
arrayValue = [...arrayValue, value];
|
||||
|
||||
return arrayValue;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if $isSmallViewport}
|
||||
@@ -162,7 +61,7 @@
|
||||
</Button>
|
||||
{/if}
|
||||
<svelte:fragment slot="menu">
|
||||
{#each filterCols as filter}
|
||||
{#each filterCols as filter (filter.title + filter.id)}
|
||||
{#if filter.options}
|
||||
<QuickfiltersSubMenu
|
||||
{filter}
|
||||
@@ -204,5 +103,5 @@
|
||||
{/if}
|
||||
|
||||
{#if $isSmallViewport && openBottomSheet}
|
||||
<BottomSheet.Menu bind:isOpen={openBottomSheet} menu={organizationsBottomSheet} />
|
||||
<FiltersBottomSheet bind:openBottomSheet {columns} {analyticsSource} bind:filterCols />
|
||||
{/if}
|
||||
@@ -25,7 +25,7 @@ export function buildFilterCol(col: Column, customOperator = null): FilterData {
|
||||
return {
|
||||
value: (element?.value ?? element) as string,
|
||||
label: (element?.label ?? element) as string,
|
||||
checked: false
|
||||
checked: undefined
|
||||
};
|
||||
})
|
||||
};
|
||||
|
||||
@@ -41,9 +41,9 @@
|
||||
</div>
|
||||
|
||||
<div class="menu subMenu" use:melt={$subMenu}>
|
||||
<Card.Base padding="xxxs">
|
||||
<Card.Base padding="none">
|
||||
<div use:melt={$radioGroup}>
|
||||
{#each filter.options as option (option.value + option.checked)}
|
||||
{#each filter.options as option (filter.title + option.value + option.label + option.checked)}
|
||||
{#if variant === 'radio'}
|
||||
<div use:melt={$item}>
|
||||
<ActionMenu.Root>
|
||||
@@ -69,7 +69,15 @@
|
||||
});
|
||||
}}>
|
||||
<Layout.Stack direction="row" gap="s">
|
||||
<Selector.Checkbox checked={option.checked} size="s" />
|
||||
<Selector.Checkbox
|
||||
checked={option.checked}
|
||||
on:click={() => {
|
||||
option.checked = !option.checked;
|
||||
dispatch('add', {
|
||||
value: option.checked
|
||||
});
|
||||
}}
|
||||
size="s" />
|
||||
{capitalize(option.label)}
|
||||
</Layout.Stack>
|
||||
</ActionMenu.Item.Button>
|
||||
@@ -78,7 +86,7 @@
|
||||
{/if}
|
||||
{/each}
|
||||
{#if filter.options.some((option) => option.checked)}
|
||||
<div class="separator" use:melt={$separator} />
|
||||
<div class="separator" use:melt={$separator}></div>
|
||||
<div use:melt={$item}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Button
|
||||
|
||||
@@ -26,8 +26,8 @@ export function setFilters(localTags: TagValue[], filterCols: FilterData[], $col
|
||||
}
|
||||
});
|
||||
|
||||
// Reasinging the filters to trigger reactivity
|
||||
filterCols = filterCols;
|
||||
// Reassigning the filters to trigger reactivity
|
||||
filterCols = [...filterCols];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+34
-51
@@ -4,33 +4,38 @@
|
||||
import { Icon, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { installation, repository } from '$lib/stores/vcs';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { IconArrowSmRight } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Link } from '$lib/elements';
|
||||
import { NewRepository, Repositories } from '$lib/components/git';
|
||||
import ConnectGit from '$lib/components/git/connectGit.svelte';
|
||||
import { Adapter, BuildRuntime, Framework, type Models } from '@appwrite.io/console';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { Click, trackEvent } from '$lib/actions/analytics';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import RepositoryBehaviour from '$lib/components/git/repositoryBehaviour.svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
let {
|
||||
show = $bindable(false),
|
||||
product,
|
||||
callbackState = null,
|
||||
onlyExisting = false,
|
||||
connect = async () => {}
|
||||
}: {
|
||||
show?: boolean;
|
||||
product: 'functions' | 'sites';
|
||||
callbackState?: Record<string, string>;
|
||||
onlyExisting?: boolean;
|
||||
connect?: (installationId: string, repositoryId: string) => Promise<void>;
|
||||
} = $props();
|
||||
|
||||
export let show = false;
|
||||
export let site: Models.Site;
|
||||
export let callbackState: Record<string, string> = null;
|
||||
export let onlyExisting = false;
|
||||
|
||||
let repositoryBehaviour: 'new' | 'existing' | undefined = onlyExisting ? 'existing' : undefined;
|
||||
let repositoryName = '';
|
||||
let repositoryPrivate = true;
|
||||
let selectedInstallationId = '';
|
||||
let selectedRepository = '';
|
||||
let installations = { installations: [], total: 0 };
|
||||
let hasInstallations = !!installations?.total;
|
||||
let error = '';
|
||||
let repositoryBehaviour: 'new' | 'existing' | undefined = $state(
|
||||
onlyExisting ? 'existing' : undefined
|
||||
);
|
||||
let repositoryName = $state('');
|
||||
let repositoryPrivate = $state(true);
|
||||
let selectedInstallationId = $state('');
|
||||
let selectedRepository = $state('');
|
||||
let installations = $state({ installations: [], total: 0 });
|
||||
let error = $state('');
|
||||
|
||||
onMount(async () => {
|
||||
installations = await sdk.forProject.vcs.listInstallations();
|
||||
@@ -38,11 +43,9 @@
|
||||
$installation = installations.installations[0];
|
||||
}
|
||||
selectedInstallationId = installations.total ? installations.installations[0]?.$id : '';
|
||||
hasInstallations = !!installations?.total;
|
||||
if (hasInstallations) {
|
||||
if (!!installations?.total) {
|
||||
repositoryBehaviour = 'existing';
|
||||
}
|
||||
console.log(selectedInstallationId);
|
||||
});
|
||||
|
||||
async function connectRepo() {
|
||||
@@ -57,28 +60,8 @@
|
||||
selectedRepository = repo.id;
|
||||
}
|
||||
|
||||
const s = await sdk.forProject.sites.update(
|
||||
site.$id,
|
||||
site.name,
|
||||
site.framework as Framework,
|
||||
site.enabled,
|
||||
site.timeout,
|
||||
site.installCommand,
|
||||
site.buildCommand,
|
||||
site.outputDirectory,
|
||||
site.buildRuntime as BuildRuntime,
|
||||
site.adapter as Adapter,
|
||||
site.fallbackFile,
|
||||
selectedInstallationId,
|
||||
selectedRepository,
|
||||
'main',
|
||||
undefined,
|
||||
undefined,
|
||||
undefined
|
||||
);
|
||||
invalidate(Dependencies.SITE);
|
||||
await connect(selectedInstallationId, selectedRepository);
|
||||
show = false;
|
||||
dispatch('connect', s);
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: 'Repository connected successfully'
|
||||
@@ -96,9 +79,10 @@
|
||||
onSubmit={connectRepo}
|
||||
bind:error>
|
||||
<span slot="description">
|
||||
Connect your site to an existing repository or create a new one.
|
||||
Connect your {product === 'functions' ? 'function' : 'site'} to an existing repository or create
|
||||
a new one.
|
||||
</span>
|
||||
{#if hasInstallations}
|
||||
{#if !!installations?.total}
|
||||
<Layout.Stack gap="xl">
|
||||
{#if !onlyExisting}
|
||||
<RepositoryBehaviour bind:repositoryBehaviour />
|
||||
@@ -111,18 +95,17 @@
|
||||
{installations} />
|
||||
{:else}
|
||||
<Repositories
|
||||
bind:hasInstallations
|
||||
bind:selectedRepository
|
||||
product="sites"
|
||||
{product}
|
||||
action="button"
|
||||
{callbackState}
|
||||
on:connect={(e) => {
|
||||
connect={(e) => {
|
||||
trackEvent(Click.ConnectRepositoryClick, {
|
||||
from: 'sites'
|
||||
from: product
|
||||
});
|
||||
repository.set(e.detail);
|
||||
repositoryName = e.detail.name;
|
||||
selectedRepository = e.detail.id;
|
||||
repository.set(e);
|
||||
repositoryName = e.name;
|
||||
selectedRepository = e.id;
|
||||
connectRepo();
|
||||
}} />
|
||||
{/if}
|
||||
@@ -1,25 +1,17 @@
|
||||
<script lang="ts">
|
||||
import Link from '$lib/elements/link.svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
export let deployment: Models.Deployment;
|
||||
</script>
|
||||
|
||||
<p>
|
||||
<DualTimeView time={deployment.$updatedAt} />
|
||||
{#if deployment.providerCommitAuthor}
|
||||
<Tooltip>
|
||||
<span>
|
||||
{capitalize(timeFromNow(deployment.$updatedAt))}
|
||||
</span>
|
||||
<span slot="tooltip">{toLocaleDateTime(deployment.$updatedAt)}</span>
|
||||
</Tooltip>
|
||||
by <Link href={deployment.providerCommitAuthorUrl} external
|
||||
>{deployment.providerCommitAuthor}</Link>
|
||||
{:else}
|
||||
<DualTimeView time={deployment.$updatedAt} />
|
||||
by
|
||||
<Link href={deployment.providerCommitAuthorUrl} external>
|
||||
{deployment.providerCommitAuthor}
|
||||
</Link>
|
||||
{/if}
|
||||
</p>
|
||||
@@ -1,34 +1,54 @@
|
||||
<script lang="ts">
|
||||
import { Trim } from '$lib/components';
|
||||
import { Link } from '$lib/elements';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { protocol } from '$routes/(console)/store';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { IconExternalLink } from '@appwrite.io/pink-icons-svelte';
|
||||
import { IconExternalLink, IconQrcode } from '@appwrite.io/pink-icons-svelte';
|
||||
import { ActionMenu, Icon, Layout, Popover, Tag, Typography } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let domains: Models.ProxyRuleList;
|
||||
let {
|
||||
domains,
|
||||
hideQRCode = true,
|
||||
showQR = () => {}
|
||||
}: {
|
||||
domains: Models.ProxyRuleList;
|
||||
hideQRCode?: boolean;
|
||||
showQR?: (show: boolean) => void;
|
||||
} = $props();
|
||||
|
||||
let sortedDomains = $derived(
|
||||
domains?.rules?.sort((a, b) => {
|
||||
if (a?.trigger === 'manual' && b?.trigger !== 'manual') {
|
||||
return -1;
|
||||
} else if (a?.trigger !== 'manual' && b?.trigger === 'manual') {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
);
|
||||
</script>
|
||||
|
||||
<Layout.Stack gap="xxs" direction="row" alignItems="center">
|
||||
{#if domains?.total}
|
||||
<Link external href={`${$protocol}${domains.rules[0]?.domain}`} variant="muted">
|
||||
<Link external href={`${$protocol}${sortedDomains[0]?.domain}`} variant="muted">
|
||||
<Layout.Stack gap="xxs" direction="row" alignItems="center">
|
||||
<Trim alternativeTrim>
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-primary">
|
||||
{domains.rules[0]?.domain}
|
||||
{sortedDomains[0]?.domain}
|
||||
</Typography.Text>
|
||||
</Trim>
|
||||
<Icon icon={IconExternalLink} size="s" />
|
||||
</Layout.Stack>
|
||||
</Link>
|
||||
{#if domains.rules.length > 1}
|
||||
|
||||
{#if sortedDomains.length > 1}
|
||||
<Popover padding="none" let:toggle>
|
||||
<Tag size="s" on:click={toggle}>
|
||||
+{domains.rules.length - 1}
|
||||
<Tag size="xs" on:click={toggle}>
|
||||
+{sortedDomains.length - 1}
|
||||
</Tag>
|
||||
<svelte:fragment slot="tooltip">
|
||||
<ActionMenu.Root>
|
||||
{#each domains.rules as rule, i}
|
||||
{#each sortedDomains as rule, i}
|
||||
{#if i !== 0}
|
||||
<ActionMenu.Item.Anchor
|
||||
href={`${$protocol}${rule.domain}`}
|
||||
@@ -44,6 +64,11 @@
|
||||
</svelte:fragment>
|
||||
</Popover>
|
||||
{/if}
|
||||
{#if !hideQRCode}
|
||||
<Button icon secondary size="xs" on:click={() => showQR(true)}>
|
||||
<Icon icon={IconQrcode} size="s" />
|
||||
</Button>
|
||||
{/if}
|
||||
{:else}
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-primary">
|
||||
No domains available
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { ActionMenu, Layout, Popover, Icon } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let deployment: Models.Deployment;
|
||||
let {
|
||||
deployment
|
||||
}: {
|
||||
deployment: Models.Deployment;
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
{#if deployment.type === 'vcs'}
|
||||
|
||||
@@ -7,3 +7,5 @@ export { default as DeploymentSource } from './deploymentSource.svelte';
|
||||
export { default as DeploymentDomains } from './deploymentDomains.svelte';
|
||||
export { default as ConnectBehaviour } from './connectBehaviour.svelte';
|
||||
export { default as ProductionBranchFieldset } from './productionBranchFieldset.svelte';
|
||||
export { default as RepositoryCard } from './repositoryCard.svelte';
|
||||
export { default as ConnectRepoModal } from './connectRepoModal.svelte';
|
||||
@@ -1,15 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { Button, InputSelect, InputText } from '$lib/elements/forms';
|
||||
import { Fieldset, Layout, Selector, Skeleton } from '@appwrite.io/pink-svelte';
|
||||
import { Fieldset, Input, Layout, Selector, Skeleton } from '@appwrite.io/pink-svelte';
|
||||
import SelectRootModal from './selectRootModal.svelte';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { sortBranches } from '$lib/stores/vcs';
|
||||
|
||||
export let branch: string;
|
||||
export let branch = 'main';
|
||||
export let rootDir: string;
|
||||
export let silentMode: boolean;
|
||||
export let installationId: string;
|
||||
export let repositoryId: string;
|
||||
export let product: 'sites' | 'functions';
|
||||
|
||||
let show = false;
|
||||
|
||||
@@ -59,7 +60,7 @@
|
||||
return a.label > b.label ? 1 : -1;
|
||||
}) ?? []}
|
||||
<Layout.Stack gap="xl">
|
||||
<InputSelect
|
||||
<Input.ComboBox
|
||||
required
|
||||
id="branch"
|
||||
label="Production branch"
|
||||
@@ -90,5 +91,5 @@
|
||||
</Fieldset>
|
||||
|
||||
{#if show}
|
||||
<SelectRootModal bind:show bind:rootDir />
|
||||
<SelectRootModal bind:show bind:rootDir {product} />
|
||||
{/if}
|
||||
@@ -5,7 +5,6 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { repositories } from '$routes/(console)/project-[project]/functions/function-[function]/store';
|
||||
import { installation, installations, repository } from '$lib/stores/vcs';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import {
|
||||
Layout,
|
||||
Table,
|
||||
@@ -15,27 +14,33 @@
|
||||
Skeleton,
|
||||
Button as PinkButton
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import { IconLockClosed } from '@appwrite.io/pink-icons-svelte';
|
||||
import { IconLockClosed, IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import ConnectGit from './connectGit.svelte';
|
||||
import SvgIcon from '../svgIcon.svelte';
|
||||
import { getFrameworkIcon } from '$routes/(console)/project-[project]/sites/store';
|
||||
import { VCSDetectionType, type Models } from '@appwrite.io/console';
|
||||
import { getFrameworkIcon } from '$lib/stores/sites';
|
||||
import { connectGitHub } from '$lib/stores/git';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
let {
|
||||
action = $bindable('select'),
|
||||
selectedRepository = $bindable(undefined),
|
||||
installationList = $bindable($installations),
|
||||
hasInstallations = $bindable($installations?.total > 0),
|
||||
product = 'functions',
|
||||
callbackState = null,
|
||||
connect = () => {}
|
||||
}: {
|
||||
action?: 'button' | 'select';
|
||||
selectedRepository?: string;
|
||||
installationList?: Models.InstallationList;
|
||||
hasInstallations?: boolean;
|
||||
product?: 'functions' | 'sites';
|
||||
callbackState?: Record<string, string> | null;
|
||||
connect?: (repository: Models.ProviderRepository) => void;
|
||||
} = $props();
|
||||
|
||||
export let callbackState: Record<string, string> = null;
|
||||
export let selectedRepository: string = null;
|
||||
export let hasInstallations = false;
|
||||
export let action: 'button' | 'select' = 'select';
|
||||
export let installationList = $installations;
|
||||
export let product: 'functions' | 'sites' = 'functions';
|
||||
|
||||
let search = '';
|
||||
let selectedInstallation = null;
|
||||
|
||||
$: {
|
||||
hasInstallations = installationList?.total > 0;
|
||||
}
|
||||
let search = $state('');
|
||||
let selectedInstallation = $state(null);
|
||||
|
||||
async function loadInstallations() {
|
||||
if (installationList) {
|
||||
@@ -64,24 +69,7 @@
|
||||
$repositories.installationId !== installationId ||
|
||||
$repositories.search !== search
|
||||
) {
|
||||
//TODO: remove forced cast after backend fixes
|
||||
if (product === 'functions') {
|
||||
$repositories.repositories = (
|
||||
(await sdk.forProject.vcs.listRepositories(
|
||||
installationId,
|
||||
VCSDetectionType.Runtime,
|
||||
search || undefined
|
||||
)) as unknown as Models.ProviderRepositoryRuntimeList
|
||||
).runtimeProviderRepositories;
|
||||
} else {
|
||||
$repositories.repositories = (
|
||||
await sdk.forProject.vcs.listRepositories(
|
||||
installationId,
|
||||
VCSDetectionType.Framework,
|
||||
search || undefined
|
||||
)
|
||||
).frameworkProviderRepositories;
|
||||
}
|
||||
await fetchRepos(installationId, search);
|
||||
}
|
||||
|
||||
$repositories.search = search;
|
||||
@@ -94,6 +82,26 @@
|
||||
|
||||
return $repositories.repositories;
|
||||
}
|
||||
|
||||
async function fetchRepos(installationId: string, search: string) {
|
||||
if (product === 'functions') {
|
||||
$repositories.repositories = (
|
||||
(await sdk.forProject.vcs.listRepositories(
|
||||
installationId,
|
||||
VCSDetectionType.Runtime,
|
||||
search || undefined
|
||||
)) as unknown as Models.ProviderRepositoryRuntimeList
|
||||
).runtimeProviderRepositories; //TODO: remove forced cast after backend fixes
|
||||
} else {
|
||||
$repositories.repositories = (
|
||||
(await sdk.forProject.vcs.listRepositories(
|
||||
installationId,
|
||||
VCSDetectionType.Framework,
|
||||
search || undefined
|
||||
)) as unknown as Models.ProviderRepositoryFrameworkList
|
||||
).frameworkProviderRepositories;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if hasInstallations}
|
||||
@@ -117,13 +125,23 @@
|
||||
<Layout.Stack direction="row">
|
||||
<InputSelect
|
||||
id="installation"
|
||||
options={installations.map((entry) => {
|
||||
return {
|
||||
label: entry.organization,
|
||||
value: entry.$id
|
||||
};
|
||||
})}
|
||||
options={[
|
||||
...installations.map((entry) => {
|
||||
return {
|
||||
label: entry.organization,
|
||||
value: entry.$id
|
||||
};
|
||||
}),
|
||||
{
|
||||
label: 'Add installation',
|
||||
leadingIcon: IconPlus,
|
||||
value: 'new'
|
||||
}
|
||||
]}
|
||||
on:change={() => {
|
||||
if (selectedInstallation === 'new') {
|
||||
window.location.href = connectGitHub(callbackState).toString();
|
||||
}
|
||||
search = '';
|
||||
installation.set(
|
||||
installations.find((entry) => entry.$id === selectedInstallation)
|
||||
@@ -154,84 +172,90 @@
|
||||
</Table.Root>
|
||||
{:then response}
|
||||
{#if response?.length}
|
||||
<Paginator
|
||||
items={response}
|
||||
let:paginatedItems
|
||||
hideFooter={response?.length <= 6}
|
||||
limit={6}>
|
||||
<Table.Root columns={1} let:root>
|
||||
{#each paginatedItems as repo}
|
||||
<Table.Row.Base {root}>
|
||||
<Table.Cell {root}>
|
||||
<Layout.Stack direction="row" alignItems="center" gap="s">
|
||||
{#if action === 'select'}
|
||||
<input
|
||||
class="is-small u-margin-inline-end-8"
|
||||
type="radio"
|
||||
name="repositories"
|
||||
bind:group={selectedRepository}
|
||||
on:change={() => repository.set(repo)}
|
||||
value={repo.id} />
|
||||
{/if}
|
||||
{#if product === 'sites'}
|
||||
{#if repo?.framework && repo.framework !== 'other'}
|
||||
<Avatar size="xs" alt={repo.name}>
|
||||
<SvgIcon
|
||||
name={getFrameworkIcon(repo.framework)}
|
||||
iconSize="small" />
|
||||
</Avatar>
|
||||
{:else}
|
||||
<Avatar size="xs" alt={repo.name} empty />
|
||||
{/if}
|
||||
{:else}
|
||||
{@const iconName = repo?.runtime
|
||||
? repo.runtime.split('-')[0]
|
||||
: undefined}
|
||||
<Avatar size="xs" alt={repo.name} empty={!iconName}>
|
||||
<SvgIcon name={iconName} iconSize="small" />
|
||||
</Avatar>
|
||||
{/if}
|
||||
<Paginator items={response} hideFooter={response?.length <= 6} limit={6}>
|
||||
{#snippet children(paginatedItems)}
|
||||
<Table.Root columns={1} let:root>
|
||||
{#each paginatedItems as repo}
|
||||
<Table.Row.Base {root}>
|
||||
<Table.Cell {root}>
|
||||
<Layout.Stack
|
||||
gap="s"
|
||||
direction="row"
|
||||
alignItems="center">
|
||||
<Typography.Text
|
||||
truncate
|
||||
color="--fgcolor-neutral-secondary">
|
||||
{repo.name}
|
||||
</Typography.Text>
|
||||
{#if repo.private}
|
||||
<Icon
|
||||
size="s"
|
||||
icon={IconLockClosed}
|
||||
color="--fgcolor-neutral-tertiary" />
|
||||
alignItems="center"
|
||||
gap="s">
|
||||
{#if action === 'select'}
|
||||
<input
|
||||
class="is-small u-margin-inline-end-8"
|
||||
type="radio"
|
||||
name="repositories"
|
||||
bind:group={selectedRepository}
|
||||
onchange={() => repository.set(repo)}
|
||||
value={repo.id} />
|
||||
{/if}
|
||||
<time datetime={repo.pushedAt}>
|
||||
<Typography.Caption
|
||||
variant="400"
|
||||
truncate
|
||||
color="--fgcolor-neutral-tertiary">
|
||||
{timeFromNow(repo.pushedAt)}
|
||||
</Typography.Caption>
|
||||
</time>
|
||||
</Layout.Stack>
|
||||
{#if action === 'button'}
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
justifyContent="flex-end">
|
||||
<PinkButton.Button
|
||||
{#if product === 'sites'}
|
||||
{#if repo?.framework && repo.framework !== 'other'}
|
||||
<Avatar size="xs" alt={repo.name}>
|
||||
<SvgIcon
|
||||
name={getFrameworkIcon(
|
||||
repo.framework
|
||||
)}
|
||||
iconSize="small" />
|
||||
</Avatar>
|
||||
{:else}
|
||||
<Avatar size="xs" alt={repo.name} empty />
|
||||
{/if}
|
||||
{:else}
|
||||
{@const iconName = repo?.runtime
|
||||
? repo.runtime.split('-')[0]
|
||||
: undefined}
|
||||
<Avatar
|
||||
size="xs"
|
||||
variant="secondary"
|
||||
on:click={() => dispatch('connect', repo)}>
|
||||
Connect
|
||||
</PinkButton.Button>
|
||||
alt={repo.name}
|
||||
empty={!iconName}>
|
||||
<SvgIcon name={iconName} iconSize="small" />
|
||||
</Avatar>
|
||||
{/if}
|
||||
<Layout.Stack
|
||||
gap="s"
|
||||
direction="row"
|
||||
alignItems="center">
|
||||
<Typography.Text
|
||||
truncate
|
||||
color="--fgcolor-neutral-secondary">
|
||||
{repo.name}
|
||||
</Typography.Text>
|
||||
{#if repo.private}
|
||||
<Icon
|
||||
size="s"
|
||||
icon={IconLockClosed}
|
||||
color="--fgcolor-neutral-tertiary" />
|
||||
{/if}
|
||||
<time datetime={repo.pushedAt}>
|
||||
<Typography.Caption
|
||||
variant="400"
|
||||
truncate
|
||||
color="--fgcolor-neutral-tertiary">
|
||||
{timeFromNow(repo.pushedAt)}
|
||||
</Typography.Caption>
|
||||
</time>
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Table.Cell>
|
||||
</Table.Row.Base>
|
||||
{/each}
|
||||
</Table.Root>
|
||||
{#if action === 'button'}
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
justifyContent="flex-end">
|
||||
<PinkButton.Button
|
||||
size="xs"
|
||||
variant="secondary"
|
||||
on:click={() => connect(repo)}>
|
||||
Connect
|
||||
</PinkButton.Button>
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Table.Cell>
|
||||
</Table.Row.Base>
|
||||
{/each}
|
||||
</Table.Root>
|
||||
{/snippet}
|
||||
</Paginator>
|
||||
{:else}
|
||||
<EmptySearch hidePages hidePagination bind:search target="repositories">
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<script lang="ts">
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import Link from '$lib/elements/link.svelte';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { IconGithub } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Card, Icon, Layout, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let repository: Models.ProviderRepository;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
</script>
|
||||
|
||||
<Card.Base padding="xs" radius="s" variant="secondary">
|
||||
<Layout.Stack direction="row" gap="s">
|
||||
<Layout.Stack direction="row" gap="s">
|
||||
<Icon icon={IconGithub} color="--fgcolor-neutral-primary" />
|
||||
<Layout.Stack gap="xxxs">
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-primary">
|
||||
{repository.name}
|
||||
</Typography.Text>
|
||||
<Layout.Stack direction="row" gap="s" alignItems="center">
|
||||
<Typography.Caption variant="400" color="--fgcolor-neutral-tertiary">
|
||||
Last updated: {toLocaleDateTime(repository.pushedAt)}
|
||||
</Typography.Caption>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="2"
|
||||
height="3"
|
||||
viewBox="0 0 2 3"
|
||||
fill="none">
|
||||
<circle cx="1" cy="1.5" r="1" fill="currentColor" />
|
||||
</svg>
|
||||
<Link
|
||||
size="s"
|
||||
variant="muted"
|
||||
external
|
||||
href={`https://github.com/${repository.organization}`}
|
||||
>{repository.organization}</Link>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
<Button secondary on:click={() => dispatch('disconnect')}>Disconnect</Button>
|
||||
</Layout.Stack>
|
||||
</Card.Base>
|
||||
@@ -4,9 +4,10 @@
|
||||
import { iconPath } from '$lib/stores/app';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { installation, repository } from '$lib/stores/vcs';
|
||||
import { VCSDetectionType } from '@appwrite.io/console';
|
||||
import { VCSDetectionType, type Models } from '@appwrite.io/console';
|
||||
import { DirectoryPicker } from '@appwrite.io/pink-svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
type Directory = {
|
||||
title: string;
|
||||
@@ -14,11 +15,12 @@
|
||||
fileCount: number;
|
||||
thumbnailUrl: string;
|
||||
children?: Directory[];
|
||||
loading?: boolean;
|
||||
};
|
||||
|
||||
export let show = false;
|
||||
export let rootDir: string;
|
||||
export let product: 'sites' | 'functions';
|
||||
export let product: 'sites' | 'functions' = 'functions';
|
||||
|
||||
let isLoading = true;
|
||||
let directories: Directory[] = [
|
||||
@@ -27,10 +29,13 @@
|
||||
fullPath: './',
|
||||
fileCount: 0,
|
||||
thumbnailUrl: 'root',
|
||||
children: []
|
||||
children: [],
|
||||
loading: false
|
||||
}
|
||||
];
|
||||
let currentPath: string = './';
|
||||
let currentDir: Directory;
|
||||
export let expanded = writable(['lib-0', 'tree-0']);
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
@@ -47,8 +52,10 @@
|
||||
title: dir.name,
|
||||
fullPath: currentPath + dir.name,
|
||||
fileCount: undefined,
|
||||
thumbnailUrl: dir.name
|
||||
thumbnailUrl: dir.name,
|
||||
loading: false
|
||||
}));
|
||||
currentDir = directories[0];
|
||||
// console.log(directories);
|
||||
isLoading = false;
|
||||
} catch (e) {
|
||||
@@ -57,47 +64,70 @@
|
||||
});
|
||||
|
||||
async function fetchContents(e: CustomEvent) {
|
||||
const path = e.detail.fullPath;
|
||||
const path = e.detail.fullPath as string;
|
||||
currentPath = path;
|
||||
try {
|
||||
const content = await sdk.forProject.vcs.getRepositoryContents(
|
||||
$installation.$id,
|
||||
$repository.id,
|
||||
path
|
||||
);
|
||||
// console.log(content);
|
||||
const fileCount = content.contents?.length ?? 0;
|
||||
const contentDirectories = content.contents.filter((e) => e.isDirectory);
|
||||
|
||||
if (contentDirectories.length === 0) {
|
||||
return;
|
||||
}
|
||||
let currentDir = directories[0];
|
||||
for (let i = 1; i < path.split('/').length; i++) {
|
||||
const dir = path.split('/')[i];
|
||||
currentDir = currentDir.children.find((d) => d.title === dir);
|
||||
}
|
||||
const pathSegments = path.split('/').filter((segment) => segment !== '.' && segment !== '');
|
||||
let traversedDir = directories[0]; // Start at root
|
||||
|
||||
currentDir.fileCount = fileCount;
|
||||
currentDir.children = contentDirectories.map((dir) => ({
|
||||
title: dir.name,
|
||||
fullPath: path + '/' + dir.name,
|
||||
fileCount: undefined,
|
||||
thumbnailUrl: undefined
|
||||
}));
|
||||
const runtime = await sdk.forProject.vcs.createRepositoryDetection(
|
||||
$installation.$id,
|
||||
$repository.id,
|
||||
VCSDetectionType.Framework, //TODO: add type: VCSDetectionType.Framework || VCSDetectionType.Runtime according to the product
|
||||
path
|
||||
);
|
||||
//TODO: Fix runtime after passing type: runtime.framework || runtime.runtime
|
||||
currentDir.children.forEach((dir) => {
|
||||
dir.thumbnailUrl = $iconPath(runtime.framework, 'color');
|
||||
});
|
||||
for (const segment of pathSegments) {
|
||||
const nextDir = traversedDir.children?.find((dir) => dir.title === segment);
|
||||
if (!nextDir) break;
|
||||
traversedDir = nextDir;
|
||||
}
|
||||
|
||||
currentDir = traversedDir;
|
||||
|
||||
if (!currentDir.fileCount) {
|
||||
currentDir.loading = true;
|
||||
directories = [...directories];
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
try {
|
||||
const content = await sdk.forProject.vcs.getRepositoryContents(
|
||||
$installation.$id,
|
||||
$repository.id,
|
||||
path
|
||||
);
|
||||
// console.log(content);
|
||||
const fileCount = content.contents?.length ?? 0;
|
||||
const contentDirectories = content.contents.filter((e) => e.isDirectory);
|
||||
|
||||
if (contentDirectories.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
currentDir.fileCount = fileCount;
|
||||
currentDir.children = contentDirectories.map((dir) => ({
|
||||
title: dir.name,
|
||||
fullPath: path + '/' + dir.name,
|
||||
fileCount: undefined,
|
||||
thumbnailUrl: undefined
|
||||
}));
|
||||
const runtime = await sdk.forProject.vcs.createRepositoryDetection(
|
||||
$installation.$id,
|
||||
$repository.id,
|
||||
product === 'sites' ? VCSDetectionType.Framework : VCSDetectionType.Runtime,
|
||||
path
|
||||
);
|
||||
if (product === 'sites') {
|
||||
currentDir.children.forEach((dir) => {
|
||||
dir.thumbnailUrl = $iconPath(runtime.framework, 'color');
|
||||
});
|
||||
} else if (product === 'functions') {
|
||||
currentDir.children.forEach((dir) => {
|
||||
dir.thumbnailUrl = $iconPath(
|
||||
(runtime as unknown as Models.DetectionRuntime).runtime,
|
||||
'color'
|
||||
);
|
||||
});
|
||||
}
|
||||
directories = [...directories];
|
||||
$expanded = [...$expanded, path];
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
currentDir.loading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,15 +135,13 @@
|
||||
rootDir = currentPath;
|
||||
show = false;
|
||||
}
|
||||
|
||||
// $: console.log(rootDir);
|
||||
</script>
|
||||
|
||||
<Modal title="Root directory" bind:show onSubmit={handleSubmit}>
|
||||
<span slot="description">
|
||||
Select the directory where your site code is located using the menu below.
|
||||
</span>
|
||||
<DirectoryPicker {directories} {isLoading} on:select={fetchContents} />
|
||||
<DirectoryPicker {directories} {isLoading} on:select={fetchContents} bind:expanded />
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Button secondary on:click={() => (show = false)}>Cancel</Button>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div class="file-preview-content">
|
||||
<div class="avatar">
|
||||
<span class="icon-external-link" aria-hidden="true" />
|
||||
<span class="icon-external-link" aria-hidden="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
@@ -81,4 +81,5 @@ export { default as Sidebar } from './sidebar.svelte';
|
||||
export { default as BottomSheet } from './bottom-sheet/index';
|
||||
export { default as Confirm } from './confirm.svelte';
|
||||
export { default as UsageCard } from './usageCard.svelte';
|
||||
export { default as ViewToggle } from './viewToggle.svelte';
|
||||
export { default as ExpirationInput } from './expirationInput.svelte';
|
||||
@@ -20,7 +20,7 @@
|
||||
aria-label="Close"
|
||||
title="Close"
|
||||
on:click={() => (show = false)}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
<span class="icon-x" aria-hidden="true"></span>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
export let tooltipShow = false;
|
||||
|
||||
// Pink v2
|
||||
export let icon: Props['icon'] = undefined;
|
||||
export let radius: Props['radius'] = 's';
|
||||
export let imageRadius: Props['imageRadius'] = 'xxs';
|
||||
export let padding: Props['padding'] = 's';
|
||||
export let variant: Props['variant'] = 'primary';
|
||||
export let name: Props['name'] = undefined;
|
||||
//temporarily unefined
|
||||
//temporarily undefined
|
||||
export let title: Props['title'] = undefined;
|
||||
export let disabled = false;
|
||||
export let src: string = null;
|
||||
@@ -31,6 +32,7 @@
|
||||
{name}
|
||||
{src}
|
||||
{alt}
|
||||
{icon}
|
||||
{padding}
|
||||
{imageRadius}
|
||||
{variant}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { page as pageStore } from '$app/stores';
|
||||
import { page as pageStore } from '$app/state';
|
||||
import { InputSelect } from '$lib/elements/forms';
|
||||
import { preferences } from '$lib/stores/preferences';
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
@@ -18,7 +18,7 @@
|
||||
];
|
||||
|
||||
async function limitChange() {
|
||||
const url = new URL($pageStore.url);
|
||||
const url = new URL(pageStore.url);
|
||||
const previousLimit = Number(url.searchParams.get('limit'));
|
||||
url.searchParams.set('limit', limit.toString());
|
||||
preferences.setLimit(limit);
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
</script>
|
||||
|
||||
<li class="list-item">
|
||||
<span class={icon ? `icon-${icon}` : 'icon-check-circle'} aria-hidden="true" />
|
||||
<span class={icon ? `icon-${icon}` : 'icon-check-circle'} aria-hidden="true"></span>
|
||||
<slot />
|
||||
</li>
|
||||
@@ -5,9 +5,9 @@
|
||||
</script>
|
||||
|
||||
<div class="loading-dots {className}">
|
||||
<div class="dot" />
|
||||
<div class="dot" />
|
||||
<div class="dot" />
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as LogsRequest } from './logsRequest.svelte';
|
||||
export { default as LogsResponse } from './logsResponse.svelte';
|
||||
@@ -0,0 +1,26 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/state';
|
||||
import { Link } from '$lib/elements';
|
||||
import { Alert } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let product: 'site' | 'function';
|
||||
</script>
|
||||
|
||||
{#if product === 'site'}
|
||||
<Alert.Inline status="info" title="Your logs are disabled">
|
||||
To view logs and errors, enable them in your
|
||||
<Link
|
||||
href={`${base}/project-${page.params.project}/sites/site-${page.params.site}/settings`}>
|
||||
site settings</Link
|
||||
>.
|
||||
</Alert.Inline>
|
||||
{:else if product === 'function'}
|
||||
<Alert.Inline status="info" title="Your execution logs are disabled">
|
||||
To view execution logs and errors, enable them in your
|
||||
<Link
|
||||
href={`${base}/project-${page.params.project}/functions/function-${page.params.function}/settings`}>
|
||||
function settings</Link
|
||||
>.
|
||||
</Alert.Inline>
|
||||
{/if}
|
||||
+24
-4
@@ -67,7 +67,17 @@
|
||||
</Layout.Stack>
|
||||
{#if requestTab === 'parameters'}
|
||||
{#if parameters?.length}
|
||||
<Table.Root columns={2} let:root>
|
||||
<Table.Root
|
||||
columns={[
|
||||
{
|
||||
id: 'key',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
id: 'value'
|
||||
}
|
||||
]}
|
||||
let:root>
|
||||
<svelte:fragment slot="header" let:root>
|
||||
<Table.Header.Cell {root}>Key</Table.Header.Cell>
|
||||
<Table.Header.Cell {root}>Value</Table.Header.Cell>
|
||||
@@ -80,13 +90,23 @@
|
||||
{/each}
|
||||
</Table.Root>
|
||||
{:else}
|
||||
<Card isTile padding="xs" radius="s">
|
||||
<Card padding="xs" radius="s">
|
||||
<Typography.Code>No parameters found.</Typography.Code>
|
||||
</Card>
|
||||
{/if}
|
||||
{:else if requestTab === 'headers'}
|
||||
{#if selectedLog.requestHeaders?.length}
|
||||
<Table.Root columns={2} let:root>
|
||||
<Table.Root
|
||||
columns={[
|
||||
{
|
||||
id: 'key',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
id: 'value'
|
||||
}
|
||||
]}
|
||||
let:root>
|
||||
<svelte:fragment slot="header" let:root>
|
||||
<Table.Header.Cell {root}>Key</Table.Header.Cell>
|
||||
<Table.Header.Cell {root}>Value</Table.Header.Cell>
|
||||
@@ -106,7 +126,7 @@
|
||||
</span>
|
||||
</Input.Helper>
|
||||
{:else}
|
||||
<Card isTile padding="xs" radius="s">
|
||||
<Card padding="xs" radius="s">
|
||||
<Typography.Code>No headers found.</Typography.Code>
|
||||
</Card>
|
||||
{/if}
|
||||
Loaded 100 of 814 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user