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 ( ee15c2...bb31bb )
by Benjamin
01:50
created

src/actions/plugins/editor/EditorActions.js   A

Complexity

Total Complexity 12
Complexity/F 1.09

Size

Lines of Code 120
Function Count 11

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 0
wmc 12
c 1
b 0
f 1
nc 1
mnd 1
bc 12
fnc 11
dl 0
loc 120
rs 10
bpm 1.0909
cpm 1.0909
noi 0

10 Functions

Rating   Name   Duplication   Size   Complexity  
A EditorActions.js ➔ setEditorValidation 0 3 1
B EditorActions.js ➔ editRow 0 27 2
A EditorActions.js ➔ repositionEditor 0 8 1
A EditorActions.js ➔ cancelRow 0 3 1
A EditorActions.js ➔ updateRow 0 8 1
B EditorActions.js ➔ addNewRow 0 25 1
A EditorActions.js ➔ saveRow 0 3 1
A EditorActions.js ➔ updateCellValue 0 13 1
A EditorActions.js ➔ dismissEditor 0 3 1
A EditorActions.js ➔ removeRow 0 3 1
1
import {
2
    ADD_NEW_ROW,
3
    CANCEL_ROW,
4
    DISMISS_EDITOR,
5
    EDIT_ROW,
6
    EDITOR_VALIDATION,
7
    ROW_VALUE_CHANGE,
8
    REMOVE_ROW,
9
    REPOSITION_EDITOR,
10
    SAVE_ROW,
11
    UPDATE_ROW
12
} from '../../../constants/ActionTypes';
13
14
import { keyGenerator } from '../../../util/keyGenerator';
15
16
export function editRow({
17
    rowId,
18
    top,
19
    rowData = {},
20
    rowIndex,
21
    columns,
22
    isCreate,
23
    stateKey,
24
    editMode = 'inline'
25
}) {
26
27
    if (!rowId) {
28
        throw new Error('rowId is a required parameter for editRow Action');
29
    }
30
31
    return {
32
        type: EDIT_ROW,
33
        rowId,
34
        top,
35
        values: rowData,
36
        rowIndex,
37
        columns,
38
        isCreate,
39
        stateKey,
40
        editMode
41
    };
42
}
43
44
export function repositionEditor({ top, stateKey, rowId }) {
45
    return {
46
        type: REPOSITION_EDITOR,
47
        rowId,
48
        stateKey,
49
        top
50
    };
51
}
52
53
export function dismissEditor({ stateKey }) {
54
    return { type: DISMISS_EDITOR, stateKey };
55
}
56
57
export function updateCellValue({
58
    value, name, column, columns, stateKey, rowId
59
}) {
60
    return {
61
        type: ROW_VALUE_CHANGE,
62
        value,
63
        columnName: name,
64
        column,
65
        columns,
66
        stateKey,
67
        rowId
68
    };
69
}
70
71
export function saveRow({ values, rowIndex, stateKey }) {
72
    return { type: SAVE_ROW, values, rowIndex, stateKey };
73
}
74
75
export function cancelRow({ stateKey }) {
76
    return { type: CANCEL_ROW, stateKey };
77
}
78
79
export function removeRow({ rowIndex, stateKey }) {
80
    return { type: REMOVE_ROW, rowIndex, stateKey };
81
}
82
83
export function setEditorValidation({ validationState, stateKey }) {
84
    return { type: EDITOR_VALIDATION, validationState, stateKey };
85
}
86
87
export function updateRow({ stateKey, rowIndex, values }) {
88
    return {
89
        type: UPDATE_ROW,
90
        stateKey,
91
        rowIndex,
92
        values
93
    };
94
}
95
96
export function addNewRow({ columns, data, stateKey, editMode = 'inline' }) {
97
98
    return (dispatch) => {
99
        const rowId = keyGenerator('row', 0);
100
        const top = 43;
101
        const rowData = data || {};
102
        const rowIndex = 0;
103
        const isCreate = true;
104
105
        dispatch({ type: ADD_NEW_ROW, stateKey, rowId });
106
107
        dispatch(
108
            editRow({
109
                rowId,
110
                top,
111
                rowData,
112
                rowIndex,
113
                columns,
114
                isCreate,
115
                stateKey,
116
                editMode
117
            })
118
        );
119
    };
120
}
121