mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
improve tab filters
This commit is contained in:
@@ -36,7 +36,7 @@ export function getQuery(url: URL): string | undefined {
|
||||
return url.searchParams.get('query') ?? undefined;
|
||||
}
|
||||
|
||||
export type TabElement = { href: string; title: string; event: string; hasChildren?: boolean };
|
||||
export type TabElement = { href: string; title: string; event: string; hasChildren?: boolean, disabled?: boolean };
|
||||
|
||||
export function isTabSelected(
|
||||
tab: TabElement,
|
||||
|
||||
@@ -63,58 +63,42 @@
|
||||
$: avatars = $members.memberships?.map((m) => m.userName) ?? [];
|
||||
$: organizationId = $page.params.organization;
|
||||
$: path = `${base}/organization-${organizationId}`;
|
||||
$: settingsTab = [
|
||||
$: tabs = [
|
||||
|
||||
{
|
||||
href: `${path}/settings`,
|
||||
event: 'settings',
|
||||
title: 'Settings'
|
||||
}
|
||||
];
|
||||
$: permanentTabs = [
|
||||
...($canSeeProjects
|
||||
? [
|
||||
{
|
||||
href: path,
|
||||
title: 'Projects',
|
||||
event: 'projects',
|
||||
hasChildren: true
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...($isOwner
|
||||
? [
|
||||
{
|
||||
href: `${path}/members`,
|
||||
title: 'Members',
|
||||
event: 'members',
|
||||
hasChildren: true
|
||||
}
|
||||
]
|
||||
: [])
|
||||
];
|
||||
$: tabs = [
|
||||
...permanentTabs,
|
||||
...(isCloud && $isOwner
|
||||
? [
|
||||
{
|
||||
href: `${path}/usage`,
|
||||
event: 'usage',
|
||||
title: 'Usage',
|
||||
hasChildren: true
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...(isCloud && $canSeeBilling
|
||||
? [
|
||||
{
|
||||
href: `${path}/billing`,
|
||||
event: 'billing',
|
||||
title: 'Billing'
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...($isOwner ? settingsTab : [])
|
||||
];
|
||||
title: 'Settings',
|
||||
disabled: !$isOwner
|
||||
},
|
||||
{
|
||||
href: path,
|
||||
title: 'Projects',
|
||||
event: 'projects',
|
||||
hasChildren: true,
|
||||
disabled: !$canSeeProjects
|
||||
},
|
||||
{
|
||||
href: `${path}/members`,
|
||||
title: 'Members',
|
||||
event: 'members',
|
||||
hasChildren: true,
|
||||
disabled: !$isOwner
|
||||
},
|
||||
{
|
||||
href: `${path}/usage`,
|
||||
event: 'usage',
|
||||
title: 'Usage',
|
||||
hasChildren: true,
|
||||
disabled: !(isCloud && $isOwner)
|
||||
},
|
||||
{
|
||||
href: `${path}/billing`,
|
||||
event: 'billing',
|
||||
title: 'Billing',
|
||||
disabled: !(isCloud && $canSeeBilling)
|
||||
},
|
||||
].filter((tab) => !tab.disabled);;
|
||||
</script>
|
||||
|
||||
{#if $organization?.$id}
|
||||
|
||||
+7
-10
@@ -21,16 +21,13 @@
|
||||
title: 'Activity',
|
||||
event: 'activity'
|
||||
},
|
||||
...($canWriteTopics
|
||||
? [
|
||||
{
|
||||
href: `${path}/settings`,
|
||||
title: 'Settings',
|
||||
event: 'settings'
|
||||
}
|
||||
]
|
||||
: [])
|
||||
];
|
||||
{
|
||||
href: `${path}/settings`,
|
||||
title: 'Settings',
|
||||
event: 'settings',
|
||||
disabled: !$canWriteTopics
|
||||
}
|
||||
].filter((tab) => !tab.disabled);
|
||||
</script>
|
||||
|
||||
<Cover>
|
||||
|
||||
@@ -26,30 +26,26 @@
|
||||
title: 'Webhooks',
|
||||
event: 'webhooks'
|
||||
},
|
||||
...($canWriteProjects
|
||||
? [
|
||||
{
|
||||
href: `${path}/migrations`,
|
||||
title: 'Migrations',
|
||||
event: 'migrations'
|
||||
},
|
||||
{
|
||||
href: `${path}/smtp`,
|
||||
title: 'SMTP',
|
||||
event: 'smtp'
|
||||
}
|
||||
]
|
||||
: [])
|
||||
];
|
||||
|
||||
if (isCloud) {
|
||||
tabs.push({
|
||||
{
|
||||
href: `${path}/migrations`,
|
||||
title: 'Migrations',
|
||||
event: 'migrations',
|
||||
disabled: !$canWriteProjects
|
||||
},
|
||||
{
|
||||
href: `${path}/smtp`,
|
||||
title: 'SMTP',
|
||||
event: 'smtp',
|
||||
disabled: !$canWriteProjects
|
||||
},
|
||||
{
|
||||
href: `${path}/usage`,
|
||||
title: 'Usage',
|
||||
event: 'usage',
|
||||
hasChildren: true
|
||||
});
|
||||
}
|
||||
hasChildren: true,
|
||||
disabled: !isCloud
|
||||
}
|
||||
].filter((tab) => !tab.disabled);;
|
||||
</script>
|
||||
|
||||
<Cover>
|
||||
|
||||
@@ -23,16 +23,13 @@
|
||||
event: 'usage',
|
||||
hasChildren: true
|
||||
},
|
||||
...($canWriteBuckets
|
||||
? [
|
||||
{
|
||||
href: `${path}/settings`,
|
||||
event: 'settings',
|
||||
title: 'Settings'
|
||||
}
|
||||
]
|
||||
: [])
|
||||
];
|
||||
{
|
||||
href: `${path}/settings`,
|
||||
event: 'settings',
|
||||
title: 'Settings',
|
||||
disabled: !$canWriteBuckets
|
||||
}
|
||||
].filter((tab) => !tab.disabled);
|
||||
</script>
|
||||
|
||||
<Cover>
|
||||
|
||||
Reference in New Issue
Block a user