From baf79789558570d7f21809ef7110de9194af5ae0 Mon Sep 17 00:00:00 2001 From: YanJin Date: Sun, 5 Jan 2020 12:24:35 +0100 Subject: [PATCH] ui/doc: add a link to documentaion for volume creation Refs: #2149 --- ui/src/containers/CreateVolume.js | 554 +++++++++++++++--------------- 1 file changed, 277 insertions(+), 277 deletions(-) diff --git a/ui/src/containers/CreateVolume.js b/ui/src/containers/CreateVolume.js index 54f5651dbd..39b2d00999 100644 --- a/ui/src/containers/CreateVolume.js +++ b/ui/src/containers/CreateVolume.js @@ -32,7 +32,7 @@ import { sizeUnits } from '../services/utils'; // We might want to do a factorization later for // form styled components -const CreateVolumeContainer = styled.div` +const CreateVolumeFormContainer = styled.div` display: inline-block; height: 100%; padding: ${padding.base}; @@ -93,7 +93,6 @@ const SizeUnitFieldSelectContainer = styled.div` `; const InputContainer = styled.div` - /* display: inline-flex; */ display: flex; align-items: center; `; @@ -138,12 +137,18 @@ const LabelsName = styled(LabelsValue)` color: ${props => props.theme.brand.text}; `; -const TooltipContent = styled.div` - width: 100px; +const PageContainer = styled.div` + display: flex; + justify-content: space-between; `; -const HelpIcon = styled.div` - padding-left: ${padding.small}; +const DocumentationIcon = styled.div` + margin: 60px 20px; + button { + :hover { + cursor: pointer; + } + } `; const CreateVolume = props => { @@ -244,296 +249,291 @@ const CreateVolume = props => { return isStorageClassLoading ? ( ) : ( - - - {intl.messages.nodes}, - - {match.params.id} - , - - {intl.messages.create_new_volume} - , - ]} - /> - - - {isStorageClassExist ? null : ( - } - title={intl.messages.no_storage_class_found} - messages={[ - <> - {intl.messages.storage_class_is_required} - + + + {intl.messages.nodes}, + - {intl.messages.learn_more} - - , - ]} - /> - )} - - { - const newVolume = { ...values }; - newVolume.size = `${values.sizeInput}${values.selectedUnit}`; - createVolume(newVolume, nodeName); - }} - > - {formikProps => { - const { - values, - handleChange, - errors, - touched, - setFieldTouched, - dirty, - setFieldValue, - } = formikProps; - - //touched is not "always" correctly set - const handleOnBlur = e => setFieldTouched(e.target.name, true); - const handleSelectChange = field => selectedObj => { - setFieldValue(field, selectedObj ? selectedObj.value : ''); - }; - //get the select item from the object array - const getSelectedObjectItem = (items, selectedValue) => { - return items.find(item => item.value === selectedValue); - }; - - const addLabel = () => { - const labels = values.labels; - labels[labelName] = labelValue; - setFieldValue('labels', labels); - setLabelName(''); - setLabelValue(''); - }; - - const removeLabel = key => { - const labels = values.labels; - delete labels[key]; - setFieldValue('labels', labels); - }; - - const optionsStorageClasses = storageClassesName.map(SCName => { - return { - label: SCName, - value: SCName, - 'data-cy': `storageClass-${SCName}`, + {match.params.id} + , + + {intl.messages.create_new_volume} + , + ]} + /> + + + {isStorageClassExist ? null : ( + } + title={intl.messages.no_storage_class_found} + messages={[ + <> + {intl.messages.storage_class_is_required} + + {intl.messages.learn_more} + + , + ]} + /> + )} + + { + const newVolume = { ...values }; + newVolume.size = `${values.sizeInput}${values.selectedUnit}`; + createVolume(newVolume, nodeName); + }} + > + {formikProps => { + const { + values, + handleChange, + errors, + touched, + setFieldTouched, + dirty, + setFieldValue, + } = formikProps; + + //touched is not "always" correctly set + const handleOnBlur = e => setFieldTouched(e.target.name, true); + const handleSelectChange = field => selectedObj => { + setFieldValue(field, selectedObj ? selectedObj.value : ''); }; - }); - const optionsTypes = types.map(({ label, value }) => { - return { - label, - value, - 'data-cy': `type-${value}`, + //get the select item from the object array + const getSelectedObjectItem = (items, selectedValue) => { + return items.find(item => item.value === selectedValue); + }; + + const addLabel = () => { + const labels = values.labels; + labels[labelName] = labelValue; + setFieldValue('labels', labels); + setLabelName(''); + setLabelValue(''); + }; + + const removeLabel = key => { + const labels = values.labels; + delete labels[key]; + setFieldValue('labels', labels); }; - }); - - const optionsSizeUnits = sizeUnits - /** - * `sizeUnits` have a base 2 and base 10 units - * (ie. KiB and KB). - * We chose to only display base 2 units - * to improve the UX. - */ - .filter((size, idx) => idx < 6) - .map(({ label, value }) => { + + const optionsStorageClasses = storageClassesName.map(SCName => { + return { + label: SCName, + value: SCName, + 'data-cy': `storageClass-${SCName}`, + }; + }); + const optionsTypes = types.map(({ label, value }) => { return { label, value, - 'data-cy': `size-${label}`, + 'data-cy': `type-${value}`, }; }); - return ( -
- - - - - {intl.messages.labels} - - - - { - setLabelName(e.target.value); - }} - /> - { - setLabelValue(e.target.value); - }} - /> -