import React, { Fragment } from 'react'; import styled from 'styled-components'; import remcalc from 'remcalc'; import { Margin } from 'styled-components-spacing'; import Flex, { FlexItem } from 'styled-flex-component'; import { Field } from 'redux-form'; import { P as BaseP, H3 as BaseH3, Divider, TagList as BaseTagList, Input, Toggle as BaseToggle, Small, Button, FormGroup, FormLabel, PublicIcon, PrivateIcon, CopiableField, FormMeta, TagItem } from 'joyent-ui-toolkit'; const TagList = styled(BaseTagList)` margin-bottom: ${remcalc(-6)}; `; const SmallBordered = styled(Small)` padding-right: ${remcalc(12)}; margin-right: ${remcalc(12)}; border-right: ${remcalc(1)} solid ${props => props.theme.grey}; `; const H3 = styled(BaseH3)` margin: 0; `; const P = styled(BaseP)` margin: 0; `; const Toggle = styled(BaseToggle)` margin: 0 6px; `; const ShortDivider = styled(Divider)` margin-left: 0; margin-right: 0; `; export const Header = () => (

CNS Default Hostnames

Default hostnames are automatically generated from both the instance name and any attached networks.

); export const Footer = ({ enabled, submitting, onToggle }) => ( Disabled CNS Enabled CNS ); export const HostnamesHeader = () => (

CNS Service hostnames

CNS service hostnames are created by attaching a CNS service name to one or more instances. You can serve multiple instances under the same hostname by assigning them to a matching CNS service name.

); export const AddServiceForm = ({ handleSubmit, submitting, disabled, pristine, invalid }) => (
Attach to new CNS service name
); export const Hostname = ({ copy, values = [], network, service, noMargin, ...hostname }) => ( {network && service ? 'Network CNS service' : network ? 'Network' : service ? 'CNS service' : 'Instance name'}{' '} hostname{values.length === 1 ? '' : 's'} {hostname.public ? : } {hostname.public ? 'Public' : 'Private'} {values.map((value, i) => ( {copy ? ( ) : ( )} ))} ); const DefaultHostnames = ({ hostnames, copy }) => (
{hostnames.map(({ value, ...hostname }) => ( ))} ); const CnsHostnames = ({ hostnames = [], services = [], onRemoveService = () => null, children = null, copy = false }) => ( {children} {services.length ? ( Existing CNS service name(s) {services.map((value, index) => ( onRemoveService(value)) } id={`cns-tag-${index}`} > {value} ))} ) : null} {hostnames.length && hostnames.filter(({ values }) => values.length).length ? ( {hostnames.map(({ value, ...hostname }, index) => ( ))} ) : null} ); export default ({ copy, hostnames = [], services = [], onRemoveService, children = null }) => ( !service)} /> service)} onRemoveService={onRemoveService} > {children} );