Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lib/commandCenter/searchers/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ 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';
import { Platform, Query } from '@appwrite.io/console';

export const orgSearcher = (async (query: string) => {
const { teams } = !isCloud
? await sdk.forConsole.teams.list()
: await sdk.forConsole.billing.listOrganization([Query.equal('platform', 'appwrite')]);
: await sdk.forConsole.billing.listOrganization([
Query.equal('platform', Platform.Appwrite)
]);

return teams
.filter((organization) => organization.name.toLowerCase().includes(query.toLowerCase()))
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(console)/account/organizations/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const load: PageLoad = async ({ url, route }) => {
Query.offset(offset),
Query.limit(limit),
Query.orderDesc(''),
Query.equal('platform', Platform.Appwrite)
...(isCloud ? [Query.equal('platform', Platform.Appwrite)] : [])
];

const organizations = !isCloud
Expand Down
2 changes: 2 additions & 0 deletions src/routes/(console)/organization-[organization]/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ async function checkPlatformAndRedirect(
}
}

if (!isCloud) return requestedOrg;

if (requestedOrg && requestedOrg.platform !== Platform.Appwrite) {
const orgIdInPrefs = prefs.organization;

Expand Down
2 changes: 1 addition & 1 deletion src/routes/(console)/project-[region]-[project]/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const load: LayoutLoad = async ({ params, depends, parent }) => {

// not the right organization project based on platform,
// redirect to organization, and it should handle the rest!
if (organization.platform !== Platform.Appwrite) {
if (isCloud && organization.platform !== Platform.Appwrite) {
redirect(
303,
resolve('/(console)/organization-[organization]', {
Expand Down