fix(my-joy-beta): order and check default networks

fixes #928
This commit is contained in:
Sara Vieira 2018-01-23 12:13:13 +01:00 committed by Sérgio Ramos
parent a33b586e42
commit bbfa427a92
3 changed files with 20 additions and 13 deletions

View File

@ -115,7 +115,7 @@ export const Expanded = ({
<CardHeader secondary={selected}>
<CardHeaderBox>
<FormGroup name={id} field={Field}>
<Checkbox noMargin />
<Checkbox noMargin checked={selected} />
</FormGroup>
</CardHeaderBox>
<CardHeaderMeta paddingLeft={0}>

View File

@ -2663,7 +2663,7 @@ Array [
className="c7"
>
<div
checked={false}
checked={true}
className="c8"
disabled={false}
id="m"
@ -2671,7 +2671,7 @@ Array [
type="checkbox"
>
<input
checked={false}
checked={true}
className="c9"
disabled={false}
id="n"

View File

@ -117,12 +117,18 @@ export default compose(
connect(
({ values, form }, { networks }) => {
const selected = get(form, `${FORM_NAME}.values`, {});
const empty = id => !Object.keys(selected).includes(id);
return {
proceeded: get(values, 'create-instance-networks-proceeded', false),
networks: networks.map(({ id, ...network }) => ({
networks: networks
.map(({ id, name, ...network }) => ({
...network,
selected: Boolean(selected[id]),
name,
selected:
empty(id) && name === 'Joyent-SDC-Public'
? true
: Boolean(selected[id]),
infoExpanded: get(
values,
`create-instance-networks-${id}-expanded`,
@ -130,6 +136,7 @@ export default compose(
),
id
}))
.sort((a, b) => a.name < b.name)
};
},
(dispatch, { history }) => ({