mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: more explicit projectId handling
This commit is contained in:
1 parent
e887b36e07
commit
a1cabc83fa
48 files changed
+148
-143
No files matched your search
@@ -7,7 +7,7 @@
|
||||
export let background: string | undefined = undefined;
|
||||
export let color = 'black';
|
||||
|
||||
$: src = sdk.forConsole.avatars.getInitials(name, size * 2, size * 2, background).toString();
|
||||
$: src = sdk.forConsole.avatars.getInitials(name, size * 2, size * 2, background);
|
||||
</script>
|
||||
|
||||
<Avatar {name} {size} {src} {color} />
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
$: planLimit = getServiceLimit(serviceId) || Infinity;
|
||||
|
||||
$: limit = preferences.get($page.route)?.limit ?? CARD_LIMIT;
|
||||
$: limit = preferences.get($page.params.project, $page.route)?.limit ?? CARD_LIMIT;
|
||||
</script>
|
||||
|
||||
<ul
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
function getCreditCardImage(brand: string, width = 46, height = 32) {
|
||||
if (!isValueOfStringEnum(CreditCard, brand)) return '';
|
||||
return sdk.forConsole.avatars.getCreditCard(brand, width, height).toString();
|
||||
return sdk.forConsole.avatars.getCreditCard(brand, width, height);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
const url = new URL($pageStore.url);
|
||||
const previousLimit = Number(url.searchParams.get('limit'));
|
||||
url.searchParams.set('limit', limit.toString());
|
||||
preferences.setLimit(limit);
|
||||
preferences.setLimit($pageStore.params.project, $pageStore.route, limit);
|
||||
|
||||
if (url.searchParams.has('page')) {
|
||||
const page = Number(url.searchParams.get('page'));
|
||||
|
||||
@@ -23,7 +23,10 @@
|
||||
|
||||
onMount(async () => {
|
||||
if (isCustomCollection) {
|
||||
const prefs = preferences.getCustomCollectionColumns($page.params.collection);
|
||||
const prefs = preferences.getCustomCollectionColumns(
|
||||
$page.params.project,
|
||||
$page.params.collection
|
||||
);
|
||||
columns.set(
|
||||
$columns.map((column) => {
|
||||
column.show = prefs?.includes(column.id) ?? true;
|
||||
@@ -31,7 +34,7 @@
|
||||
})
|
||||
);
|
||||
} else {
|
||||
const prefs = preferences.get($page.route);
|
||||
const prefs = preferences.get($page.params.project, $page.route);
|
||||
|
||||
// Override the shown columns only if a preference was set
|
||||
if (prefs?.columns) {
|
||||
@@ -48,9 +51,9 @@
|
||||
const columns = ctx.filter((n) => n.show).map((n) => n.id);
|
||||
|
||||
if (isCustomCollection) {
|
||||
preferences.setCustomCollectionColumns(columns);
|
||||
preferences.setCustomCollectionColumns($page.params.project, $page.route, columns);
|
||||
} else {
|
||||
preferences.setColumns(columns);
|
||||
preferences.setColumns($page.params.project, $page.route, columns);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -62,7 +65,7 @@
|
||||
}
|
||||
|
||||
function updateViewPreferences(view: View) {
|
||||
preferences.setView(view);
|
||||
preferences.setView($page.params.project, $page.route, view);
|
||||
}
|
||||
|
||||
$: selectedColumnsNumber = $columns.reduce((acc, column) => {
|
||||
|
||||
@@ -14,14 +14,10 @@
|
||||
|
||||
export function getFlag(country: string, width: number, height: number, quality: number) {
|
||||
if (!isValueOfStringEnum(Flag, country)) return '';
|
||||
let flag = sdk
|
||||
.forProject($page.params.region, $page.params.project)
|
||||
.avatars.getFlag(country, width * 2, height * 2, quality)
|
||||
?.toString();
|
||||
flag?.includes('&project=')
|
||||
? (flag = flag.replace('&project=', '&mode=admin'))
|
||||
: flag + '&mode=admin';
|
||||
return flag;
|
||||
|
||||
return sdk
|
||||
.forProject($page.params.region, 'console')
|
||||
.avatars.getFlag(country, width * 2, height * 2, quality);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
+13
-6
@@ -9,8 +9,15 @@ export function getPage(url: URL): number {
|
||||
return Number(url.searchParams.get('page'));
|
||||
}
|
||||
|
||||
export function getLimit(url: URL, route: Page['route'], fallback: number): number {
|
||||
return Number(url.searchParams.get('limit') ?? preferences.get(route).limit ?? fallback);
|
||||
export function getLimit(
|
||||
projectId: string,
|
||||
url: URL,
|
||||
route: Page['route'],
|
||||
fallback: number
|
||||
): number {
|
||||
return Number(
|
||||
url.searchParams.get('limit') ?? preferences.get(projectId, route).limit ?? fallback
|
||||
);
|
||||
}
|
||||
|
||||
export enum View {
|
||||
@@ -18,14 +25,14 @@ export enum View {
|
||||
Grid = 'grid'
|
||||
}
|
||||
|
||||
export function getView(url: URL, route: Page['route'], fallback: View): View {
|
||||
return (url.searchParams.get('view') ?? preferences.get(route).view) === View.Grid
|
||||
export function getView(projectId: string, url: URL, route: Page['route'], fallback: View): View {
|
||||
return (url.searchParams.get('view') ?? preferences.get(projectId, route).view) === View.Grid
|
||||
? View.Grid
|
||||
: (View.Table ?? fallback);
|
||||
}
|
||||
|
||||
export function getColumns(route: Page['route'], fallback: string[]): string[] {
|
||||
return preferences.get(route).columns ?? fallback;
|
||||
export function getColumns(projectId: string, route: Page['route'], fallback: string[]): string[] {
|
||||
return preferences.get(projectId, route).columns ?? fallback;
|
||||
}
|
||||
|
||||
export function getSearch(url: URL): string | undefined {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { browser } from '$app/environment';
|
||||
import { page } from '$app/stores';
|
||||
import type { View } from '$lib/helpers/load';
|
||||
import type { Page } from '@sveltejs/kit';
|
||||
import { get, writable } from 'svelte/store';
|
||||
@@ -48,81 +47,62 @@ function createPreferences() {
|
||||
subscribe,
|
||||
set,
|
||||
update,
|
||||
get: (route?: Page['route']): Preferences => {
|
||||
const $page = get(page);
|
||||
const projectId = $page.params.project;
|
||||
const routeId = route?.id ?? $page.route.id;
|
||||
get: (projectId: string, route: Page['route']): Preferences =>
|
||||
preferences[projectId]?.[route.id] ?? {
|
||||
limit: null,
|
||||
view: null,
|
||||
columns: null
|
||||
},
|
||||
|
||||
return (
|
||||
preferences[projectId]?.[routeId] ?? {
|
||||
limit: null,
|
||||
view: null,
|
||||
columns: null
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
getCustomCollectionColumns: (collectionId: string): Preferences['columns'] => {
|
||||
const $page = get(page);
|
||||
const projectId = $page.params.project;
|
||||
|
||||
return preferences[projectId]?.collections?.[collectionId] ?? null;
|
||||
},
|
||||
setLimit: (limit: Preferences['limit']) =>
|
||||
getCustomCollectionColumns: (
|
||||
projectId: string,
|
||||
collectionId: string
|
||||
): Preferences['columns'] => preferences[projectId]?.collections?.[collectionId] ?? null,
|
||||
setLimit: (projectId: string, route: Page['route'], limit: Preferences['limit']) =>
|
||||
update((n) => {
|
||||
const $page = get(page);
|
||||
const path = $page.route.id;
|
||||
const project = $page.params.project;
|
||||
|
||||
if (!n[project]?.[path]) {
|
||||
n[project] ??= {};
|
||||
n[project][path] ??= {};
|
||||
if (!n[projectId]?.[route.id]) {
|
||||
n[projectId] ??= {};
|
||||
n[projectId][route.id] ??= {};
|
||||
}
|
||||
|
||||
n[project][path].limit = limit;
|
||||
n[projectId][route.id].limit = limit;
|
||||
|
||||
return n;
|
||||
}),
|
||||
setView: (view: Preferences['view']) =>
|
||||
setView: (projectId: string, route: Page['route'], view: Preferences['view']) =>
|
||||
update((n) => {
|
||||
const $page = get(page);
|
||||
const path = $page.route.id;
|
||||
const project = $page.params.project;
|
||||
if (!n[project]?.[path]) {
|
||||
n[project] ??= {};
|
||||
n[project][path] ??= {};
|
||||
if (!n[projectId]?.[route.id]) {
|
||||
n[projectId] ??= {};
|
||||
n[projectId][route.id] ??= {};
|
||||
}
|
||||
|
||||
n[project][path].view = view;
|
||||
n[projectId][route.id].view = view;
|
||||
|
||||
return n;
|
||||
}),
|
||||
setColumns: (columns: Preferences['columns']) =>
|
||||
setColumns: (projectId: string, route: Page['route'], columns: Preferences['columns']) =>
|
||||
update((n) => {
|
||||
const $page = get(page);
|
||||
const path = $page.route.id;
|
||||
const project = $page.params.project;
|
||||
if (!n[project]?.[path]) {
|
||||
n[project] ??= {};
|
||||
n[project][path] ??= {};
|
||||
if (!n[projectId]?.[route.id]) {
|
||||
n[projectId] ??= {};
|
||||
n[projectId][route.id] ??= {};
|
||||
}
|
||||
|
||||
n[project][path].columns = columns;
|
||||
n[projectId][route.id].columns = columns;
|
||||
|
||||
return n;
|
||||
}),
|
||||
setCustomCollectionColumns: (columns: Preferences['columns']) =>
|
||||
setCustomCollectionColumns: (
|
||||
projectId: string,
|
||||
route: Page['route'],
|
||||
columns: Preferences['columns']
|
||||
) =>
|
||||
update((n) => {
|
||||
const $page = get(page);
|
||||
const project = $page.params.project;
|
||||
const collection = $page.params.collection;
|
||||
|
||||
if (!n[project]?.collections?.[collection]) {
|
||||
n[project] ??= {};
|
||||
n[project].collections ??= {};
|
||||
if (!n[projectId]?.collections?.[route.id]) {
|
||||
n[projectId] ??= {};
|
||||
n[projectId].collections ??= {};
|
||||
}
|
||||
|
||||
n[project].collections[collection] = columns;
|
||||
n[projectId].collections[route.id] = columns;
|
||||
|
||||
return n;
|
||||
}),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Client, type Models, Storage } from '@appwrite.io/console';
|
||||
import { writable } from 'svelte/store';
|
||||
import { getProjectId } from '$lib/helpers/project';
|
||||
import { getApiEndpoint } from '$lib/stores/sdk';
|
||||
|
||||
type UploaderFile = {
|
||||
@@ -18,11 +17,10 @@ export type Uploader = {
|
||||
files: UploaderFile[];
|
||||
};
|
||||
|
||||
const temporaryStorage = () => {
|
||||
const clientProject = new Client()
|
||||
.setEndpoint(getApiEndpoint())
|
||||
.setMode('admin')
|
||||
.setProject(getProjectId());
|
||||
const temporaryStorage = (region: string, projectId: string) => {
|
||||
const clientProject = new Client().setMode('admin');
|
||||
const endpoint = getApiEndpoint(region);
|
||||
clientProject.setEndpoint(endpoint).setProject(projectId);
|
||||
|
||||
return new Storage(clientProject);
|
||||
};
|
||||
@@ -66,7 +64,14 @@ const createUploader = () => {
|
||||
isCollapsed: false,
|
||||
files: []
|
||||
}),
|
||||
uploadFile: async (bucketId: string, id: string, file: File, permissions: string[]) => {
|
||||
uploadFile: async (
|
||||
region: string,
|
||||
projectId: string,
|
||||
bucketId: string,
|
||||
id: string,
|
||||
file: File,
|
||||
permissions: string[]
|
||||
) => {
|
||||
const newFile: UploaderFile = {
|
||||
$id: id,
|
||||
bucketId: bucketId,
|
||||
@@ -81,7 +86,7 @@ const createUploader = () => {
|
||||
n.files.unshift(newFile);
|
||||
return n;
|
||||
});
|
||||
const uploadedFile = await temporaryStorage().createFile(
|
||||
const uploadedFile = await temporaryStorage(region, projectId).createFile(
|
||||
bucketId,
|
||||
id ?? 'unique()',
|
||||
file,
|
||||
|
||||
@@ -3,7 +3,6 @@ import { wizard } from '$lib/stores/wizard';
|
||||
import { requestedMigration } from '$routes/store';
|
||||
import { get, writable } from 'svelte/store';
|
||||
import Wizard from './wizard.svelte';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
|
||||
export const formData = createMigrationFormStore();
|
||||
|
||||
|
||||
@@ -272,9 +272,9 @@
|
||||
}
|
||||
|
||||
database.subscribe(async (database) => {
|
||||
if (!database) return;
|
||||
if (!database || !$page.params.region || !$page.params.project) return;
|
||||
// the component checks `isCloud` internally.
|
||||
await checkForDatabaseBackupPolicies(database);
|
||||
await checkForDatabaseBackupPolicies($page.params.region, $page.params.project, database);
|
||||
});
|
||||
|
||||
let currentOrganizationId = null;
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit('console', url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, CARD_LIMIT);
|
||||
const limit = getLimit('console', url, route, CARD_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
@@ -29,9 +29,8 @@
|
||||
function getBrowser(clientCode: string) {
|
||||
const code = clientCode.toLowerCase();
|
||||
if (!isValueOfStringEnum(Browser, code)) return '';
|
||||
return sdk
|
||||
.forProject($page.params.region, $page.params.project)
|
||||
.avatars.getBrowser(code, 40, 40);
|
||||
|
||||
return sdk.forConsole.avatars.getBrowser(code, 40, 40);
|
||||
}
|
||||
|
||||
function logoutSessionId(sessionId: string) {
|
||||
|
||||
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, url, route, depends, parent }) =>
|
||||
const { scopes } = await parent();
|
||||
depends(Dependencies.ORGANIZATION);
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, CARD_LIMIT);
|
||||
const limit = getLimit('console', url, route, CARD_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
if (!scopes.includes('projects.read') && scopes.includes('billing.read')) {
|
||||
return redirect(301, `/console/organization-${params.organization}/billing`);
|
||||
|
||||
@@ -8,7 +8,7 @@ export const load: PageLoad = async ({ url, params, route, depends }) => {
|
||||
depends(Dependencies.ORGANIZATION);
|
||||
depends(Dependencies.MEMBERS);
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit('console', url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
+2
-2
@@ -71,8 +71,8 @@
|
||||
<TableCell title="Usage">{format(project.usage)}</TableCell>
|
||||
</TableRow>
|
||||
{:else}
|
||||
<TableRowLink
|
||||
href={getProjectUsageLink(project.region ?? 'fra1', project.projectId)}>
|
||||
<!-- TODO: hardcoded region -->
|
||||
<TableRowLink href={getProjectUsageLink('fra1', project.projectId)}>
|
||||
<TableCell title="Project">
|
||||
{data.projectNames[project.projectId]?.name ?? 'Unknown'}
|
||||
</TableCell>
|
||||
|
||||
@@ -8,7 +8,7 @@ import { showCreateUser } from './+page.svelte';
|
||||
export const load: PageLoad = async ({ url, route, params }) => {
|
||||
const page = getPage(url);
|
||||
const search = getSearch(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
if (typeof url.searchParams.get('create') === 'string') {
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { PageLoad } from './$types';
|
||||
export const load: PageLoad = async ({ url, route, params }) => {
|
||||
const page = getPage(url);
|
||||
const search = getSearch(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, depends, url, route }) => {
|
||||
const teamId = params.team;
|
||||
const page = getPage(url);
|
||||
const search = getSearch(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
return {
|
||||
offset,
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, url, route, depends }) => {
|
||||
depends(Dependencies.USER_IDENTITIES);
|
||||
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const query = getQuery(url);
|
||||
const search = getSearch(url);
|
||||
|
||||
+2
-4
@@ -18,7 +18,6 @@
|
||||
import DeleteAllSessions from '../deleteAllSessions.svelte';
|
||||
import DeleteSessions from '../deleteSession.svelte';
|
||||
import type { PageData } from './$types';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -29,9 +28,8 @@
|
||||
function getBrowser(clientCode: string) {
|
||||
const code = clientCode.toLowerCase();
|
||||
if (!isValueOfStringEnum(Browser, code)) return '';
|
||||
return sdk
|
||||
.forProject($page.params.region, $page.params.project)
|
||||
.avatars.getBrowser(code, 40, 40);
|
||||
|
||||
return sdk.forConsole.avatars.getBrowser(code, 40, 40);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, url, route, depends }) => {
|
||||
depends(Dependencies.USER_TARGETS);
|
||||
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const query = getQuery(url);
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ export const load: PageLoad = async ({ url, route, depends, params }) => {
|
||||
depends(Dependencies.DATABASES);
|
||||
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, CARD_LIMIT);
|
||||
const view = getView(url, route, View.Grid);
|
||||
const limit = getLimit(params.project, url, route, CARD_LIMIT);
|
||||
const view = getView(params.project, url, route, View.Grid);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
const { databases, policies, lastBackups } = await fetchDatabasesAndBackups(
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ import { CARD_LIMIT, Dependencies } from '$lib/constants';
|
||||
export const load: PageLoad = async ({ params, url, route, depends }) => {
|
||||
depends(Dependencies.COLLECTIONS);
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, CARD_LIMIT);
|
||||
const view = getView(url, route, View.Grid);
|
||||
const limit = getLimit(params.project, url, route, CARD_LIMIT);
|
||||
const view = getView(params.project, url, route, View.Grid);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const collections = await sdk
|
||||
.forProject(params.region, params.project)
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ import type { BackupArchive, BackupArchiveList, BackupPolicyList } from '$lib/sd
|
||||
export const load = async ({ params, url, route, depends }) => {
|
||||
depends(Dependencies.BACKUPS);
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, CARD_LIMIT);
|
||||
const view = getView(url, route, View.Grid);
|
||||
const limit = getLimit(params.project, url, route, CARD_LIMIT);
|
||||
const view = getView(params.project, url, route, View.Grid);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
let backups: BackupArchiveList = { total: 0, archives: [] };
|
||||
|
||||
+4
-1
@@ -23,7 +23,10 @@
|
||||
let showCreateDropdown = false;
|
||||
let selectedAttribute: Option['name'] = null;
|
||||
|
||||
$: selected = preferences.getCustomCollectionColumns($page.params.collection);
|
||||
$: selected = preferences.getCustomCollectionColumns(
|
||||
$page.params.project,
|
||||
$page.params.collection
|
||||
);
|
||||
$: columns.set(
|
||||
$collection.attributes.map((attribute) => ({
|
||||
id: attribute.key,
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ import { queries, queryParamToMap } from '$lib/components/filters';
|
||||
export const load: PageLoad = async ({ params, depends, url, route }) => {
|
||||
depends(Dependencies.DOCUMENTS);
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const view = getView(url, route, View.Grid);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const view = getView(params.project, url, route, View.Grid);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const query = getQuery(url);
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
+9
-2
@@ -28,9 +28,16 @@
|
||||
try {
|
||||
await $option.create(databaseId, collectionId, key, data);
|
||||
|
||||
let selectedColumns = preferences.getCustomCollectionColumns(collectionId);
|
||||
let selectedColumns = preferences.getCustomCollectionColumns(
|
||||
$page.params.project,
|
||||
collectionId
|
||||
);
|
||||
selectedColumns.push(key ?? data?.key);
|
||||
preferences.setCustomCollectionColumns(selectedColumns);
|
||||
preferences.setCustomCollectionColumns(
|
||||
$page.params.project,
|
||||
$page.route,
|
||||
selectedColumns
|
||||
);
|
||||
await invalidate(Dependencies.COLLECTION);
|
||||
if (!$page.url.pathname.includes('attributes')) {
|
||||
await goto(
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
+4
-1
@@ -99,7 +99,10 @@
|
||||
};
|
||||
}
|
||||
|
||||
$: selected = preferences.getCustomCollectionColumns($page.params.collection);
|
||||
$: selected = preferences.getCustomCollectionColumns(
|
||||
$page.params.project,
|
||||
$page.params.collection
|
||||
);
|
||||
|
||||
$: {
|
||||
columns.set(
|
||||
|
||||
@@ -4,11 +4,11 @@ import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
|
||||
import { CARD_LIMIT, Dependencies } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ url, depends, route }) => {
|
||||
export const load: PageLoad = async ({ url, depends, route, params }) => {
|
||||
depends(Dependencies.FUNCTIONS);
|
||||
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, CARD_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, CARD_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, depends, url, route, parent }) =>
|
||||
const data = await parent();
|
||||
depends(Dependencies.DEPLOYMENTS);
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const query = getQuery(url);
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { queries, queryParamToMap } from '$lib/components/filters';
|
||||
export const load: PageLoad = async ({ params, depends, url, route }) => {
|
||||
depends(Dependencies.EXECUTIONS);
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const query = getQuery(url);
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ import { getPage, getSearch, getView, pageToOffset, View } from '$lib/helpers/lo
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ url, route, depends, parent }) => {
|
||||
export const load: PageLoad = async ({ url, route, depends, parent, params }) => {
|
||||
depends(Dependencies.FUNCTIONS);
|
||||
|
||||
const limit = CARD_LIMIT;
|
||||
const page = getPage(url);
|
||||
const search = getSearch(url);
|
||||
const view = getView(url, route, View.Grid);
|
||||
const view = getView(params.project, url, route, View.Grid);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const filter = {
|
||||
useCases: url.searchParams.getAll('useCase'),
|
||||
|
||||
@@ -13,13 +13,13 @@ import { sdk } from '$lib/stores/sdk';
|
||||
import { Query, type Models } from '@appwrite.io/console';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ depends, url, route }) => {
|
||||
export const load: PageLoad = async ({ depends, url, route, params }) => {
|
||||
depends(Dependencies.MESSAGING_MESSAGES);
|
||||
|
||||
const page = getPage(url);
|
||||
const search = getSearch(url);
|
||||
const view = getView(url, route, View.Grid);
|
||||
const limit = getLimit(url, route, CARD_LIMIT);
|
||||
const view = getView(params.project, url, route, View.Grid);
|
||||
const limit = getLimit(params.project, url, route, CARD_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const query = getQuery(url);
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ import { Dependencies, PAGE_LIMIT } from '$lib/constants';
|
||||
import { queries, queryParamToMap } from '$lib/components/filters';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ depends, url, route }) => {
|
||||
export const load: PageLoad = async ({ depends, url, route, params }) => {
|
||||
depends(Dependencies.MESSAGING_PROVIDERS);
|
||||
|
||||
const page = getPage(url);
|
||||
const search = getSearch(url);
|
||||
const view = getView(url, route, View.Grid);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const view = getView(params.project, url, route, View.Grid);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const query = getQuery(url);
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ import { Dependencies, PAGE_LIMIT } from '$lib/constants';
|
||||
import { queryParamToMap, queries } from '$lib/components/filters';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ depends, url, route }) => {
|
||||
export const load: PageLoad = async ({ depends, url, route, params }) => {
|
||||
depends(Dependencies.MESSAGING_TOPICS);
|
||||
const page = getPage(url);
|
||||
const search = getSearch(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const query = getQuery(url);
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, url, route, depends }) => {
|
||||
depends(Dependencies.MESSAGING_TOPIC_SUBSCRIBERS);
|
||||
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const search = getSearch(url);
|
||||
const query = getQuery(url);
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
+5
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
|
||||
import { page } from '$app/stores';
|
||||
import ResourceForm from '$routes/(console)/(migration-wizard)/resource-form.svelte';
|
||||
import { formData, provider } from '.';
|
||||
</script>
|
||||
@@ -18,5 +18,8 @@
|
||||
Learn about which resources are supported</a
|
||||
>.
|
||||
</svelte:fragment>
|
||||
<ResourceForm {formData} {provider} projectSdk={sdk.forProject} />
|
||||
<ResourceForm
|
||||
{formData}
|
||||
{provider}
|
||||
projectSdk={sdk.forProject($page.params.region, $page.params.project)} />
|
||||
</WizardStep>
|
||||
@@ -7,7 +7,7 @@ export const load: PageLoad = async ({ params, url, route, depends }) => {
|
||||
depends(Dependencies.WEBHOOKS);
|
||||
|
||||
const page = getPage(url);
|
||||
const view = getView(url, route, View.Grid);
|
||||
const view = getView(params.project, url, route, View.Grid);
|
||||
|
||||
return {
|
||||
page,
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ url, route, params }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, CARD_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, CARD_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
|
||||
@@ -10,7 +10,7 @@ export const load: PageLoad = async ({ params, depends, url, route, parent }) =>
|
||||
depends(Dependencies.FILES);
|
||||
const page = getPage(url);
|
||||
const search = getSearch(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
const [files, organizationUsage] = await Promise.all([
|
||||
|
||||
+2
@@ -32,6 +32,8 @@
|
||||
|
||||
try {
|
||||
const uploadPromise = uploader.uploadFile(
|
||||
$page.params.region,
|
||||
$page.params.project,
|
||||
bucketId,
|
||||
fileId,
|
||||
$createFile.files[0],
|
||||
|
||||
Reference in new issue
Block a user