Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ coverage
*.iml
.nvmrc
.nyc_output
.electron/
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ src/
.zuul.yml
lib/index.html
examples/
.electron/
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
"react-hot-loader": "^4.12.14",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-mock-store": "^1.5.4",
"reflux": "^0.4.1",
"reflux-state-mixin": "^0.7.0",
"resolve": "^1.12.0",
Expand Down
45 changes: 26 additions & 19 deletions src/modules/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ const debug = createLogger('import');
* ## Action names
*/
const PREFIX = 'import-export/import';
const STARTED = `${PREFIX}/STARTED`;
const CANCELED = `${PREFIX}/CANCELED`;
const PROGRESS = `${PREFIX}/PROGRESS`;
const FINISHED = `${PREFIX}/FINISHED`;
const FAILED = `${PREFIX}/FAILED`;
const FILE_TYPE_SELECTED = `${PREFIX}/FILE_TYPE_SELECTED`;
const FILE_SELECTED = `${PREFIX}/FILE_SELECTED`;
const OPEN = `${PREFIX}/OPEN`;
const CLOSE = `${PREFIX}/CLOSE`;
const SET_PREVIEW = `${PREFIX}/SET_PREVIEW`;
const SET_DELIMITER = `${PREFIX}/SET_DELIMITER`;
const SET_GUESSTIMATED_TOTAL = `${PREFIX}/SET_GUESSTIMATED_TOTAL`;
const SET_STOP_ON_ERRORS = `${PREFIX}/SET_STOP_ON_ERRORS`;
const SET_IGNORE_BLANKS = `${PREFIX}/SET_IGNORE_BLANKS`;
const TOGGLE_INCLUDE_FIELD = `${PREFIX}/TOGGLE_INCLUDE_FIELD`;
const SET_FIELD_TYPE = `${PREFIX}/SET_FIELD_TYPE`;
export const STARTED = `${PREFIX}/STARTED`;
export const CANCELED = `${PREFIX}/CANCELED`;
export const PROGRESS = `${PREFIX}/PROGRESS`;
export const FINISHED = `${PREFIX}/FINISHED`;
export const FAILED = `${PREFIX}/FAILED`;
export const FILE_TYPE_SELECTED = `${PREFIX}/FILE_TYPE_SELECTED`;
export const FILE_SELECTED = `${PREFIX}/FILE_SELECTED`;
export const OPEN = `${PREFIX}/OPEN`;
export const CLOSE = `${PREFIX}/CLOSE`;
export const SET_PREVIEW = `${PREFIX}/SET_PREVIEW`;
export const SET_DELIMITER = `${PREFIX}/SET_DELIMITER`;
export const SET_GUESSTIMATED_TOTAL = `${PREFIX}/SET_GUESSTIMATED_TOTAL`;
export const SET_STOP_ON_ERRORS = `${PREFIX}/SET_STOP_ON_ERRORS`;
export const SET_IGNORE_BLANKS = `${PREFIX}/SET_IGNORE_BLANKS`;
export const TOGGLE_INCLUDE_FIELD = `${PREFIX}/TOGGLE_INCLUDE_FIELD`;
export const SET_FIELD_TYPE = `${PREFIX}/SET_FIELD_TYPE`;

/**
* ## Initial state.
Expand All @@ -92,7 +92,8 @@ export const INITIAL_STATE = {
values: [],
previewLoaded: false,
exclude: [],
transform: []
transform: [],
fileType: ''
};

/**
Expand Down Expand Up @@ -255,8 +256,9 @@ export const startImport = () => {
progress,
dest,
function(err) {
debugger;
console.timeEnd('import:start');
console.groupEnd('import:start');
console.groupEnd();
/**
* Refresh data (docs, aggregations) regardless of whether we have a
* partial import or full import
Expand Down Expand Up @@ -446,6 +448,7 @@ export const selectImportFileName = fileName => {
return promisify(detectImportFile)(fileName);
})
.then(detected => {
debug('get detection results');
dispatch({
type: FILE_SELECTED,
fileName: fileName,
Expand All @@ -467,7 +470,10 @@ export const selectImportFileName = fileName => {
)
);
})
.catch(err => dispatch(onError(err)));
.catch(err => {
debug('dispatching error', err);
dispatch(onError(err));
});
};
};

Expand Down Expand Up @@ -596,6 +602,7 @@ export const closeImport = () => ({
*/
// eslint-disable-next-line complexity
const reducer = (state = INITIAL_STATE, action) => {
debug('reducer handling action', action);
if (action.type === FILE_SELECTED) {
return {
...state,
Expand Down
Loading