Passed
Pull Request — master (#17)
by
unknown
02:50
created

src/utils/helpers/Selectors.ts   A

Complexity

Total Complexity 12
Complexity/F 1.09

Size

Lines of Code 50
Function Count 11

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 12
eloc 37
mnd 1
bc 1
fnc 11
dl 0
loc 50
rs 10
bpm 0.0909
cpm 1.0909
noi 0
c 0
b 0
f 0

11 Functions

Rating   Name   Duplication   Size   Complexity  
A Selectors.ts ➔ selectHighlightBackground 0 3 1
A Selectors.ts ➔ selectDetailsViewContainer 0 3 1
A Selectors.ts ➔ selectDetailsButtonWrapper 0 3 1
A Selectors.ts ➔ selectAllLinks 0 3 1
A Selectors.ts ➔ selectAllNodes 0 3 1
A Selectors.ts ➔ selectDetailsZoom 0 3 1
A Selectors.ts ➔ selectDetailsButtonRect 0 3 1
A Selectors.ts ➔ selectDetailsExitButtonWrapper 0 3 1
A Selectors.ts ➔ selectHighLightedNodes 0 4 2
A Selectors.ts ➔ selectDetailsButtonText 0 3 1
A Selectors.ts ➔ selectDetailsContainerDiv 0 3 1
1
import { select } from 'd3-selection';
2
import { LabelColors, Selectors } from '../AppConsts';
3
import { DependencyLink, DependencyNode } from '../../components/types';
4
5
export function selectHighLightedNodes() {
6
    return selectAllNodes().filter(function(this: SVGGElement) {
7
        return this.firstElementChild ? this.firstElementChild.getAttribute('fill') !== LabelColors.DEFAULT : false;
8
    });
9
}
10
11
export function selectAllNodes() {
12
    return select(Selectors.LABELS).selectAll<SVGGElement, DependencyNode>('g');
13
}
14
15
export function selectAllLinks() {
16
    return select(Selectors.LINKS).selectAll<SVGPathElement, DependencyLink>('path');
17
}
18
19
export function selectHighlightBackground() {
20
    return select(Selectors.HIGHLIGHT_BACKGROUND);
21
}
22
23
export function selectDetailsButtonWrapper() {
24
    return select(Selectors.DETAILS_BUTTON);
25
}
26
27
export function selectDetailsExitButtonWrapper() {
28
    return select(Selectors.DETAILS_EXIT_BUTTON);
29
}
30
31
export function selectDetailsButtonRect() {
32
    return selectDetailsButtonWrapper().select('rect');
33
}
34
35
export function selectDetailsButtonText() {
36
    return selectDetailsButtonWrapper().select('text');
37
}
38
39
export function selectDetailsViewContainer() {
40
    return select(Selectors.DETAILS_VIEW_CONTAINER);
41
}
42
43
export function selectDetailsContainerDiv() {
44
    return select(Selectors.DETAILS_CONTAINER_DIV);
45
}
46
47
export function selectDetailsZoom() {
48
    return select(Selectors.ZOOM_DETAILS);
49
}
50