Skip to content

Commit

Permalink
Merge pull request #874 from InfuseAI/feature/sc-32148/fold-all-resou…
Browse files Browse the repository at this point in the history
…rces-in-the-sidebar

[Feature] Fold all resources in the sidebar by default
popcornylu authored Sep 5, 2023
2 parents c68863b + cfe1a6d commit 9d1579d
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
@@ -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]);

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

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

@@ -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',
@@ -590,7 +590,7 @@ export function buildDatabaseTree(
type: 'database',
name: db,
items: [],
expanded: true,
expanded: false,
};
items.push(itemDatabase);

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

itemDatabase.items!.push(itemSchema);

0 comments on commit 9d1579d

Please sign in to comment.