fix(my-joy-beta): use new Message API

This commit is contained in:
Sérgio Ramos 2017-10-09 14:43:51 +01:00 committed by Sérgio Ramos
parent 4a668e7c32
commit 78ea172428
7 changed files with 97 additions and 44 deletions

View File

@ -5,7 +5,14 @@ import { compose, graphql } from 'react-apollo';
import find from 'lodash.find'; import find from 'lodash.find';
import get from 'lodash.get'; import get from 'lodash.get';
import { ViewContainer, Title, StatusLoader, Message } from 'joyent-ui-toolkit'; import {
ViewContainer,
Title,
StatusLoader,
Message,
MessageDescription,
MessageTitle
} from 'joyent-ui-toolkit';
import GetFirewallRules from '@graphql/list-firewall-rules.gql'; import GetFirewallRules from '@graphql/list-firewall-rules.gql';
import { FirewallRule as InstanceFirewallRule } from '@components/instances'; import { FirewallRule as InstanceFirewallRule } from '@components/instances';
@ -34,11 +41,12 @@ const Firewall = ({
const _error = const _error =
error && !values.length && !_loading ? ( error && !values.length && !_loading ? (
<Message <Message error>
title="Ooops!" <MessageTitle>Ooops!</MessageTitle>
message="An error occurred while loading your instance firewall rules" <MessageDescription>
error An error occurred while loading your instance firewall rules
/> </MessageDescription>
</Message>
) : null; ) : null;
return ( return (

View File

@ -8,7 +8,13 @@ import get from 'lodash.get';
import sortBy from 'lodash.sortby'; import sortBy from 'lodash.sortby';
import find from 'lodash.find'; import find from 'lodash.find';
import { ViewContainer, Title, Message } from 'joyent-ui-toolkit'; import {
ViewContainer,
Title,
Message,
MessageDescription,
MessageTitle
} from 'joyent-ui-toolkit';
import ListInstances from '@graphql/list-instances.gql'; import ListInstances from '@graphql/list-instances.gql';
import StopInstance from '@graphql/stop-instance.gql'; import StopInstance from '@graphql/stop-instance.gql';
@ -43,11 +49,12 @@ const List = ({
const _error = const _error =
error && !_instances.length && !_loading ? ( error && !_instances.length && !_loading ? (
<Message <Message error>
title="Ooops!" <MessageTitle>Ooops!</MessageTitle>
message="An error occurred while loading your instances." <MessageDescription>
error An error occurred while loading your instances
/> </MessageDescription>
</Message>
) : null; ) : null;
const handleAction = name => onAction({ name, ids: selected }); const handleAction = name => onAction({ name, ids: selected });

View File

@ -7,7 +7,14 @@ import { reduxForm } from 'redux-form';
import find from 'lodash.find'; import find from 'lodash.find';
import get from 'lodash.get'; import get from 'lodash.get';
import { ViewContainer, Title, StatusLoader, Message } from 'joyent-ui-toolkit'; import {
ViewContainer,
Title,
StatusLoader,
Message,
MessageDescription,
MessageTitle
} from 'joyent-ui-toolkit';
import GetMetadata from '@graphql/list-metadata.gql'; import GetMetadata from '@graphql/list-metadata.gql';
import { KeyValue } from '@components/instances'; import { KeyValue } from '@components/instances';
@ -44,11 +51,12 @@ const Metadata = ({ metadata = [], loading, error }) => {
const _error = const _error =
error && !values.length && !_loading ? ( error && !values.length && !_loading ? (
<Message <Message error>
title="Ooops!" <MessageTitle>Ooops!</MessageTitle>
message="An error occurred while loading your instance metadata" <MessageDescription>
error An error occurred while loading your instance metadata
/> </MessageDescription>
</Message>
) : null; ) : null;
return ( return (

View File

@ -5,7 +5,14 @@ import { compose, graphql } from 'react-apollo';
import find from 'lodash.find'; import find from 'lodash.find';
import get from 'lodash.get'; import get from 'lodash.get';
import { ViewContainer, Title, StatusLoader, Message } from 'joyent-ui-toolkit'; import {
ViewContainer,
Title,
StatusLoader,
Message,
MessageDescription,
MessageTitle
} from 'joyent-ui-toolkit';
import GetNetworks from '@graphql/list-networks.gql'; import GetNetworks from '@graphql/list-networks.gql';
import { Network as InstanceNetwork } from '@components/instances'; import { Network as InstanceNetwork } from '@components/instances';
@ -15,8 +22,6 @@ const Networks = ({ networks = [], loading, error }) => {
const _title = <Title>Networks</Title>; const _title = <Title>Networks</Title>;
const _loading = !(loading && !values.length) ? null : <StatusLoader />; const _loading = !(loading && !values.length) ? null : <StatusLoader />;
console.log(values);
const _networks = const _networks =
!_loading && !_loading &&
values.map((network, i, all) => ( values.map((network, i, all) => (
@ -30,11 +35,12 @@ const Networks = ({ networks = [], loading, error }) => {
const _error = const _error =
error && !values.length && !_loading ? ( error && !values.length && !_loading ? (
<Message <Message error>
title="Ooops!" <MessageTitle>Ooops!</MessageTitle>
message="An error occurred while loading your instance networks" <MessageDescription>
error An error occurred while loading your instance networks
/> </MessageDescription>
</Message>
) : null; ) : null;
return ( return (

View File

@ -6,7 +6,14 @@ import { compose, graphql } from 'react-apollo';
import find from 'lodash.find'; import find from 'lodash.find';
import get from 'lodash.get'; import get from 'lodash.get';
import { ViewContainer, Title, StatusLoader, Message } from 'joyent-ui-toolkit'; import {
ViewContainer,
Title,
StatusLoader,
Message,
MessageTitle,
MessageDescription
} from 'joyent-ui-toolkit';
import GetSnapshots from '@graphql/list-snapshots.gql'; import GetSnapshots from '@graphql/list-snapshots.gql';
@ -19,11 +26,12 @@ const Snapshots = ({ snapshots = [], loading, error }) => {
const _summary = !_loading && <ReactJson src={snapshots} />; const _summary = !_loading && <ReactJson src={snapshots} />;
const _error = !(error && !_loading) ? null : ( const _error = !(error && !_loading) ? null : (
<Message <Message error>
title="Ooops!" <MessageTitle>Ooops!</MessageTitle>
message="An error occurred while loading your instance snapshots" <MessageDescription>
error An error occurred while loading your instance snapshots
/> </MessageDescription>
</Message>
); );
return ( return (

View File

@ -5,7 +5,14 @@ import { compose, graphql } from 'react-apollo';
import find from 'lodash.find'; import find from 'lodash.find';
import get from 'lodash.get'; import get from 'lodash.get';
import { ViewContainer, Title, StatusLoader, Message } from 'joyent-ui-toolkit'; import {
ViewContainer,
Title,
StatusLoader,
Message,
MessageDescription,
MessageTitle
} from 'joyent-ui-toolkit';
import GetInstance from '@graphql/get-instance.gql'; import GetInstance from '@graphql/get-instance.gql';
@ -17,11 +24,12 @@ const Summary = ({ instance = {}, loading, error }) => {
const _summary = !_loading && <ReactJson src={instance} />; const _summary = !_loading && <ReactJson src={instance} />;
const _error = !(error && !_loading) ? null : ( const _error = !(error && !_loading) ? null : (
<Message <Message error>
title="Ooops!" <MessageTitle>Ooops!</MessageTitle>
message="An error occurred while loading your instance summary" <MessageDescription>
error An error occurred while loading your instance summary
/> </MessageDescription>
</Message>
); );
return ( return (

View File

@ -7,7 +7,14 @@ import { reduxForm } from 'redux-form';
import find from 'lodash.find'; import find from 'lodash.find';
import get from 'lodash.get'; import get from 'lodash.get';
import { ViewContainer, Title, StatusLoader, Message } from 'joyent-ui-toolkit'; import {
ViewContainer,
Title,
StatusLoader,
Message,
MessageDescription,
MessageTitle
} from 'joyent-ui-toolkit';
import { KeyValue } from '@components/instances'; import { KeyValue } from '@components/instances';
import GetTags from '@graphql/list-tags.gql'; import GetTags from '@graphql/list-tags.gql';
@ -44,11 +51,12 @@ const Tags = ({ tags = [], loading, error }) => {
const _error = const _error =
error && !values.length && !_loading ? ( error && !values.length && !_loading ? (
<Message <Message error>
title="Ooops!" <MessageTitle>Ooops!</MessageTitle>
message="An error occurred while loading your instance tags" <MessageDescription>
error An error occurred while loading your instance tags
/> </MessageDescription>
</Message>
) : null; ) : null;
return ( return (