Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
<script lang="ts" module>
const compatPairs = [
{ newer: 'tables.', legacy: 'collections.' },
{ newer: 'columns.', legacy: 'attributes.' },
{ newer: 'rows.', legacy: 'documents.' },
{ newer: 'executions.', legacy: 'execution.' }
] as const;

export function getEffectiveScopes(scopes: string[]): string[] {
const effectiveScopes = new Set<string>();

for (const scope of scopes) {
let effectiveScope = scope;

for (const pair of compatPairs) {
if (scope.startsWith(pair.legacy)) {
effectiveScope = scope.replace(pair.legacy, pair.newer);
break;
}
}

effectiveScopes.add(effectiveScope);
}

return Array.from(effectiveScopes);
}
</script>

<script lang="ts">
import { onMount } from 'svelte';
import { isCloud } from '$lib/system';
Expand Down Expand Up @@ -53,7 +25,6 @@
let allScopesList: ScopeDefinition[] = $state([]);
let mounted = $state(false);
let loadError: string | null = $state(null);
const effectiveScopes = $derived(getEffectiveScopes(scopes));

const categoryAliasMap: Record<string, string> = {
Database: 'Databases'
Expand Down Expand Up @@ -142,8 +113,9 @@

allScopesList = Array.from(scopesById.values());

const selectedScopes = new Set<string>(scopes);
for (const s of filteredScopes) {
activeScopes[s.scope] = effectiveScopes.includes(s.scope);
activeScopes[s.scope] = selectedScopes.has(s.scope);
}
mounted = true;
} catch (e) {
Expand All @@ -168,7 +140,7 @@

function categoryState(category: string, s: string[]): boolean | 'indeterminate' {
const scopesByCategory = filteredScopes.filter((n) => n.category === category);
const scopeSet = new Set(getEffectiveScopes(s));
const scopeSet = new Set(s);
const activeInCategory = scopesByCategory.filter((scopeItem) =>
scopeSet.has(scopeItem.scope)
);
Expand Down