-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
selectors.ts
50 lines (38 loc) · 1.7 KB
/
selectors.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// nx-ignore-next-line
import type { ProjectGraphProjectNode } from '@nrwl/devkit';
import { DepGraphSelector } from '../hooks/use-dep-graph-selector';
import { WorkspaceLayout } from '../interfaces';
import { GraphPerfReport } from './interfaces';
export const allProjectsSelector: DepGraphSelector<
ProjectGraphProjectNode[]
> = (state) => state.context.projects;
export const workspaceLayoutSelector: DepGraphSelector<WorkspaceLayout> = (
state
) => state.context.workspaceLayout;
export const selectedProjectNamesSelector: DepGraphSelector<string[]> = (
state
) => state.context.selectedProjects;
export const projectIsSelectedSelector: DepGraphSelector<boolean> = (state) =>
state.context.selectedProjects.length > 0;
export const lastPerfReportSelector: DepGraphSelector<GraphPerfReport> = (
state
) => state.context.lastPerfReport;
export const focusedProjectNameSelector: DepGraphSelector<string> = (state) =>
state.context.focusedProject;
export const searchDepthSelector: DepGraphSelector<{
searchDepth: number;
searchDepthEnabled: boolean;
}> = (state) => ({
searchDepth: state.context.searchDepth,
searchDepthEnabled: state.context.searchDepthEnabled,
});
export const includePathSelector: DepGraphSelector<boolean> = (state) =>
state.context.includePath;
export const groupByFolderSelector: DepGraphSelector<boolean> = (state) =>
state.context.groupByFolder;
export const collapseEdgesSelector: DepGraphSelector<boolean> = (state) =>
state.context.collapseEdges;
export const textFilterSelector: DepGraphSelector<string> = (state) =>
state.context.textFilter;
export const hasAffectedProjectsSelector: DepGraphSelector<boolean> = (state) =>
state.context.affectedProjects.length > 0;