Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// *********************************************************************
import * as Actions from './flowActions';
import * as Models from './flowModels';
import { QueryModels, QueryActions } from 'datax-query';
const INITIAL_FLOW_STATE = {
// Flow Config
name: '',
flowId: '',
displayName: Models.getDefaultName(),
owner: '',
databricksToken: '',
input: Models.defaultInput,
referenceData: [],
functions: [],
query: QueryModels.defaultQuery,
scale: {
jobNumExecutors: '4',
jobExecutorMemory: '1000',
jobDatabricksAutoScale: true,
jobDatabricksMinWorkers: '1',
jobDatabricksMaxWorkers: '8'
},
outputs: [Models.getMetricSinker()],
outputTemplates: [],
rules: [],
batchInputs: [Models.getDefaultBatchInputSettings()],
batchList: [],
// State
isNew: false,
return dispatch({
type: FLOW_INIT,
payload: flow
});
})
.then(flow => {
dispatch(QueryActions.initQuery(flow.payload.query));
})
.catch(error => {
const message = getApiErrorMessage(error);
updateErrorMessage(dispatch, message);
return Q.reject({ error: true, message: message });
});
} else {
const owner = UserSelectors.getUserAlias(getState());
dispatch(QueryActions.initQuery(QueryModels.defaultQuery));
return dispatch({
type: FLOW_NEW,
payload: owner
});
}
};