Skip to content

Commit

Permalink
Merge pull request #226 from ComPlat/development
Browse files Browse the repository at this point in the history
Features for version 1.3.4
  • Loading branch information
haditariq authored Jul 30, 2024
2 parents a9a7e8f + 7fc69e2 commit ba84a45
Show file tree
Hide file tree
Showing 38 changed files with 67,792 additions and 1,311 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/nmr1h_spec.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('NMR 1H', () => {
cy.get('.btn-sv-bar-spctrum').click()
cy.get('.input-sv-bar-layout').click()
cy.get('.option-sv-bar-layout').should($li => {
expect($li).to.have.length(23)
expect($li).to.have.length(24)
})
cy.get('ul li:nth-child(9)').click()

Expand Down
4 changes: 4 additions & 0 deletions dist/components/cmd_bar/r01_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ const layoutSelect = (classes, layoutSt, updateLayoutAct) => {
}, /*#__PURE__*/_react.default.createElement("span", {
className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout')
}, "SEC")), /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
value: _list_layout.LIST_LAYOUT.GC
}, /*#__PURE__*/_react.default.createElement("span", {
className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout')
}, "GC (GAS CHROMATOGRAPHY)")), /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
value: _list_layout.LIST_LAYOUT.AIF
}, /*#__PURE__*/_react.default.createElement("span", {
className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout')
Expand Down
2 changes: 1 addition & 1 deletion dist/components/d3_line/line_focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ class LineFocus {
return null;
}
reverseXAxis(layoutSt) {
return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.DSC, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.DLS_ACF, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.EMISSIONS, _list_layout.LIST_LAYOUT.DLS_INTENSITY].indexOf(layoutSt) < 0;
return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.DSC, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.DLS_ACF, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.GC, _list_layout.LIST_LAYOUT.EMISSIONS, _list_layout.LIST_LAYOUT.DLS_INTENSITY].indexOf(layoutSt) < 0;
}
create(_ref) {
let {
Expand Down
9 changes: 5 additions & 4 deletions dist/components/d3_multi/multi_focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,17 @@ class MultiFocus {
if (idx === jcampIdx) {
this.data = [...currData];
this.pathColor = color;
filterSubLayoutValue = feature.xUnit;
filterSubLayoutValue = _format.default.isSECLayout(layout) ? feature.xUnit : feature.yUnit;
} else {
const filterValue = _format.default.isSECLayout(layout) ? feature.xUnit : feature.yUnit;
this.otherLineData.push({
data: currData,
color,
filterSublayout: feature.xUnit
filterSublayout: filterValue
});
}
});
if (_format.default.isSECLayout(layout)) {
if (_format.default.isSECLayout(layout) || _format.default.isGCLayout(layout)) {
this.otherLineData = this.otherLineData.filter(data => {
return data.filterSublayout === filterSubLayoutValue;
});
Expand Down Expand Up @@ -785,7 +786,7 @@ class MultiFocus {
ccp.enter().append('path').attr('d', lineSymbol).attr('class', 'enter-ref').attr('fill', 'green').attr('fill-opacity', 0.8).merge(ccp).attr('transform', d => `translate(${xt(d.x)}, ${yt(d.y)})`);
}
reverseXAxis(layoutSt) {
return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.DSC, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.AIF].indexOf(layoutSt) < 0;
return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.DSC, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.GC, _list_layout.LIST_LAYOUT.AIF].indexOf(layoutSt) < 0;
}
create(_ref) {
let {
Expand Down
18 changes: 14 additions & 4 deletions dist/components/multi_jcamps_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var _index3 = _interopRequireDefault(require("./d3_multi/index"));
var _curve = require("../actions/curve");
var _cyclic_voltammetry = require("../actions/cyclic_voltammetry");
var _list_layout = require("../constants/list_layout");
var _format = _interopRequireDefault(require("../helpers/format"));
/* eslint-disable react/default-props-match-prop-types,
react/require-default-props, react/no-unused-prop-types, react/jsx-boolean-value,
prefer-object-spread */
Expand Down Expand Up @@ -63,10 +64,12 @@ class MultiJcampsViewer extends _react.default.Component {
userManualLink,
molSvg,
theoryMass,
layoutSt
layoutSt,
integrationSt
} = this.props;
if (!entities || entities.length === 0) return /*#__PURE__*/_react.default.createElement("div", null);
const seperatedSubLayouts = seperatingSubLayout(entities, 'xUnit', layoutSt);
const separateCondition = _format.default.isGCLayout(layoutSt) ? 'yUnit' : 'xUnit';
const seperatedSubLayouts = seperatingSubLayout(entities, separateCondition, layoutSt);
const {
curveIdx
} = curveSt;
Expand All @@ -75,6 +78,10 @@ class MultiJcampsViewer extends _react.default.Component {
feature,
topic
} = entity;
const {
integrations
} = integrationSt;
const currentIntegration = integrations[curveIdx];
return /*#__PURE__*/_react.default.createElement("div", {
className: classes.root
}, /*#__PURE__*/_react.default.createElement(_index2.default, {
Expand Down Expand Up @@ -107,6 +114,7 @@ class MultiJcampsViewer extends _react.default.Component {
molSvg: molSvg,
theoryMass: theoryMass,
subLayoutsInfo: seperatedSubLayouts,
integration: currentIntegration,
descriptions: "",
canChangeDescription: () => {},
onDescriptionChanged: () => {}
Expand All @@ -119,7 +127,8 @@ const mapStateToProps = (state, _) => (
curveSt: state.curve,
cyclicVoltaSt: state.cyclicvolta,
entities: state.curve.listCurves,
layoutSt: state.layout
layoutSt: state.layout,
integrationSt: state.integration.present
});
const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({
setAllCurvesAct: _curve.setAllCurves,
Expand All @@ -143,7 +152,8 @@ MultiJcampsViewer.propTypes = {
userManualLink: _propTypes.default.object,
entities: _propTypes.default.array,
layoutSt: _propTypes.default.string.isRequired,
theoryMass: _propTypes.default.string
theoryMass: _propTypes.default.string,
integrationSt: _propTypes.default.object.isRequired
};
MultiJcampsViewer.defaultProps = {
multiEntities: [],
Expand Down
13 changes: 11 additions & 2 deletions dist/components/panel/graph_selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ const GraphSelectionPanel = _ref => {
toggleShowAllCurveAct
} = _ref;
let subLayoutValues = [];
if (subLayoutsInfo !== undefined && subLayoutsInfo !== null) {
if (subLayoutsInfo) {
subLayoutValues = Object.keys(subLayoutsInfo);
}
const [selectedSubLayout, setSelectedSublayout] = (0, _react.useState)(subLayoutValues[0]);
(0, _react.useEffect)(() => {
setSelectedSublayout(subLayoutValues[0]);
}, subLayoutValues);
if (!curveSt) {
return /*#__PURE__*/_react.default.createElement("span", null);
}
Expand Down Expand Up @@ -144,13 +147,19 @@ const GraphSelectionPanel = _ref => {
onChange: onChangeTabSubLayout
}, subLayoutValues.map((subLayout, i) => {
let subLayoutName = '';
switch (subLayout) {
switch (subLayout.toUpperCase()) {
case 'G/MOL':
subLayoutName = 'MWD';
break;
case 'MILLILITERS':
subLayoutName = 'ELU';
break;
case 'INTENSITY':
subLayoutName = 'Chromatogram';
break;
case 'DEGREES CELSIUS':
subLayoutName = 'Temperature';
break;
default:
break;
}
Expand Down
3 changes: 2 additions & 1 deletion dist/constants/list_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ const LIST_LAYOUT = exports.LIST_LAYOUT = {
EMISSIONS: 'Emissions',
DLS_ACF: 'DLS ACF',
DLS_INTENSITY: 'DLS intensity',
DSC: 'DIFFERENTIAL SCANNING CALORIMETRY'
DSC: 'DIFFERENTIAL SCANNING CALORIMETRY',
GC: 'GAS CHROMATOGRAPHY'
};
2 changes: 1 addition & 1 deletion dist/helpers/cfg.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = void 0;
var _format = _interopRequireDefault(require("./format"));
const btnCmdAnaViewer = layoutSt => _format.default.isMsLayout(layoutSt) || _format.default.isRamanLayout(layoutSt) || _format.default.is19FLayout(layoutSt) || _format.default.isUvVisLayout(layoutSt) || _format.default.isHplcUvVisLayout(layoutSt) || _format.default.isTGALayout(layoutSt) || _format.default.isDSCLayout(layoutSt) || _format.default.isXRDLayout(layoutSt) || _format.default.is31PLayout(layoutSt) || _format.default.is15NLayout(layoutSt) || _format.default.is29SiLayout(layoutSt) || _format.default.isCyclicVoltaLayout(layoutSt) || _format.default.isCDSLayout(layoutSt) || _format.default.isSECLayout(layoutSt);
const btnCmdAnaViewer = layoutSt => _format.default.isMsLayout(layoutSt) || _format.default.isRamanLayout(layoutSt) || _format.default.is19FLayout(layoutSt) || _format.default.isUvVisLayout(layoutSt) || _format.default.isHplcUvVisLayout(layoutSt) || _format.default.isTGALayout(layoutSt) || _format.default.isDSCLayout(layoutSt) || _format.default.isXRDLayout(layoutSt) || _format.default.is31PLayout(layoutSt) || _format.default.is15NLayout(layoutSt) || _format.default.is29SiLayout(layoutSt) || _format.default.isCyclicVoltaLayout(layoutSt) || _format.default.isCDSLayout(layoutSt) || _format.default.isSECLayout(layoutSt) || _format.default.isGCLayout(layoutSt);
const hideCmdAnaViewer = () => false;
const btnCmdAddPeak = layoutSt => _format.default.isMsLayout(layoutSt);
const btnCmdRmPeak = layoutSt => _format.default.isMsLayout(layoutSt);
Expand Down
5 changes: 4 additions & 1 deletion dist/helpers/chem.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,9 @@ const readLayout = jcamp => {
if (dataType.includes('SIZE EXCLUSION CHROMATOGRAPHY')) {
return _list_layout.LIST_LAYOUT.SEC;
}
if (dataType.includes('GAS CHROMATOGRAPHY')) {
return _list_layout.LIST_LAYOUT.GC;
}
if (dataType.includes('SORPTION-DESORPTION MEASUREMENT')) {
return _list_layout.LIST_LAYOUT.AIF;
}
Expand Down Expand Up @@ -839,7 +842,7 @@ const ExtractJcamp = source => {
layout,
temperature
};
} else if (_format.default.isCyclicVoltaLayout(layout) || _format.default.isSECLayout(layout) || _format.default.isAIFLayout(layout) || _format.default.isCDSLayout(layout)) {
} else if (_format.default.isCyclicVoltaLayout(layout) || _format.default.isSECLayout(layout) || _format.default.isAIFLayout(layout) || _format.default.isCDSLayout(layout) || _format.default.isGCLayout(layout)) {
features = extrFeaturesCylicVolta(jcamp, layout, peakUp);
} else {
features = extrFeaturesNi(jcamp, layout, peakUp, spectra);
Expand Down
11 changes: 9 additions & 2 deletions dist/helpers/extractPeaksEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,15 @@ const extractAreaUnderCurve = (allIntegrationSt, presentIntegrationSt, layoutSt)
if (_format.default.isHplcUvVisLayout(layoutSt) && Array.isArray(allIntegrationSt) && presentIntegrationSt) {
const results = [];
allIntegrationSt.forEach(inte => {
const aucVal = getAUCValue(inte, layoutSt);
results.push(aucVal);
const {
integrations
} = inte;
const subResults = [];
integrations.forEach(subInte => {
const aucVal = getAUCValue(subInte, layoutSt);
subResults.push(aucVal);
});
results.push(subResults);
});
return results;
}
Expand Down
13 changes: 10 additions & 3 deletions dist/helpers/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const spectraDigit = layout => {
case _list_layout.LIST_LAYOUT.XRD:
case _list_layout.LIST_LAYOUT.CDS:
case _list_layout.LIST_LAYOUT.SEC:
case _list_layout.LIST_LAYOUT.GC:
case _list_layout.LIST_LAYOUT.MS:
return 0;
case _list_layout.LIST_LAYOUT.C13:
Expand Down Expand Up @@ -135,6 +136,10 @@ const spectraOps = {
head: 'SIZE EXCLUSION CHROMATOGRAPHY',
tail: '.'
},
[_list_layout.LIST_LAYOUT.GC]: {
head: 'GAS CHROMATOGRAPHY',
tail: '.'
},
[_list_layout.LIST_LAYOUT.EMISSIONS]: {
head: 'EMISSION',
tail: '.'
Expand Down Expand Up @@ -416,7 +421,7 @@ const peaksBody = _ref => {
if (layout === _list_layout.LIST_LAYOUT.DLS_INTENSITY) {
return formatedDLSIntensity(ordered, maxY, decimal, isAscend, isIntensity, boundary, false);
}
if (layout === _list_layout.LIST_LAYOUT.RAMAN || layout === _list_layout.LIST_LAYOUT.TGA || layout === _list_layout.LIST_LAYOUT.DSC || layout === _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY || layout === _list_layout.LIST_LAYOUT.CDS || layout === _list_layout.LIST_LAYOUT.SEC) {
if (layout === _list_layout.LIST_LAYOUT.RAMAN || layout === _list_layout.LIST_LAYOUT.TGA || layout === _list_layout.LIST_LAYOUT.DSC || layout === _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY || layout === _list_layout.LIST_LAYOUT.CDS || layout === _list_layout.LIST_LAYOUT.SEC || layout === _list_layout.LIST_LAYOUT.GC) {
return formatedEm(ordered, maxY, decimal, isAscend, isIntensity, boundary, false);
}
if (layout === _list_layout.LIST_LAYOUT.XRD) {
Expand Down Expand Up @@ -464,8 +469,9 @@ const isXRDLayout = layoutSt => _list_layout.LIST_LAYOUT.XRD === layoutSt;
const isCyclicVoltaLayout = layoutSt => _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY === layoutSt;
const isCDSLayout = layoutSt => _list_layout.LIST_LAYOUT.CDS === layoutSt;
const isSECLayout = layoutSt => _list_layout.LIST_LAYOUT.SEC === layoutSt;
const isGCLayout = layoutSt => _list_layout.LIST_LAYOUT.GC === layoutSt;
const isEmWaveLayout = layoutSt => [_list_layout.LIST_LAYOUT.IR, _list_layout.LIST_LAYOUT.RAMAN, _list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS].indexOf(layoutSt) >= 0;
const hasMultiCurves = layoutSt => [_list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.AIF].indexOf(layoutSt) >= 0;
const hasMultiCurves = layoutSt => [_list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.GC, _list_layout.LIST_LAYOUT.AIF].indexOf(layoutSt) >= 0;
const isAIFLayout = layoutSt => _list_layout.LIST_LAYOUT.AIF === layoutSt;
const isEmissionsLayout = layoutSt => _list_layout.LIST_LAYOUT.EMISSIONS === layoutSt;
const isDLSACFLayout = layoutSt => _list_layout.LIST_LAYOUT.DLS_ACF === layoutSt;
Expand Down Expand Up @@ -518,7 +524,7 @@ const formatPeaksByPrediction = function (peaks, layout, isAscend, decimal) {
return body;
};
const compareColors = idx => ['#ABB2B9', '#EDBB99', '#ABEBC6', '#D2B4DE', '#F9E79F'][idx % 5];
const mutiEntitiesColors = idx => ['#fa8231', '#f7b731', '#0fb9b1', '#2d98da', '#3867d6', '#8854d0', '#4b6584'][idx % 7];
const mutiEntitiesColors = idx => ['#d35400', '#2980b9', '#8e44ad', '#2c3e50', '#6D214F', '#182C61', '#BDC581'][idx % 7];
const strNumberFixedDecimal = function (number) {
let decimal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
if (decimal <= 0) {
Expand Down Expand Up @@ -660,6 +666,7 @@ const Format = {
isEmissionsLayout,
isDLSIntensityLayout,
isEmWaveLayout,
isGCLayout,
fixDigit,
formatPeaksByPrediction,
formatedMS,
Expand Down
5 changes: 4 additions & 1 deletion dist/helpers/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ exports.getAbsoluteArea = getAbsoluteArea;
const calcArea = function (d, refArea, refFactor) {
let ignoreRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if (ignoreRef) {
return d.absoluteArea.toFixed(2);
const {
absoluteArea
} = d;
return !absoluteArea ? 0 : d.absoluteArea.toFixed(2);
}
return (d.area * refFactor / refArea).toFixed(2);
};
Expand Down
18 changes: 18 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ var _sec_3_jcamp = _interopRequireDefault(require("./__tests__/fixtures/sec_3_jc
var _sec_4_jcamp = _interopRequireDefault(require("./__tests__/fixtures/sec_4_jcamp"));
var _aif_jcamp_ = _interopRequireDefault(require("./__tests__/fixtures/aif_jcamp_1"));
var _aif_jcamp_2 = _interopRequireDefault(require("./__tests__/fixtures/aif_jcamp_2"));
var _gc_1_jcamp = _interopRequireDefault(require("./__tests__/fixtures/gc_1_jcamp"));
var _gc_2_jcamp = _interopRequireDefault(require("./__tests__/fixtures/gc_2_jcamp"));
var _gc_3_jcamp = _interopRequireDefault(require("./__tests__/fixtures/gc_3_jcamp"));
var _emissions_jcamp = _interopRequireDefault(require("./__tests__/fixtures/emissions_jcamp"));
var _dls_acf_jcamp = _interopRequireDefault(require("./__tests__/fixtures/dls_acf_jcamp"));
var _dls_intensity_jcamp = _interopRequireDefault(require("./__tests__/fixtures/dls_intensity_jcamp"));
Expand Down Expand Up @@ -78,6 +81,9 @@ const secEntity3 = _app.FN.ExtractJcamp(_sec_3_jcamp.default);
const secEntity4 = _app.FN.ExtractJcamp(_sec_4_jcamp.default);
const aifEntity1 = _app.FN.ExtractJcamp(_aif_jcamp_.default);
const aifEntity2 = _app.FN.ExtractJcamp(_aif_jcamp_2.default);
const gcEntity1 = _app.FN.ExtractJcamp(_gc_1_jcamp.default);
const gcEntity2 = _app.FN.ExtractJcamp(_gc_2_jcamp.default);
const gcEntity3 = _app.FN.ExtractJcamp(_gc_3_jcamp.default);
const emissionsEntity = _app.FN.ExtractJcamp(_emissions_jcamp.default);
const dlsAcfEntity = _app.FN.ExtractJcamp(_dls_acf_jcamp.default);
const dlsIntensityEntity = _app.FN.ExtractJcamp(_dls_intensity_jcamp.default);
Expand Down Expand Up @@ -176,6 +182,8 @@ class DemoWriteIr extends _react.default.Component {
return dlsAcfEntity;
case 'dls intensity':
return dlsIntensityEntity;
case 'gc':
return gcEntity1;
case 'ms':
default:
return msEntity;
Expand All @@ -200,6 +208,8 @@ class DemoWriteIr extends _react.default.Component {
return [secEntity1, secEntity2, secEntity3, secEntity4];
case 'aif':
return [aifEntity1, aifEntity2];
case 'gc':
return [gcEntity1, gcEntity2, gcEntity3];
default:
return false;
}
Expand Down Expand Up @@ -235,6 +245,7 @@ class DemoWriteIr extends _react.default.Component {
case 'emissions':
case 'dls acf':
case 'dls intensity':
case 'gc':
default:
return false;
}
Expand Down Expand Up @@ -700,6 +711,13 @@ class DemoWriteIr extends _react.default.Component {
},
onClick: this.onClick('sec')
}, "SEC"), /*#__PURE__*/_react.default.createElement(_material.Button, {
id: "btn-sec",
variant: "contained",
style: {
margin: '0 10px 0 10px'
},
onClick: this.onClick('gc')
}, "GC"), /*#__PURE__*/_react.default.createElement(_material.Button, {
id: "btn-sod",
variant: "contained",
style: {
Expand Down
46 changes: 45 additions & 1 deletion dist/sagas/saga_multi_entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var _list_layout = require("../constants/list_layout");

const getLayoutSt = state => state.layout;
const getCurveSt = state => state.curve;
const getIntegrationSt = state => state.integration.present;
function getMaxMinPeak(curve) {
return curve.maxminPeak;
}
Expand Down Expand Up @@ -105,5 +106,48 @@ function* setCyclicVoltametryRef(action) {
}
});
}
const multiEntitiesSagas = [(0, _effects.takeEvery)(_action_type.CURVE.SET_ALL_CURVES, setCyclicVoltametry), (0, _effects.takeEvery)(_action_type.CYCLIC_VOLTA_METRY.SET_FACTOR, setCyclicVoltametryRef)];
function* setInitIntegrations(action) {
// eslint-disable-line
const curveSt = yield (0, _effects.select)(getCurveSt);
const {
listCurves
} = curveSt;
if (listCurves) {
for (let index = 0; index < listCurves.length; index++) {
const integationSt = yield (0, _effects.select)(getIntegrationSt);
const curve = listCurves[index];
const {
integration,
simulation
} = curve;
const {
integrations
} = integationSt;
const newArrIntegration = [...integrations];
if (index < newArrIntegration.length) {
newArrIntegration[index] = integration;
} else {
newArrIntegration.push(integration);
}
const payload = Object.assign({}, integationSt, {
integrations: newArrIntegration,
selectedIdx: index
}); // eslint-disable-line

if (integration) {
yield (0, _effects.put)({
type: _action_type.INTEGRATION.RESET_ALL_RDC,
payload
});
}
if (simulation) {
yield (0, _effects.put)({
type: _action_type.SIMULATION.RESET_ALL_RDC,
payload: simulation
});
}
}
}
}
const multiEntitiesSagas = [(0, _effects.takeEvery)(_action_type.CURVE.SET_ALL_CURVES, setCyclicVoltametry), (0, _effects.takeEvery)(_action_type.CURVE.SET_ALL_CURVES, setInitIntegrations), (0, _effects.takeEvery)(_action_type.CYCLIC_VOLTA_METRY.SET_FACTOR, setCyclicVoltametryRef)];
var _default = exports.default = multiEntitiesSagas;
Loading

0 comments on commit ba84a45

Please sign in to comment.