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