From 5266b5d4858a65de85fa13de1a4cdce20e962ea3 Mon Sep 17 00:00:00 2001 From: Sara Vieira Date: Tue, 16 Jan 2018 11:23:00 +0000 Subject: [PATCH] fix(my-joy-beta): create instance - affinity ui fixes fixes #1014 --- .../__snapshots__/affinity.spec.js.snap | 24 ++++++++------- .../__tests__/affinity.spec.js | 3 -- .../create-instance/__tests__/network.spec.js | 2 ++ .../components/create-instance/affinity.js | 21 ++++++------- .../__tests__/networks.spec.js | 2 ++ .../containers/create-instance/affinity.js | 30 +++++++++---------- .../containers/create-instance/firewall.js | 4 ++- .../src/containers/create-instance/index.js | 17 +++++++---- .../containers/create-instance/metadata.js | 2 +- .../containers/create-instance/networks.js | 2 +- .../src/containers/create-instance/package.js | 2 +- .../src/containers/create-instance/tags.js | 2 +- packages/ui-toolkit/src/form/select.js | 6 +++- 13 files changed, 67 insertions(+), 50 deletions(-) diff --git a/packages/my-joy-beta/src/components/create-instance/__tests__/__snapshots__/affinity.spec.js.snap b/packages/my-joy-beta/src/components/create-instance/__tests__/__snapshots__/affinity.spec.js.snap index 4f492427..999d46fc 100644 --- a/packages/my-joy-beta/src/components/create-instance/__tests__/__snapshots__/affinity.spec.js.snap +++ b/packages/my-joy-beta/src/components/create-instance/__tests__/__snapshots__/affinity.spec.js.snap @@ -10,9 +10,11 @@ Array [ " ", " node as the instance(s) identified by the instance ", " ", - "key ", - " “", - "\\" and the instance tag value ", + "key “", + "\\" and the instance tag value", + " ", + " ", + "\\"", "”", ] `; @@ -27,9 +29,11 @@ Array [ " ", " node as the instance(s) identified by the instance ", " ", - "key ", - " “", - "\\" and the instance tag value ", + "key “", + "\\" and the instance tag value", + " ", + " ", + "\\"", "”", ] `; @@ -198,7 +202,7 @@ exports[`renders without throwing 1`] = ` } .c4:after { - right: 0rem; + right: 0.375rem; } .c7 { @@ -231,7 +235,7 @@ exports[`renders without throwing 1`] = ` } .c7:after { - right: 0rem; + right: 0.375rem; } .c6 { @@ -664,7 +668,7 @@ exports[`renders without throwing 2`] = ` } .c4:after { - right: 0rem; + right: 0.375rem; } .c7 { @@ -697,7 +701,7 @@ exports[`renders without throwing 2`] = ` } .c7:after { - right: 0rem; + right: 0.375rem; } .c6 { diff --git a/packages/my-joy-beta/src/components/create-instance/__tests__/affinity.spec.js b/packages/my-joy-beta/src/components/create-instance/__tests__/affinity.spec.js index f766ed05..a6f5e0cd 100644 --- a/packages/my-joy-beta/src/components/create-instance/__tests__/affinity.spec.js +++ b/packages/my-joy-beta/src/components/create-instance/__tests__/affinity.spec.js @@ -27,7 +27,6 @@ it('renders without throwing', () => { 'rule-instance-name': 'test', 'rule-instance-conditional': 'must', 'rule-instance-placement': 'same', - 'rule-instance-tag-key-pattern': 'equalling', 'rule-instance-tag-value-pattern': 'equalling', 'rule-instance-name-pattern': 'equalling', 'rule-instance-tag-value': '', @@ -51,7 +50,6 @@ it('renders
without throwing', () => { 'rule-instance-name': 'test', 'rule-instance-conditional': 'must', 'rule-instance-placement': 'same', - 'rule-instance-tag-key-pattern': 'equalling', 'rule-instance-tag-value-pattern': 'equalling', 'rule-instance-name-pattern': 'equalling', 'rule-instance-tag-value': '', @@ -75,7 +73,6 @@ it('renders
without throwing', () => { 'rule-instance-name': 'test', 'rule-instance-conditional': 'must', 'rule-instance-placement': 'same', - 'rule-instance-tag-key-pattern': 'equalling', 'rule-instance-tag-value-pattern': 'equalling', 'rule-instance-name-pattern': 'equalling', 'rule-instance-tag-value': 'one', diff --git a/packages/my-joy-beta/src/components/create-instance/__tests__/network.spec.js b/packages/my-joy-beta/src/components/create-instance/__tests__/network.spec.js index b4735003..8671635e 100644 --- a/packages/my-joy-beta/src/components/create-instance/__tests__/network.spec.js +++ b/packages/my-joy-beta/src/components/create-instance/__tests__/network.spec.js @@ -1,3 +1,5 @@ +/* eslint-disable camelcase */ + import React from 'react'; import renderer from 'react-test-renderer'; import 'jest-styled-components'; diff --git a/packages/my-joy-beta/src/components/create-instance/affinity.js b/packages/my-joy-beta/src/components/create-instance/affinity.js index 68f33416..c726041f 100644 --- a/packages/my-joy-beta/src/components/create-instance/affinity.js +++ b/packages/my-joy-beta/src/components/create-instance/affinity.js @@ -7,9 +7,9 @@ import titleCase from 'title-case'; import { H5, Select, Input, FormGroup } from 'joyent-ui-toolkit'; -const Values = ( +const Values = touched => ( - @@ -26,7 +26,7 @@ export const Rule = rule => ( The instance - @@ -35,7 +35,7 @@ export const Rule = rule => ( be on - @@ -44,7 +44,7 @@ export const Rule = rule => ( node as the instance(s) identified by the - @@ -58,7 +58,7 @@ export const Rule = rule => ( and value{' '} - {Values} + {Values(rule['rule-instance-tag-value-pattern'])} @@ -67,7 +67,7 @@ export const Rule = rule => ( ) : ( - {Values} + {Values(rule['rule-instance-name-pattern'])} ( ) : ( {' '} - key {rule['rule-instance-tag-key-pattern']} “{rule['rule-instance-tag-key']}" - and the instance tag value {rule['rule-instance-tag-value-pattern']} - {rule['rule-instance-tag-value']}” + key “{rule['rule-instance-tag-key']}" and the instance tag value{' '} + {rule['rule-instance-tag-value-pattern'] && + rule['rule-instance-tag-value-pattern'].split('-').join(' ')}{' '} + "{rule['rule-instance-tag-value']}” )} diff --git a/packages/my-joy-beta/src/containers/create-instance/__tests__/networks.spec.js b/packages/my-joy-beta/src/containers/create-instance/__tests__/networks.spec.js index 51060d8e..cab399d1 100644 --- a/packages/my-joy-beta/src/containers/create-instance/__tests__/networks.spec.js +++ b/packages/my-joy-beta/src/containers/create-instance/__tests__/networks.spec.js @@ -1,3 +1,5 @@ +/* eslint-disable camelcase */ + import React from 'react'; import renderer from 'react-test-renderer'; import 'jest-styled-components'; diff --git a/packages/my-joy-beta/src/containers/create-instance/affinity.js b/packages/my-joy-beta/src/containers/create-instance/affinity.js index 625266a2..6137c014 100644 --- a/packages/my-joy-beta/src/containers/create-instance/affinity.js +++ b/packages/my-joy-beta/src/containers/create-instance/affinity.js @@ -8,7 +8,7 @@ import { connect } from 'react-redux'; import get from 'lodash.get'; import remcalc from 'remcalc'; -import { AffinityIcon, P, Button, H3, Divider } from 'joyent-ui-toolkit'; +import { AffinityIcon, Button, H3, Divider } from 'joyent-ui-toolkit'; import Title from '@components/create-instance/title'; import { Rule, Header } from '@components/create-instance/affinity'; @@ -49,12 +49,12 @@ export const Affinity = ({ }>Affinity {expanded ? ( - Affinity rules control the location of instances, to help reduce traffic - across networks and keep the workload balanced. With strict rules, - instances are only provisioned when the criteria is met.{' '} + Control placement of instances on the physical servers. Design + applications to adapt at failure by distributing application components. + Instances are only provisioned when the exact criteria is met.{' '} Read the docs @@ -62,9 +62,7 @@ export const Affinity = ({ ) : null} {proceeded ? ( -

- {affinityRules.length} Affinity Rule{affinityRules.length === 1 ? '' : 's'} -

+

{affinityRules.length} Affinity Rule

) : null} {affinityRules.map((rule, index) => ( @@ -114,13 +112,15 @@ export const Affinity = ({
{expanded ? ( - + {affinityRules.length === 0 ? ( + + ) : null}