Skip to content

Commit

Permalink
Critical fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Damir_Giliazetdinov authored and Damir_Giliazetdinov committed Feb 22, 2018
1 parent 42982b6 commit 6b95f95
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/script/ui/data/schema/struct-schema.js
Expand Up @@ -121,7 +121,7 @@ export const rgroupSchema = {
title: 'R-group',
type: 'object',
properties: {
rgroupValues: {
values: {
type: 'array',
items: {
type: 'string',
Expand Down
6 changes: 3 additions & 3 deletions src/script/ui/dialog/toolbox/rgroup.jsx
Expand Up @@ -23,17 +23,17 @@ import Dialog from '../../component/dialog';
import Form, { Field } from '../../component/form/form';
import ButtonList from '../../component/buttonlist';

function RGroup({ disabledIds, rgroupValues, formState, type, ...props }) { // eslint-disable-line
function RGroup({ disabledIds, values, formState, type, ...props }) { // eslint-disable-line
return (
<Dialog
title="R-Group"
className="rgroup"
params={props}
result={() => formState.result}
>
<Form schema={rgroupSchema} init={{ rgroupValues }} {...formState} >
<Form schema={rgroupSchema} init={{ values }} {...formState} >
<Field
name="rgroupValues"
name="values"
multiple={type === 'atom'}
labelPos={false}
component={ButtonList}
Expand Down
13 changes: 8 additions & 5 deletions src/script/ui/state/editor/index.js
Expand Up @@ -66,7 +66,7 @@ export default function initEditor(dispatch, getState) {
const rgroups = getState().editor.struct().rgroups;
const params = {
type: 'atom',
rgroupValues: elem.values,
values: elem.values,
disabledIds: Array.from(rgroups.entries())
.reduce((acc, [rgid, rg]) => {
if (rg.frags.has(elem.fragId))
Expand All @@ -75,12 +75,15 @@ export default function initEditor(dispatch, getState) {
return acc;
}, [])
};
dlg = openDialog(dispatch, 'rgroup', params);
dlg = openDialog(dispatch, 'rgroup', params).then(res => ({
values: res.values,
type: 'rlabel'
}));
} else {
dlg = openDialog(dispatch, 'period-table', elem);
}

return dlg.then(res => toElement(Object.assign(elem, { values: res.rgroupValues })));
return dlg.then(toElement);
},
onQuickEdit: atom => openDialog(dispatch, 'labelEdit', atom),
onBondEdit: bond => openDialog(dispatch, 'bondProps', fromBond(bond))
Expand All @@ -105,10 +108,10 @@ export default function initEditor(dispatch, getState) {
}, []);
const params = {
type: 'fragment',
rgroupValues: [rgroup.label],
values: [rgroup.label],
disabledIds
};
return openDialog(dispatch, 'rgroup', params).then(res => ({ label: res.rgroupValues[0] }));
return openDialog(dispatch, 'rgroup', params).then(res => ({ label: res.values[0] }));
},
onSgroupEdit: sgroup => sleep(0) // huck to open dialog after dispatch sgroup tool action
.then(() => openDialog(dispatch, 'sgroup', fromSgroup(sgroup)))
Expand Down
4 changes: 1 addition & 3 deletions src/script/ui/state/modal/form.js
Expand Up @@ -17,8 +17,6 @@
import { getDefaultOptions } from '../../data/schema/options-schema';
import { initSdata, sdataReducer } from './sdata';

export const rgroupValues = Array.from(new Array(32), (val, index) => 'R' + ++index);

export const formsState = { // TODO: create from schema.{smth}.defaultValue
atomProps: {
errors: {},
Expand Down Expand Up @@ -74,7 +72,7 @@ export const formsState = { // TODO: create from schema.{smth}.defaultValue
errors: {},
valid: true,
result: {
rgroupValues
values: []
}
},
rgroupLogic: {
Expand Down

0 comments on commit 6b95f95

Please sign in to comment.