Skip to content

Commit

Permalink
Fold all resources in the sidebar
Browse files Browse the repository at this point in the history
Signed-off-by: popcorny <[email protected]>
  • Loading branch information
popcornylu committed Sep 5, 2023
1 parent c68863b commit cfe1a6d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
7 changes: 5 additions & 2 deletions static_report/src/components/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ export function SideBar({ singleOnly }: Comparable) {

// make sure the tree is expanded for the current path
useEffect(() => {
if (location !== '/ssr' && tabIndex < 0) {
if (location !== '/ssr') {
expandTreeForPath(location);
setTabIndex(0);

if (tabIndex < 0) {
setTabIndex(0);
}
}
}, [location, tabIndex, expandTreeForPath]);

Expand Down
18 changes: 9 additions & 9 deletions static_report/src/utils/dbt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export function buildSourceTree(
type: 'folder',
name: sourceName,
items: [],
expanded: true,
expanded: false,
};
}

Expand Down Expand Up @@ -361,7 +361,7 @@ export function buildModelOrSeedTree(
type: 'folder',
name: dir,
items: {},
expanded: true,
expanded: false,
};
}
curDir = curDir[dir].items;
Expand Down Expand Up @@ -424,7 +424,7 @@ export function buildMetricTree(
type: 'folder',
name: packageName,
items: [],
expanded: true,
expanded: false,
};
}

Expand Down Expand Up @@ -497,26 +497,26 @@ export function buildProjectTree(
name: 'Sources',
type: 'folder',
items: buildSourceTree(itemsNodeComparison),
expanded: true,
expanded: false,
};
const seed: SidebarTreeItem = {
name: 'Seeds',
type: 'folder',
items: buildModelOrSeedTree(itemsNodeComparison, 'seed'),
expanded: true,
expanded: false,
};
const model: SidebarTreeItem = {
name: 'Models',
type: 'folder',
items: buildModelOrSeedTree(itemsNodeComparison, 'model'),
expanded: true,
expanded: false,
};
const table: SidebarTreeItem = {
name: 'Tables',
type: 'folder',
path: `/tables`,
items: buildLegacyTablesTree(itemsNodeComparison),
expanded: true,
expanded: false,
};
const metric: SidebarTreeItem = {
name: 'Metrics',
Expand Down Expand Up @@ -590,7 +590,7 @@ export function buildDatabaseTree(
type: 'database',
name: db,
items: [],
expanded: true,
expanded: false,
};
items.push(itemDatabase);

Expand All @@ -600,7 +600,7 @@ export function buildDatabaseTree(
type: 'schema',
name: schema,
items: [],
expanded: true,
expanded: false,
};

itemDatabase.items!.push(itemSchema);
Expand Down

0 comments on commit cfe1a6d

Please sign in to comment.