fix(my-joy-beta): don't expand metadada kv when in other section

fixes #1052
This commit is contained in:
Sara Vieira 2018-01-22 16:39:52 +01:00 committed by Sérgio Ramos
parent 8c8dd1758d
commit a33b586e42

View File

@ -57,7 +57,7 @@ export const Metadata = ({
</H3>
</Margin>
) : null}
{metadata.map(({ name, value, expanded }, index) => (
{metadata.map(({ name, value, open }, index) => (
<ReduxForm
form={FORM_NAME_EDIT(index)}
key={index}
@ -70,11 +70,12 @@ export const Metadata = ({
<KeyValue
{...props}
initialValues={{ name, value }}
expanded={expanded}
expanded={open}
method="edit"
input="textarea"
type="metadata"
onToggleExpanded={() => handleToggleExpanded(index)}
onToggleExpanded={() =>
expanded ? handleToggleExpanded(index) : null}
onCancel={() => handleCancelEdit(index)}
onRemove={() => handleRemoveMetadata(index)}
/>
@ -137,7 +138,7 @@ export default compose(
set({ name: 'create-instance-metadata-proceeded', value: true })
);
return history.push(`/instances/~create/user-scripts`);
return history.push(`/instances/~create/user-script`);
},
handleEdit: () => {
return history.push(`/instances/~create/metadata`);
@ -150,7 +151,7 @@ export default compose(
const appendMetadata = set({
name: `create-instance-metadata`,
value: metadata.concat([{ ...value, expanded: false }])
value: metadata.concat([{ ...value, open: false }])
});
return dispatch([
@ -162,7 +163,7 @@ export default compose(
handleUpdateMetadata: (index, newMetadata) => {
metadata[index] = {
...newMetadata,
expanded: false
open: false
};
return dispatch([
@ -179,7 +180,7 @@ export default compose(
handleToggleExpanded: index => {
metadata[index] = {
...metadata[index],
expanded: !metadata[index].expanded
open: !metadata[index].open
};
return dispatch(
@ -192,7 +193,7 @@ export default compose(
handleCancelEdit: index => {
metadata[index] = {
...metadata[index],
expanded: false
open: false
};
return dispatch([