import React, { Fragment } from 'react'; import { compose, graphql } from 'react-apollo'; import { Margin } from 'styled-components-spacing'; import find from 'lodash.find'; import get from 'lodash.get'; import remcalc from 'remcalc'; import { ViewContainer, StatusLoader, Divider, Message, MessageTitle, MessageDescription } from 'joyent-ui-toolkit'; import ImageSummary from '@components/summary'; import GetImage from '@graphql/get-image.gql'; export const Summary = ({ image, loading = false, error = null }) => ( {loading && !image ? ( ) : null} {error && !loading && !image ? ( Ooops! An error occurred while loading your instance summary ) : null} {image ? : null} ); export default compose( graphql(GetImage, { options: ({ match }) => ({ variables: { name: get(match, 'params.image') } }), props: ({ data: { loading = false, error = null, variables, ...rest } }) => ({ image: find(get(rest, 'images', []), ['name', variables.name]), loading, error }) }) )(Summary);