feat(instances): wip networks, tags
This commit is contained in:
parent
f007889283
commit
1317894f27
@ -9,6 +9,8 @@ import get from 'lodash.get';
|
|||||||
import forceArray from 'force-array';
|
import forceArray from 'force-array';
|
||||||
import includes from 'lodash.includes';
|
import includes from 'lodash.includes';
|
||||||
import find from 'lodash.find';
|
import find from 'lodash.find';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import remcalc from 'remcalc';
|
||||||
|
|
||||||
import Step, {
|
import Step, {
|
||||||
Header as StepHeader,
|
Header as StepHeader,
|
||||||
@ -26,6 +28,10 @@ import { Forms, Values } from '../constants';
|
|||||||
const { IC_NW_F } = Forms;
|
const { IC_NW_F } = Forms;
|
||||||
const { IC_NW_V_INFO_EXPANDED, IC_NW_V_MACHINES_EXPANDED } = Values;
|
const { IC_NW_V_INFO_EXPANDED, IC_NW_V_MACHINES_EXPANDED } = Values;
|
||||||
|
|
||||||
|
const Form = styled.form`
|
||||||
|
padding-top: ${remcalc(1)};
|
||||||
|
`;
|
||||||
|
|
||||||
const Network = ({
|
const Network = ({
|
||||||
preview = [],
|
preview = [],
|
||||||
initialValues,
|
initialValues,
|
||||||
@ -78,7 +84,7 @@ const Network = ({
|
|||||||
<StatusLoader />
|
<StatusLoader />
|
||||||
) : (
|
) : (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<form>
|
<Form>
|
||||||
{networks.map(
|
{networks.map(
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
@ -105,7 +111,7 @@ const Network = ({
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</form>
|
</Form>
|
||||||
<Margin top="5">
|
<Margin top="5">
|
||||||
<Button type="button" component={Link} to={next}>
|
<Button type="button" component={Link} to={next}>
|
||||||
Save
|
Save
|
||||||
|
@ -39,7 +39,7 @@ const TagList = styled(BaseTagList)`
|
|||||||
|
|
||||||
const Tag = ({ name, value, onRemoveClick }) => (
|
const Tag = ({ name, value, onRemoveClick }) => (
|
||||||
<Margin right={1} bottom={1} key={`${name}-${value}`}>
|
<Margin right={1} bottom={1} key={`${name}-${value}`}>
|
||||||
<TagItem onRemoveClick={onRemoveClick}>
|
<TagItem fill="grey" onRemoveClick={onRemoveClick}>
|
||||||
{name ? `${name}: ${value}` : value}
|
{name ? `${name}: ${value}` : value}
|
||||||
</TagItem>
|
</TagItem>
|
||||||
</Margin>
|
</Margin>
|
||||||
@ -96,28 +96,30 @@ const TagsContainer = ({
|
|||||||
) : null}
|
) : null}
|
||||||
{addOpen ? (
|
{addOpen ? (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<ReduxForm
|
<Margin top={2}>
|
||||||
form={IC_TAG_F_ADD}
|
<ReduxForm
|
||||||
destroyOnUnmount={false}
|
form={IC_TAG_F_ADD}
|
||||||
forceUnregisterOnUnmount={true}
|
destroyOnUnmount={false}
|
||||||
shouldAsyncValidate={shouldAsyncValidate}
|
forceUnregisterOnUnmount={true}
|
||||||
asyncValidate={handleValidate}
|
shouldAsyncValidate={shouldAsyncValidate}
|
||||||
onSubmit={handleAddTag}
|
asyncValidate={handleValidate}
|
||||||
>
|
onSubmit={handleAddTag}
|
||||||
{props => (
|
>
|
||||||
<Fragment>
|
{props => (
|
||||||
<KeyValue
|
<Fragment>
|
||||||
{...props}
|
<KeyValue
|
||||||
method="add"
|
{...props}
|
||||||
input="input"
|
method="add"
|
||||||
type="tag"
|
input="input"
|
||||||
expanded
|
type="tag"
|
||||||
borderless
|
expanded
|
||||||
onCancel={() => handleChangeAddOpen(false)}
|
borderless
|
||||||
/>
|
onCancel={() => handleChangeAddOpen(false)}
|
||||||
</Fragment>
|
/>
|
||||||
)}
|
</Fragment>
|
||||||
</ReduxForm>
|
)}
|
||||||
|
</ReduxForm>
|
||||||
|
</Margin>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
) : (
|
) : (
|
||||||
<Margin top={5}>
|
<Margin top={5}>
|
||||||
|
@ -6,6 +6,7 @@ import { Margin, Padding } from 'styled-components-spacing';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import Flex, { FlexItem } from 'styled-flex-component';
|
import Flex, { FlexItem } from 'styled-flex-component';
|
||||||
import remcalc from 'remcalc';
|
import remcalc from 'remcalc';
|
||||||
|
import { isNot } from 'styled-is';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
H4,
|
H4,
|
||||||
@ -13,7 +14,7 @@ import {
|
|||||||
Small,
|
Small,
|
||||||
DotIcon,
|
DotIcon,
|
||||||
Card,
|
Card,
|
||||||
CardHeader,
|
CardHeader as BaseCardHeader,
|
||||||
CardHeaderMeta,
|
CardHeaderMeta,
|
||||||
CardHeaderBox,
|
CardHeaderBox,
|
||||||
CardOutlet,
|
CardOutlet,
|
||||||
@ -38,6 +39,12 @@ const Box = styled.div`
|
|||||||
min-width: ${remcalc(300)};
|
min-width: ${remcalc(300)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const CardHeader = styled(BaseCardHeader)`
|
||||||
|
${isNot('secondary')`
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
`};
|
||||||
|
`;
|
||||||
|
|
||||||
export const Collapsed = ({ name, fabric, ...network }) => (
|
export const Collapsed = ({ name, fabric, ...network }) => (
|
||||||
<Margin inline right={3} top={3}>
|
<Margin inline right={3} top={3}>
|
||||||
<Box>
|
<Box>
|
||||||
@ -186,7 +193,7 @@ export const Expanded = ({
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<Margin top={3}>
|
<Margin top={3}>
|
||||||
<Card collapsed={!infoExpanded} actionable={!infoExpanded}>
|
<Card collapsed={!infoExpanded} actionable={!infoExpanded}>
|
||||||
<CardHeader
|
<BaseCardHeader
|
||||||
secondary={false}
|
secondary={false}
|
||||||
transparent={false}
|
transparent={false}
|
||||||
onClick={onInfoClick}
|
onClick={onInfoClick}
|
||||||
@ -199,7 +206,7 @@ export const Expanded = ({
|
|||||||
<CardHeaderBox>
|
<CardHeaderBox>
|
||||||
<ArrowIcon direction={infoExpanded ? 'up' : 'down'} />
|
<ArrowIcon direction={infoExpanded ? 'up' : 'down'} />
|
||||||
</CardHeaderBox>
|
</CardHeaderBox>
|
||||||
</CardHeader>
|
</BaseCardHeader>
|
||||||
{infoExpanded ? (
|
{infoExpanded ? (
|
||||||
<CardOutlet>
|
<CardOutlet>
|
||||||
<Padding all={3}>
|
<Padding all={3}>
|
||||||
@ -277,7 +284,7 @@ export const Expanded = ({
|
|||||||
collapsed={!machinesExpanded}
|
collapsed={!machinesExpanded}
|
||||||
actionable={!machinesExpanded}
|
actionable={!machinesExpanded}
|
||||||
>
|
>
|
||||||
<CardHeader
|
<BaseCardHeader
|
||||||
secondary={false}
|
secondary={false}
|
||||||
transparent={false}
|
transparent={false}
|
||||||
onClick={onMachinesClick}
|
onClick={onMachinesClick}
|
||||||
@ -292,7 +299,7 @@ export const Expanded = ({
|
|||||||
direction={machinesExpanded ? 'up' : 'down'}
|
direction={machinesExpanded ? 'up' : 'down'}
|
||||||
/>
|
/>
|
||||||
</CardHeaderBox>
|
</CardHeaderBox>
|
||||||
</CardHeader>
|
</BaseCardHeader>
|
||||||
{machinesExpanded ? (
|
{machinesExpanded ? (
|
||||||
<CardOutlet>
|
<CardOutlet>
|
||||||
<Padding top={2} bottom={2} left={3} right={3}>
|
<Padding top={2} bottom={2} left={3} right={3}>
|
||||||
|
@ -210,7 +210,7 @@ export const KeyValue = ({
|
|||||||
onClick={handleHeaderClick}
|
onClick={handleHeaderClick}
|
||||||
>
|
>
|
||||||
<PaddingMaxWidth left={borderless ? 0 : 3} right={borderless ? 0 : 3}>
|
<PaddingMaxWidth left={borderless ? 0 : 3} right={borderless ? 0 : 3}>
|
||||||
<Flex alignCenter justifyBetween full>
|
<Flex alignCenter justifyBetween>
|
||||||
<Meta>
|
<Meta>
|
||||||
{method === 'add' || method === 'create' ? (
|
{method === 'add' || method === 'create' ? (
|
||||||
<H4>{`${titleCase(method)} ${type}`}</H4>
|
<H4>{`${titleCase(method)} ${type}`}</H4>
|
||||||
|
@ -46,13 +46,13 @@ const Tag = styled.li`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export default withTheme(
|
export default withTheme(
|
||||||
({ theme, children, active, onRemoveClick, ...rest }) => (
|
({ theme, children, active, onRemoveClick, fill = null, ...rest }) => (
|
||||||
<Container>
|
<Container>
|
||||||
<Tag active={active} {...rest}>
|
<Tag active={active} {...rest}>
|
||||||
{children}
|
{children}
|
||||||
{onRemoveClick ? (
|
{onRemoveClick ? (
|
||||||
<CloseIcon
|
<CloseIcon
|
||||||
fill={active ? theme.primaryActive : theme.text}
|
fill={fill ? fill : active ? theme.primaryActive : theme.text}
|
||||||
disabled
|
disabled
|
||||||
onClick={onRemoveClick}
|
onClick={onRemoveClick}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user