diff --git a/graph/client/src/app/sidebar/project-list.tsx b/graph/client/src/app/sidebar/project-list.tsx index e88736e3d41c51..5e4c5a4e6314b1 100644 --- a/graph/client/src/app/sidebar/project-list.tsx +++ b/graph/client/src/app/sidebar/project-list.tsx @@ -4,9 +4,12 @@ import { MapPinIcon, } from '@heroicons/react/24/outline'; // nx-ignore-next-line +import { EyeIcon } from '@heroicons/react/24/outline'; import type { ProjectGraphNode } from '@nrwl/devkit'; +import ExperimentalFeature from '../experimental-feature'; import { useDepGraphService } from '../hooks/use-dep-graph'; import { useDepGraphSelector } from '../hooks/use-dep-graph-selector'; +import { TracingAlgorithmType } from '../machines/interfaces'; import { allProjectsSelector, getTracingInfo, @@ -14,9 +17,6 @@ import { workspaceLayoutSelector, } from '../machines/selectors'; import { parseParentDirectoriesFromFilePath } from '../util'; -import { TracingAlgorithmType } from '../machines/interfaces'; -import ExperimentalFeature from '../experimental-feature'; -import { EyeIcon } from '@heroicons/react/24/outline'; function getProjectsByType(type: string, projects: ProjectGraphNode[]) { return projects @@ -187,12 +187,40 @@ function SubProjectList({ } } + function toggleAllProjects(currentlySelected: boolean) { + if (currentlySelected) { + projects.forEach((project) => + deselectProject(project.projectGraphNode.name) + ); + } else { + projects.forEach((project) => + selectProject(project.projectGraphNode.name) + ); + } + } + + const someProjectsSelected = projects.some((project) => project.isSelected); + return ( <> {headerText !== '' ? ( -

- {headerText} -

+
+

+ {headerText} +

+ + toggleAllProjects(someProjectsSelected)} + > + + +
) : null}