mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
add: platform filter.
This commit is contained in:
@@ -3,11 +3,12 @@ import { base } from '$app/paths';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import type { Searcher } from '../commands';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { Query } from '@appwrite.io/console';
|
||||
|
||||
export const orgSearcher = (async (query: string) => {
|
||||
const { teams } = !isCloud
|
||||
? await sdk.forConsole.teams.list()
|
||||
: await sdk.forConsole.billing.listOrganization();
|
||||
: await sdk.forConsole.billing.listOrganization([Query.equal('platform', 'appwrite')]);
|
||||
|
||||
return teams
|
||||
.filter((organization) => organization.name.toLowerCase().includes(query.toLowerCase()))
|
||||
|
||||
@@ -557,7 +557,8 @@ export async function checkForMissingPaymentMethod() {
|
||||
const orgs = await sdk.forConsole.billing.listOrganization([
|
||||
Query.notEqual('billingPlan', BillingPlan.FREE),
|
||||
Query.isNull('paymentMethodId'),
|
||||
Query.isNull('backupPaymentMethodId')
|
||||
Query.isNull('backupPaymentMethodId'),
|
||||
Query.equal('platform', 'appwrite')
|
||||
]);
|
||||
if (orgs?.total) {
|
||||
orgMissingPaymentMethod.set(orgs.teams[0]);
|
||||
|
||||
@@ -10,7 +10,12 @@ export const load: PageLoad = async ({ url, route }) => {
|
||||
const limit = getLimit(url, route, CARD_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
const queries = [Query.offset(offset), Query.limit(limit), Query.orderDesc('')];
|
||||
const queries = [
|
||||
Query.offset(offset),
|
||||
Query.limit(limit),
|
||||
Query.orderDesc(''),
|
||||
Query.equal('platform', 'appwrite')
|
||||
];
|
||||
|
||||
const organizations = !isCloud
|
||||
? await sdk.forConsole.teams.list({ queries })
|
||||
|
||||
+2
-1
@@ -1,13 +1,14 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { Query } from '@appwrite.io/console';
|
||||
|
||||
export const load = async ({ parent, depends }) => {
|
||||
depends(Dependencies.DOMAINS);
|
||||
|
||||
const organizations = !isCloud
|
||||
? await sdk.forConsole.teams.list()
|
||||
: await sdk.forConsole.billing.listOrganization();
|
||||
: await sdk.forConsole.billing.listOrganization([Query.equal('platform', 'appwrite')]);
|
||||
|
||||
const { domain } = await parent();
|
||||
return {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { redirect } from '@sveltejs/kit';
|
||||
import { base } from '$app/paths';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { ID, type Models } from '@appwrite.io/console';
|
||||
import { ID, type Models, Query } from '@appwrite.io/console';
|
||||
import type { OrganizationList } from '$lib/stores/organization';
|
||||
import { redirectTo } from '$routes/store';
|
||||
import type { PageLoad } from './$types';
|
||||
@@ -66,7 +66,9 @@ export const load: PageLoad = async ({ parent, url }) => {
|
||||
// Get organizations
|
||||
let organizations: Models.TeamList<Record<string, unknown>> | OrganizationList | undefined;
|
||||
if (isCloud) {
|
||||
organizations = await sdk.forConsole.billing.listOrganization();
|
||||
organizations = await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', 'appwrite')
|
||||
]);
|
||||
} else {
|
||||
organizations = await sdk.forConsole.teams.list();
|
||||
}
|
||||
@@ -88,7 +90,9 @@ export const load: PageLoad = async ({ parent, url }) => {
|
||||
}
|
||||
|
||||
if (isCloud) {
|
||||
organizations = await sdk.forConsole.billing.listOrganization();
|
||||
organizations = await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', 'appwrite')
|
||||
]);
|
||||
} else {
|
||||
organizations = await sdk.forConsole.teams.list();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { redirect, error } from '@sveltejs/kit';
|
||||
import { base } from '$app/paths';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { ID, type Models } from '@appwrite.io/console';
|
||||
import { ID, type Models, Query } from '@appwrite.io/console';
|
||||
import type { OrganizationList } from '$lib/stores/organization';
|
||||
import { redirectTo } from '$routes/store';
|
||||
import type { PageLoad } from './$types';
|
||||
@@ -83,7 +83,9 @@ export const load: PageLoad = async ({ parent, url }) => {
|
||||
let organizations: Models.TeamList<Record<string, unknown>> | OrganizationList | undefined;
|
||||
|
||||
if (isCloud) {
|
||||
organizations = await sdk.forConsole.billing.listOrganization();
|
||||
organizations = await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', 'appwrite')
|
||||
]);
|
||||
} else {
|
||||
organizations = await sdk.forConsole.teams.list();
|
||||
}
|
||||
@@ -106,7 +108,9 @@ export const load: PageLoad = async ({ parent, url }) => {
|
||||
|
||||
// Refetch organizations after creation
|
||||
if (isCloud) {
|
||||
organizations = await sdk.forConsole.billing.listOrganization();
|
||||
organizations = await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', 'appwrite')
|
||||
]);
|
||||
} else {
|
||||
organizations = await sdk.forConsole.teams.list();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BillingPlan } from '$lib/constants.js';
|
||||
import { sdk } from '$lib/stores/sdk.js';
|
||||
import { ID, type Models } from '@appwrite.io/console';
|
||||
import { ID, type Models, Query } from '@appwrite.io/console';
|
||||
import { isCloud } from '$lib/system.js';
|
||||
import { error, redirect } from '@sveltejs/kit';
|
||||
import type { OrganizationList } from '$lib/stores/organization.js';
|
||||
@@ -39,7 +39,9 @@ export const load = async ({ parent, url, params }) => {
|
||||
|
||||
let organizations: Models.TeamList<Record<string, unknown>> | OrganizationList | undefined;
|
||||
if (isCloud) {
|
||||
organizations = account?.$id ? await sdk.forConsole.billing.listOrganization() : undefined;
|
||||
organizations = account?.$id
|
||||
? await sdk.forConsole.billing.listOrganization([Query.equal('platform', 'appwrite')])
|
||||
: undefined;
|
||||
} else {
|
||||
organizations = account?.$id ? await sdk.forConsole.teams.list() : undefined;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { LayoutLoad } from './$types';
|
||||
import { redirectTo } from './store';
|
||||
import { base, resolve } from '$app/paths';
|
||||
import type { Account } from '$lib/stores/user';
|
||||
import type { AppwriteException } from '@appwrite.io/console';
|
||||
import { type AppwriteException, Query } from '@appwrite.io/console';
|
||||
import { isCloud, VARS } from '$lib/system';
|
||||
import { checkPricingRefAndRedirect } from '$lib/helpers/pricingRedirect';
|
||||
|
||||
@@ -42,7 +42,9 @@ export const load: LayoutLoad = async ({ depends, url, route }) => {
|
||||
account: account,
|
||||
organizations: !isCloud
|
||||
? await sdk.forConsole.teams.list()
|
||||
: await sdk.forConsole.billing.listOrganization()
|
||||
: await sdk.forConsole.billing.listOrganization([
|
||||
Query.equal('platform', 'appwrite')
|
||||
])
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user