mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Fix repeated cloud scopes and deprecated badge copy
This commit is contained in:
@@ -56,15 +56,34 @@
|
||||
}
|
||||
|
||||
const filteredScopes = $derived.by(() => {
|
||||
const scopesById = new Map(allScopesList.map((scope) => [scope.scope, scope]));
|
||||
|
||||
const databasesWriteIndex = allScopesList.findIndex((s) => s.scope === 'databases.write');
|
||||
if (isCloud && databasesWriteIndex !== -1) {
|
||||
const normalizedBackupScopes = cloudOnlyBackupScopes.map((scope) => ({
|
||||
...scope,
|
||||
category: normalizeCategory(scope.category)
|
||||
}));
|
||||
const backupScopeIds = new Set(normalizedBackupScopes.map((scope) => scope.scope));
|
||||
|
||||
for (const scope of normalizedBackupScopes) {
|
||||
if (!scopesById.has(scope.scope)) {
|
||||
scopesById.set(scope.scope, scope);
|
||||
}
|
||||
}
|
||||
|
||||
const mergedScopes = Array.from(scopesById.values());
|
||||
const nonBackupScopes = mergedScopes.filter(
|
||||
(scope) => !backupScopeIds.has(scope.scope)
|
||||
);
|
||||
const mergedDatabasesWriteIndex = nonBackupScopes.findIndex(
|
||||
(s) => s.scope === 'databases.write'
|
||||
);
|
||||
|
||||
return [
|
||||
...allScopesList.slice(0, databasesWriteIndex + 1),
|
||||
...cloudOnlyBackupScopes.map((scope) => ({
|
||||
...scope,
|
||||
category: normalizeCategory(scope.category)
|
||||
})),
|
||||
...allScopesList.slice(databasesWriteIndex + 1)
|
||||
...nonBackupScopes.slice(0, mergedDatabasesWriteIndex + 1),
|
||||
...normalizedBackupScopes.map((scope) => scopesById.get(scope.scope) ?? scope),
|
||||
...nonBackupScopes.slice(mergedDatabasesWriteIndex + 1)
|
||||
];
|
||||
}
|
||||
return allScopesList;
|
||||
@@ -76,12 +95,7 @@
|
||||
);
|
||||
});
|
||||
|
||||
const scopeCatalog = $derived(
|
||||
new Set([
|
||||
...filteredScopes.map((s) => s.scope),
|
||||
...(isCloud ? cloudOnlyBackupScopes.map((s) => s.scope) : [])
|
||||
])
|
||||
);
|
||||
const scopeCatalog = $derived(new Set(filteredScopes.map((s) => s.scope)));
|
||||
|
||||
let activeScopes: Record<string, boolean> = $state({});
|
||||
|
||||
@@ -206,11 +220,11 @@
|
||||
on:change={(event) => onCategoryChange(event, category)}>
|
||||
<Layout.Stack>
|
||||
{#each filteredScopes.filter((s) => s.category === category) as scope}
|
||||
<Layout.Stack direction="row" alignItems="center" gap="s">
|
||||
<Layout.Stack inline direction="row" alignItems="center" gap="xxs">
|
||||
<Selector.Checkbox
|
||||
size="s"
|
||||
id={scope.scope}
|
||||
label={`${scope.scope}${scope.deprecated ? ' (Deprecated)' : ''}`}
|
||||
label={scope.scope}
|
||||
description={scope.description}
|
||||
bind:checked={activeScopes[scope.scope]} />
|
||||
{#if scope.deprecated}
|
||||
|
||||
Reference in New Issue
Block a user