GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 4076af...0f1b06 )
by Benjamin
01:31
created

src/util/handleEditClick.js   A

Complexity

Total Complexity 9
Complexity/F 4.5

Size

Lines of Code 30
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
cc 0
wmc 9
c 3
b 1
f 1
nc 1
mnd 2
bc 5
fnc 2
dl 0
loc 30
rs 10
bpm 2.5
cpm 4.5
noi 1
1
import { editRow } from './../actions/plugins/editor/EditorActions';
2
3
export const handleEditClick = (
4
    editor,
5
    store,
6
    rowId,
7
    rowData,
8
    rowIndex,
9
    columns,
10
    stateKey,
11
    events = {},
12
    data,
13
) => {
14
15
    if (events.HANDLE_BEFORE_EDIT) {
16
        const result = events.HANDLE_BEFORE_EDIT({
17
            store,
18
            id: rowId,
19
            data: rowData
20
        });
21
22
        // if HANDLE_BEFORE_EDIT event returns false
23
        // do not trigger edit
24
        if (result === false) {
25
            return;
26
        }
27
    }
28
29
    const row = closestRow(data.reactEvent.target);
30
    const offset = 7;
31
    const top = row ?
32
        (row.offsetTop + row.clientHeight + offset)
33
        : 0;
34
35
    if (editor.config.type === editor.editModes.inline) {
36
        store.dispatch(
37
            editRow({
38
                rowId, top, rowData, rowIndex, columns, stateKey
39
            })
40
        );
41
    }
42
};
43
44
export const closestRow = (target) => {
45
    let el = target;
46
47
    while (el && el !== document.body) {
48
        if (el && el.classList && el.classList.contains('react-grid-row')) {
49
            return el;
50
        }
51
        el = el.parentNode;
52
    }
53
};
54